actor Sparkman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_3G"
dropitem "SparkShockWep"
Weapon.AmmoUse 0
Weapon.AmmoGive 28
Obituary "$OB_SPARKSHOCK"
Inventory.Pickupmessage "Power up! Mighty Spark Shock!"
weapon.ammotype "MightyGodAmmo"
States
{
Spawn:
C_03 G 1
loop

Deselect:
SPAA E 0
goto DeselectSwap
Select:
SPAA E 0
goto SelectSwap

Ready:
SPAA E 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_SPARKMAN)
SPAA E 0 A_TakeInventory("SparkmanHoldFlag")
SPAA EDC 3
Ready1:
SPAA B 0 A_JumpIfInventory("MightyGodAmmo",28,"Ready2")
SPAA B 5 A_WeaponReady(8)
SPAA B 0 A_GiveInventory("MightyGodAmmo",1)
loop
Ready2:
SPAA B 5 A_WeaponReady
SPAA B 0 A_GiveInventory("MightyGodAmmo",1)
loop

Fire:
SPAA A 0 A_JumpIfInventory("IsBot",1,"BotFire")
SPAA A 0 A_GunFlash("Flash",1)
SPAA A 0 A_GiveInventory("SparkmanHoldFlag",1)
SPAA A 1 Offset(0,12)A_SpawnItemEx("BigShockFXWarper",0,0,80,0,0,0,0,1)
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,"Fire_R")
TNT1 A 3 A_WeaponReady(14)
SPAA FG 3
SPAA G 0 A_JumpIfInventory("IsBot",1,"BotFire3")
goto FireH
Fire_R:
TNT1 A 1 A_WeaponReady(14)
SPAA FG 1
SPAA G 0 A_JumpIfInventory("IsBot",1,"BotFire3")
goto FireH

FireH:
SPAA G 0 A_JumpIfInventory("SparkmanHoldFlag",28,"FireEnd")
SPAA G 0 A_GiveInventory("SparkmanHoldFlag",1)
SPAA G 0 A_JumpIfInventory("SparkmanHoldFlag",8,"FireH_A")
SPAA G 1
SPAA G 0 A_ReFire(1)
goto FireEnd
SPAA G 1 A_JumpIfInventory("PlayerPropertyRage",1,2)
SPAA G 0 A_ReFire(1)
goto FireEnd
SPAA G 1
SPAA G 0 A_ReFire("FireH")
goto FireEnd

FireH_A:
SPAA G 0 A_JumpIfInventory("SparkmanHoldFlag",28,"FireEnd")
SPAA G 1 A_WeaponReady(6)
SPAA G 0 A_ReFire(1)
goto FireEnd
SPAA G 1 A_WeaponReady(6)
SPAA G 0 A_ReFire(1)
goto FireEnd
SPAA G 0 A_GiveInventory("SparkmanHoldFlag",1)
SPAA G 1 A_WeaponReady(6)
SPAA G 0 A_ReFire("FireH_A")
goto FireEnd

FireEnd:
SPAA H 0 A_PlaySoundEx("weapon/sparkshock","Weapon")
SPAA H 0 A_FireCustomMissile("BigShock",0,0,0,0)
SPAA H 0 A_TakeInventory("SparkmanHoldFlag",99)
SPAA HGF 3
TNT1 A 19 A_ClearRefire
SPAA A 3 Offset(0,12)
SPAA B 3 Offset(0,22)
SPAA B 3 A_WeaponReady(14)
SPAA B 0 A_GunFlash("NoFlash",1)
Goto Ready1

Flash:
TNT1 A 1
TNT1 A 4 A_GiveInventory("MightyGodAmmo",1)
loop

Altfire:
SPAA A 0 A_JumpIfInventory("SparkmanHoldFlag",8,"AltfireOld")//StunRing
SPAA A 1 Offset(0,52)
SPAA I 0 A_PlaySoundEx("weapon/ShockLob","Weapon")
SPAA I 0 A_TakeInventory("MightyGodAmmo",7)
SPAA I 0 A_TakeInventory("MightyGodAmmo",21,1)
SPAA I 2 offset(4,38)A_FireCustomMissile("SparkM_ShockLob",0,0,8,0)
SPAA J 2 offset(12,16)
SPAA K 2 offset(20,33)
SPAA L 8 offset(20,24)
SPAA L 2 offset(22,36)
SPAA L 2 offset(24,56)
SPAA L 2 offset(30,76)
TNT1 A 4 Offset(-10,52)
//SPAA A 3 Offset(0,52)
//SPAA B 3 A_WeaponReady(14)
SPAA E 2 Offset(-6,142)
SPAA D 2 Offset(-3,96)
SPAA C 2 Offset(-1,62)
Goto Ready1

AltfireOld:
SPAA C 0 A_TakeInventory("SparkmanHoldFlag",99)
SPAA C 0 A_ClearRefire

SPAA C 0 A_GiveInventory("VivifyDelay8",1)
SPAA C 0 A_Refire(1)
SPAA C 0 A_PlaySoundEx("weapon/sparkalt","Weapon")
SPAA C 0 A_GiveInventory("Sparkman_FireSplit_P")
SPAA C 2 Offset(0,22)
SPAA D 2 Offset(0,12)
SPAA E 2 Offset(0,2)
SPAA D 2 Offset(0,12)
SPAA C 2 Offset(0,22)
SPAA B 2 Offset(0,34)
SPAA A 2 Offset(0,46)
SPAA A 6 Offset(0,50)
SPAA A 2 Offset(0,41)
SPAA B 2 A_WeaponReady(14)
SPAA B 0 A_GunFlash("NoFlash",1)
Goto Ready1

BotFire:
SPAA A 0 A_JumpIfCloser(600,1)
goto Fire+1
SPAA A 0 A_JumpIfInventory("MightyGodAmmo",28,"AltFire")
goto Fire+1
BotFire3:
SPAA G 1 A_JumpIfCloser(675,"BotFire4")
SPAA G 0 A_ReFire(1)
goto FireEnd
SPAA G 0 A_Jump(4,"AltfireOld")
SPAA G 1 A_Jump(32,"FireEnd")
SPAA G 0 A_ReFire("BotFire3")
goto FireEnd
BotFire4:
SPAA G 0 A_Jump(32,"AltfireOld")
goto BotFire3+2

}
}

actor MightyGodAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 28
+INVENTORY.IGNORESKILL
}

actor HalfShockedStopGiver : PowerApropGiver {}
actor HalfShockedStop : PowerSpeed
{
powerup.duration 18
Speed 1.0//Speed 0.0
}


actor SparkmanHoldFlag : Inventory
{
inventory.amount 1
inventory.maxamount 28
}

actor BigShockFXWarper : ShieldWarper_CBM
{
+NOTIMEFREEZE
+FORCEXYBILLBOARD
+BRIGHT
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_GiveInventory("MM8BDMProjSpawnFuncClient")
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_clientwarper",37)
TNT1 A 0 A_Warp(2,0,0,80,0,24)
Goto Shield
Shield:
//SPMS A 0 A_JumpIfInTargetInventory("PlayerPropertyRage",1,3)
SPMS AAAABBBB 1 A_Warp(2,0,0,80,0,24)
loop
}
}

actor BigShockFX1 : BasicGraphicEffect
{
+NOTIMEFREEZE
+FORCEXYBILLBOARD
+BRIGHT
States
{
SpawnFrame:
SPMS A 1
stop
}
}

actor BigShockFX2 : BigShockFX1
{
States
{
SpawnFrame:
SPMS B 1
stop
}
}



actor BigShock : ProjSpawnFuncActor
{
PROJECTILE
damagetype "SparkM_Shock"
Obituary "$OB_SPARKSHOCK"
+SKYEXPLODE
+EXPLODEONWATER
+FORCEXYBILLBOARD
+BRIGHT
damage (250)//350
Radius 18
Height 18
Speed 35
Scale 2.5
States
{
Spawn:
SPMS AB 4
loop
XDeath:
TNT1 A 0
stop
Death:
SPMS K 0 A_SpawnItemEX("ElectrifyEffect")
SPMS KLM 2
stop
DeathOld:
SPMS E 0 A_SpawnItemEx("BigShockBurst")
SPMS EFG 2
stop
}
}

actor BigShockBurst : BasicImplosion
{
damagetype "SparkM_Zap"
Obituary "$OB_SPARKSHOCK"
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(150,88,0,0,18)
stop
}
}

actor Sparkman_FireSplit_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_FireCustomMissile("SmallShock",22.5*1,0,0,0)
TNT1 A 0 A_FireCustomMissile("SmallShock",22.5*15,0,0,0)
TNT1 A 0 A_FireCustomMissile("SmallShock",0,0,0,0)
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*2,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*3,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*4,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*5,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*6,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*7,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*8,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*9,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*10,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*11,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*12,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*13,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*14,1)
TNT1 A 0 A_JumpIfInventory("PlayerPropertySpread",1,"PickupS")
stop
PickupS:
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*2+15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*3+15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*4+15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*5+15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*6+15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*7+15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*8+15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*9+15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*10+15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*11+15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*12+15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*13+15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*14+15,1)

TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*2-15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*3-15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*4-15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*5-15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*6-15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*7-15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*8-15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*9-15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*10-15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*11-15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*12-15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*13-15,1)
TNT1 A 0 A_SpawnItemEx("SmallShock",16,0,32,32,0,0,22.5*14-15,1)
stop
}
}

actor SmallShock : ProjSpawnFuncActor
{
PROJECTILE
damagetype "SparkM_Shock2"
Obituary "$OB_SPARKSHOCK"
+FORCEXYBILLBOARD
+BRIGHT
damage (60)//120
Radius 9
Height 9
speed 32
scale 2.5
States
{
Spawn:
SPMS CD 4
loop
Death:
TNT1 A 0 A_SpawnItemEX("ElectrifyEffect")
stop
}
}

actor SparkM_LobProtect : PowerProtection
{
Powerup.Duration 10
damagefactor "SparkM_Lob", 0.0
}

//4 TIC FOR enemy spark shot

actor SparkM_ShockLob : ProjSpawnFuncActor
{
PROJECTILE
damagetype "SparkM_Lob"
Obituary "$OB_SPARKSHOCK"
-NOGRAVITY
//+RIPPER
+SKYEXPLODE
+BOUNCEONWALLS
+BOUNCEONCEILINGS
+CANBOUNCEWATER
+FORCEXYBILLBOARD
+BRIGHT
Damage (30)
Radius 14
Height 14
speed 24
scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_ChangeVelocity(0,0,10)
SPMS HHHHIIII 1 A_SpawnItemEX("SparkM_ShockLobFX",random(0,28),0,random(-28,28),0,0,0,random(90,270),1)
goto Spawn+2
Crash:
Death:
TNT1 A 0 A_SpawnItemEx("SparkM_ShockLobGround",0,0,0,0,0,0,0,1)
XDeath:
TNT1 A 0 A_SpawnItemEX("ElectrifyEffect")
stop
}
}

actor SparkM_ShockLobFX : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
Mass 5
Scale 2.25
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 0 A_Jump(256,1,2,3,4)
SpawnL:
SPMS NNOO 1 A_FadeOut(Mass/100.0)
loop
}
}
actor SparkM_ShockLobFX2 : SparkM_ShockLobFX
{
Mass 8
}
actor SparkM_ShockLobFX3 : SparkM_ShockLobFX
{
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 0 A_Jump(256,1,2,3,4)
SpawnL:
SPMS IIJJ 1 A_FadeOut(Mass/100.0)
loop
}
}

actor SparkM_ShockLobGround : SparkM_ShockLob
{
+NOGRAVITY
+DONTBLAST
+THRUACTORS
+FLOORHUGGER
//+EXPLODEONDEATH
Reactiontime 7
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("SparkM_ShockLobGroundFX_H",0,0,0,0,0,0,0,1)
TNT1 A 0 A_PlaySoundEx("misc/wilystart","Voice",1)
TNT1 A 0 A_Explode(0,96,0,0,96)
TNT1 A 1 A_Explode(30,96,0,0,96)
TNT1 A 0 A_Explode(0,96,0,0,96)
TNT1 A 1 A_Explode(30,96,0,0,96)
TNT1 A 0 A_Explode(0,96,0,0,96)
TNT1 A 1 A_Explode(30,96,0,0,96)
TNT1 A 0 A_Explode(0,96,0,0,96)
TNT1 A 1 A_Explode(30,96,0,0,96)
TNT1 A 0 A_Explode(0,96,0,0,96)
TNT1 A 1 A_Explode(30,96,0,0,96)
TNT1 A 0 A_CountDown
goto Spawn+3
Death:
TNT1 A 1 //A_StopSound("Voice")
stop
}
}

actor SparkM_ShockLobGroundFX_H : BasicGraphicEffect
{
RenderStyle None
States
{
Spawn:
TNT1 A 0
TNT1 AAA 0 A_SpawnItemEX("SparkM_ShockLobFX2",random(1,31)*3,0,0,0,0,frandom(1,4),random(0,89)*3,1)
TNT1 AAA 0 A_SpawnItemEX("SparkM_ShockLobFX2",random(1,31)*3,0,0,0,0,frandom(1,4),random(90,179),1)
TNT1 AAA 0 A_SpawnItemEX("SparkM_ShockLobFX2",random(1,31)*3,0,0,0,0,frandom(1,4),random(180,269),1)
TNT1 AAA 0 A_SpawnItemEX("SparkM_ShockLobFX2",random(1,31)*3,0,0,0,0,frandom(1,4),random(270,359),1)
TNT1 A 0 A_SpawnItemEX("SparkM_ShockLobFX3",96,0,0,0,0,random(1,2),22.5*0,1)
TNT1 A 0 A_SpawnItemEX("SparkM_ShockLobFX3",96,0,0,0,0,random(1,2),22.5*1,1)
TNT1 A 0 A_SpawnItemEX("SparkM_ShockLobFX3",96,0,0,0,0,random(1,2),22.5*2,1)
TNT1 A 0 A_SpawnItemEX("SparkM_ShockLobFX3",96,0,0,0,0,random(1,2),22.5*3,1)
TNT1 A 0 A_SpawnItemEX("SparkM_ShockLobFX3",96,0,0,0,0,random(1,2),22.5*4,1)
TNT1 A 0 A_SpawnItemEX("SparkM_ShockLobFX3",96,0,0,0,0,random(1,2),22.5*5,1)
TNT1 A 0 A_SpawnItemEX("SparkM_ShockLobFX3",96,0,0,0,0,random(1,2),22.5*6,1)
TNT1 A 0 A_SpawnItemEX("SparkM_ShockLobFX3",96,0,0,0,0,random(1,2),22.5*7,1)
TNT1 A 0 A_SpawnItemEX("SparkM_ShockLobFX3",96,0,0,0,0,random(1,2),22.5*8,1)
TNT1 A 0 A_SpawnItemEX("SparkM_ShockLobFX3",96,0,0,0,0,random(1,2),22.5*9,1)
TNT1 A 0 A_SpawnItemEX("SparkM_ShockLobFX3",96,0,0,0,0,random(1,2),22.5*10,1)
TNT1 A 0 A_SpawnItemEX("SparkM_ShockLobFX3",96,0,0,0,0,random(1,2),22.5*11,1)
TNT1 A 0 A_SpawnItemEX("SparkM_ShockLobFX3",96,0,0,0,0,random(1,2),22.5*12,1)
TNT1 A 0 A_SpawnItemEX("SparkM_ShockLobFX3",96,0,0,0,0,random(1,2),22.5*13,1)
TNT1 A 0 A_SpawnItemEX("SparkM_ShockLobFX3",96,0,0,0,0,random(1,2),22.5*14,1)
TNT1 A 0 A_SpawnItemEX("SparkM_ShockLobFX3",96,0,0,0,0,random(1,2),22.5*15,1)
TNT1 A 5 A_CountDown
loop
}
}

//actor Sparkman_W_NormalBar : NormalBar {Args 4,225}
actor Sparkman_W_ScriptBar : ScriptBar {}