actor Cloudman_W : BaseMM8BDMWep_CBM 
{
tag "$TAGC_7D"
dropitem "ThunderBoltWep"
Weapon.AmmoUse 1
Weapon.AmmoGive 28
Obituary "$OB_THUNDERBOLT"
weapon.ammotype "RainAmmo"
States
{
Spawn:
C_07 D 1
loop

Deselect:
CLOH A 0
goto DeselectSwap
Select:
CLOH A 0
goto SelectSwap

Ready:
CLOH A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_CLOUDMAN)
CLOH A 0 A_GunFlash("Flash",1)
CLOH A 1 A_WeaponReady
wait

Fire:
CLOH A 0 A_JumpIfNoAmmo("NoAmmoFire")
CLOH A 0 A_PlaySoundEx("weapon/TSTRIKE","Weapon")
CLOH A 0 A_FireCustomMissile("CloudM_Bolt",0,0,8,0)
CLOH A 0 A_JumpIfInventory("IBeFlyin",1,2)
CLOH A 0 A_TakeInventory("RainAmmo",1)
CLOH A 0 A_TakeInventory("RainAmmo",3,1)
CLOH G 2 OffSet(-1,32)
CLOH G 2 OffSet(-41,42)
CLOH G 2 OffSet(-84,57)
CLOH H 2 OffSet(-119,61)
CLOH H 2 OffSet(-149,85)
CLOH H 2 OffSet(-172,111)
TNT1 A 10
CLOH A 2 OffSet(-10,80)
CLOH A 2 OffSet(-4,53)
Goto Ready+2
NoAmmoFire:
CLOH A 0 A_GiveInventory("ClowmanNoAmmoSlow")
CLOH B 2 OffSet(9,24)A_GiveInventory("VivifyFlag1")
CLOH B 2 OffSet(18,15)
CLOH C 2 OffSet(-1,40)
CLOH C 2 OffSet(11,31)

CLOH C 13 OffSet(23,22)
CLOH C 3 OffSet(23,22)A_TakeInventory("VivifyFlag1")
CLOH G 0
CLOH G 0 OffSet(-1,32)A_PlaySoundEx("weapon/thunderbolt","Weapon")
CLOH G 2 OffSet(-1,32)A_FireCustomMissile("CloudM_BoltNoAmmo",0,0,8,0)
CLOH G 2 OffSet(-41,42)
CLOH G 2 OffSet(-84,57)
CLOH H 2 OffSet(-119,61)A_TakeInventory("ClowmanNoAmmoSlow")
CLOH H 2 OffSet(-149,85)
CLOH H 2 OffSet(-172,111)
TNT1 A 4
CLOH A 2 OffSet(-10,80)
CLOH A 2 OffSet(-4,53)
goto Ready+2
Altfire:
CLOH A 0 A_JumpIfInventory("IBeFlyin",1,"FlyFire")
CLOH A 0 A_JumpIf(z-floorz==0,"Recharge")
CLOH A 0 A_JumpIf(momz==0,"momzverify")
goto Ready+2
momzverify:
CLOH A 1 A_JumpIf(z-floorz==0,"Recharge")
CLOH A 0 A_JumpIf(momz==0,"Recharge")
goto Ready+2
Recharge:
CLOH A 0 ACS_NamedExecuteWithResult("core_stopplayer",0,1)
CLOH A 0 A_GiveInventory("VivifyFlag1")
CLOH A 0 A_GiveInventory("CloudNoItemFlag")

CLOH A 0 A_PlaySoundEx("weapon/CloudAlt","Weapon")

CLOH B 2 OffSet(9,21)A_SpawnItemEx("CloudM_Zapper_H",0,0,0,0,0,0,0,1)
CLOH B 2 OffSet(18,9)
CLOH C 2 OffSet(-1,32)
CLOH C 2 OffSet(11,19)
CLOH C 2 OffSet(23,6)
CLOH C 2 OffSet(23,6)A_GiveInventory("CloudM_ZapAuraFX_P")
RechargeEnd:
//CLOH EEEEEE 3 //A_PlaySoundEx("weapon/TSTRIKE","Weapon")
CLOH D 3 OffSet(23,6)ACS_NamedExecuteWithResult("core_chargecolor",DYE_CLOUDCHARGE1,TINT_TCLR1)
CLOH E 3 OffSet(23,6)ACS_NamedExecuteWithResult("core_chargecolor",DYE_CLOUDCHARGE2,TINT_TCLR2)
CLOH F 3 OffSet(23,6)ACS_NamedExecuteWithResult("core_chargecolor",DYE_CLOUDCHARGE3,TINT_TCLR3)
CLOH D 3 OffSet(23,6)ACS_NamedExecuteWithResult("core_chargecolor",DYE_CLOUDCHARGE1,TINT_TCLR1)
CLOH E 3 OffSet(23,6)ACS_NamedExecuteWithResult("core_chargecolor",DYE_CLOUDCHARGE2,TINT_TCLR2)
CLOH F 3 OffSet(23,6)ACS_NamedExecuteWithResult("core_chargecolor",DYE_CLOUDCHARGE3,TINT_TCLR3)
CLOH C 0 ACS_NamedExecuteWithResult("core_chargecolor",DYE_CLOUDMAN,TCLR_NONE)
CLOH C 0 //A_JumpIfInventory("RainAmmo",28,"RechargeEndX")
CLOH C 6 OffSet(23,6)A_TakeInventory("VivifyFlag1")
CLOH C 2 OffSet(8,22)
CLOH B 2 OffSet(23,5)
CLOH B 2 OffSet(11,19)ACS_NamedExecuteWithResult("core_stopplayer",0,0)
CLOH B 0 A_GiveInventory("RainAmmo",14)
CLOH B 0 A_TakeInventory("CloudNoItemFlag")
goto Ready+2
RechargeEndX:
CLOH C 0 A_PlaySoundEx("weapon/TSTRIKE","Weapon")
CLOH C 0 A_FireCustomMissile("CloudM_ZapDown",0,1,0,0)
goto RechargeEnd+8

FlyFire:
CLOH A 0 A_JumpIfInventory("RainAmmo",3,"RealAltFire")
goto Ready+2
RealAltFire:
CLOH A 0 A_GiveInventory("VivifyDelay5",1)
CLOH A 0 A_Refire(1)
CLOH A 3 OffSet(-20,38)
CLOH H 6 OffSet(-99,81)
CLOH H 0 A_PlaySoundEx("weapon/TSTRIKE","Weapon")
CLOH H 0 A_FireCustomMissile("CloudM_ZapDown",0,1,0,0)
//CLOH H 0 A_TakeInventory("RainAmmo",1)
CLOH H 0 A_TakeInventory("RainAmmo",3,1)
CLOH H 6 OffSet(-103,102)A_TakeInventory("RainAmmo",3,1)
CLOH H 6 OffSet(-99,81)
CLOH A 6 OffSet(-20,38)
CLOH A 3 A_WeaponReady(14)
goto Ready+2

Flash:
TNT1 A 0 A_JumpIfInventory("IBeFlyin",1,2)
TNT1 A 1
loop
TNT1 A 0 ACS_NamedExecuteAlways("core_flyplayer",0,0,2)
Flash.Flyin:
TNT1 A 0 A_TakeInventory("RainAmmo",1)
TNT1 AAAAAAAAAAAAAA 1 A_JumpIfInventory("HatinFlyin",1,"Flash.FlyEnd")
TNT1 A 0 A_JumpIfInventory("RainAmmo",1,1)
goto Flash.FlyEnd
TNT1 A 0 A_TakeInventory("RainAmmo",1,1)
TNT1 AAAAAAAAAAAAAA 1 A_JumpIfInventory("HatinFlyin",1,"Flash.FlyEnd")
TNT1 A 0 A_JumpIfInventory("RainAmmo",1,"Flash.Flyin")
goto Flash.FlyEnd
Flash.FlyEnd:
TNT1 A 0 ACS_NamedExecuteAlways("core_flyplayer",0,0,0)
TNT1 A 0 A_TakeInventory("IBeFlyin",1)
goto Flash+1
}
}

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

actor ClowmanNoAmmoSlow : PowerSpeed
{
powerup.duration 35
Speed 0.5
+POWERSPEED.NOTRAIL
}

actor IBeFlyin : OnceC{}

actor HatinFlyin : OnceC{}

actor CloudNoItemFlag : OnceC{}


actor FlightItem : BasicClassItem
{
inventory.icon "ClouIcon"
inventory.pickupmessage "This just in, a high chance of thunder storms today."
Tag "Cloud Flight Toggle"
states
{
Spawn:
CLOH Z 1
loop
UseCBM:
TNT1 A 0 A_JumpIfInventory("CloudNoItemFlag",1,"No")
TNT1 A 0 A_JumpIfInventory("IBeFlyin",1,"Use3")
TNT1 A 0 A_JumpIfInventory("RainAmmo",1,"Use2")
fail
Use2:
TNT1 A 0 A_TakeInventory("HatinFlyin",1)
TNT1 A 0 A_GiveInventory("IBeFlyin",1)
fail
Use3:
TNT1 A 0 A_GiveInventory("HatinFlyin",1)
TNT1 A 0 A_TakeInventory("IBeFlyin",1)
fail
}
}

actor CloudM_Bolt : ProjSpawnFuncActor
{
PROJECTILE
damagetype "CloudM_Shot"
Obituary "$OB_THUNDERBOLT"
+SKYEXPLODE
+EXPLODEONWATER
+FORCEXYBILLBOARD
+BRIGHT
Damage (250)
Radius 25
Height 16
Speed 30
scale 2.5
States
{
Spawn:
CLOH KLMN 2 A_SpawnItemEx("CloudM_BoltFX1",0,0,0,0,0,0,0,1)
loop
XDeath:
Crash:
TNT1 A 0 A_PlaySound("weapon/CloudSplit",1,0.75)
TNT1 A 0 A_SpawnItemEx("CloudM_BoltSplitFX",0,0,4,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("CloudM_BoltSplit_T",0,0,0,30,0,0,90)
TNT1 A 0 A_SpawnItemEx("CloudM_BoltSplit_T",0,0,0,30,0,0,-90)
goto DeathEffect
Death:
TNT1 A 0 A_PlaySound("weapon/CloudSplit",1,0.75)
TNT1 A 0 A_SpawnItemEx("CloudM_BoltSplitFX",0,0,4,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("CloudM_BoltSplit",0,0,0,30,0,0,90)
TNT1 A 0 A_SpawnItemEx("CloudM_BoltSplit",0,0,0,30,0,0,-90)
goto DeathEffect
DeathEffect:
TNT1 A 1 A_SpawnItemEX("ElectrifyEffect")
stop
}
}



actor CloudM_BoltNoAmmo : CloudM_Bolt
{
States
{
Spawn:
CLOH KLMN 2
loop
XDeath:
Crash:
Death:
TNT1 A 0
goto DeathEffect
}
}

actor CloudM_BoltFX1 : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
ReactionTime 5
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 0 A_Jump(256,1,2,3,4)
CLOF CCDDEEFF 1 A_CountDown
goto Spawn+2
}
}
actor CloudM_BoltFX2 : CloudM_BoltFX1
{
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 0 A_Jump(256,1,2)
CLOH QR 1 A_CountDown
goto Spawn+2
}
}
actor CloudM_BoltSplitFX : CloudM_BoltFX1
{
States
{
SpawnFrame:
CLOH O 0
CLOH OPO 2
stop
}
}

actor CloudM_BoltSplit : ProjSpawnFuncActor
{
PROJECTILE
damagetype "CloudM_Shot"
Obituary "$OB_THUNDERBOLT"
+SKYEXPLODE
+EXPLODEONWATER
+FORCEXYBILLBOARD
+BRIGHT
Damage (150)
Radius 25
Height 16
Speed 30
scale 2.5
States
{
Spawn:
TNT1 A 0
CLOH QRQR 1 A_SpawnItemEx("CloudM_BoltFX2",0,0,0,0,0,0,0,1)
CLOH Q 0 A_ChangeFlag("THRUACTORS",0)
CLOH QR 1 A_SpawnItemEx("CloudM_BoltFX2",0,0,0,0,0,0,0,1)
CLOH Q 0 A_GiveInventory("CutterFlag",1)
goto SpawnL
SpawnL:
CLOH QR 1 A_SpawnItemEx("CloudM_BoltFX2",0,0,0,0,0,0,0,1)
loop
Death:
TNT1 A 0
goto DeathEffect
XDeath:
Crash:
TNT1 A 0 A_JumpIfInventory("CutterFlag",1,"Split")
goto DeathEffect
Split:
TNT1 A 0 A_PlaySound("weapon/CloudSplit",1,0.75)
TNT1 A 0 A_SpawnItemEx("CloudM_BoltSplitFX",0,0,4,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("CloudM_BoltSplit_T",0,0,0,30,0,0,90)
TNT1 A 0 A_SpawnItemEx("CloudM_BoltSplit_T",0,0,0,30,0,0,-90)
goto DeathEffect
DeathEffect:
TNT1 A 1 A_SpawnItemEX("ElectrifyEffect")
stop
}
}

actor CloudM_BoltSplit_T : CloudM_BoltSplit
{
+THRUACTORS
}

actor CloudM_ZapAuraFX_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("CloudM_ZapAuraFX",0,0,0,0,0,0,0,1)
stop
}
}

actor CloudM_ZapAuraFX : BasicGraphicEffect
{
+BRIGHT
ReactionTime 2
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 2 ACS_NamedExecuteAlways("cbm_clientwarper",0)
SpawnL:
CLOF SSTTUUVVWW 1 A_Warp(2,0,0,0,0,24)
CLOF S 0 A_CountDown
loop
}
}


actor CloudM_ZapDown : ProjSpawnFuncActor
{
PROJECTILE
Obituary "$OB_CLOUDALT1"
damagetype "CloudM_Zapper"
+RIPPER
Damage (170)
Radius 25
Height 16
Speed 0
scale 2.5
States
{
Spawn:
CLOF M 0 ThrustThingZ(0,-45,0,1)
CLOF M 1 A_SpawnItemEx("CloudM_ZapFX_M",0,0,0,0,0,0,0,1)
CLOF N 1 A_SpawnItemEx("CloudM_ZapFX_N",0,0,0,0,0,0,0,1)
CLOF O 1 A_SpawnItemEx("CloudM_ZapFX_O",0,0,0,0,0,0,0,1)
CLOF P 1 A_SpawnItemEx("CloudM_ZapFX_P",0,0,0,0,0,0,0,1)
CLOF Q 1 A_SpawnItemEx("CloudM_ZapFX_Q",0,0,0,0,0,0,0,1)
CLOF R 1 A_SpawnItemEx("CloudM_ZapFX_R",0,0,0,0,0,0,0,1)
loop
Death:
TNT1 A 0 A_PlaySound("weapon/CloudSplit",1,0.75)
TNT1 A 0 A_SpawnItemEx("CloudM_SparkFloor",45,0,0,30,0,0,0)
TNT1 A 0 A_SpawnItemEx("CloudM_SparkFloor",45,0,0,30,0,0,45)
TNT1 A 0 A_SpawnItemEx("CloudM_SparkFloor",45,0,0,30,0,0,90)
TNT1 A 0 A_SpawnItemEx("CloudM_SparkFloor",45,0,0,30,0,0,135)
TNT1 A 0 A_SpawnItemEx("CloudM_SparkFloor",45,0,0,30,0,0,180)
TNT1 A 0 A_SpawnItemEx("CloudM_SparkFloor",45,0,0,30,0,0,-45)
TNT1 A 0 A_SpawnItemEx("CloudM_SparkFloor",45,0,0,30,0,0,-90)
TNT1 A 0 A_SpawnItemEx("CloudM_SparkFloor",45,0,0,30,0,0,-135)
TNT1 A 1 A_SpawnItemEX("ElectrifyEffect")
stop
}
}

actor CloudM_SparkFloor : ProjSpawnFuncActor
{
PROJECTILE
Obituary "$OB_CLOUDALT2"
damagetype "CloudM_Spark"
+FLOORHUGGER
+FORCEXYBILLBOARD
+BRIGHT
Damage (200)
Radius 25
Height 16
Speed 30
scale 2.5
States
{
Spawn:
CLOF G 0
CLOF G 0 A_Jump(256,1,2,3,4,5,6)
CLOF GHIJKL 1
goto Spawn+2
Death:
TNT1 A 0 A_SpawnItemEX("ElectrifyEffect")
stop
}
}

actor CloudM_Zapper_H : BasicHelper
{
Args 416//276
States
{
Spawn:
TNT1 A 0
TNT1 A 0
TNT1 A 0 A_Warp(2,0,0,0,0,8)
TNT1 A 0 A_SpawnItemEx("CloudM_Zapper",0,0,Args[0],0,0,0,0,1)
TNT1 A 1 A_JumpIfInventory("PlayerPropertyRage",1,2,2)
TNT1 A 0 A_Warp(2,0,0,0,0,8)
TNT1 A 0 A_SpawnItemEx("CloudM_Zapper",0,0,Args[0]-30,0,0,0,0,1)
TNT1 A 1 A_SetArg(0,Args[0]-60)//40
TNT1 A 0 A_JumpIf(Args[0]<=56,1)
loop
TNT1 A 0 A_Warp(2,0,0,0,0,8)
TNT1 A 1 A_SpawnItemEX("ElectrifyEffect",0,0,Args[0])
TNT1 A 0 A_SpawnItemEx("CloudM_ZapperEnd",0,0,Args[0],0,0,0,0,1)
stop
}
}

actor CloudM_ZapperTubeFX : BasicGraphicEffect
{
+BRIGHT
ReactionTime 6
States
{
SpawnFrame:
CLOH V 0
CLOH V 1
SpawnL:
CLOH T 0 A_Jump(256,1,2)
CLOH T 1 A_CountDown
loop
CLOH U 1 A_CountDown
loop
Death:
CLOH S 1
stop
}
}


actor CloudM_Zapper : BasicExplosion
{
Obituary "$OB_CLOUDALT0"
damagetype "CloudM_Charge"
RenderStyle None
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("CloudM_ZapperTubeFX",0,0,0,0,0,0,0,1)
Spawn2:
TNT1 A 1 A_Explode(80+CallACS("core_checkrune",RUNE_SPREAD,2)*160,108,0,0,16)
TNT1 A 1
stop
}
}
actor CloudM_ZapperEnd : CloudM_Zapper
{
States
{
Spawn:
TNT1 A 0
goto Spawn2
}
}

actor CloudM_ZapFX : BasicGraphicEffect
{
+BRIGHT
}

actor CloudM_ZapFX_M : CloudM_ZapFX
{
States
{
SpawnFrame:
CLOF MNOPQR 1
stop
}
}
actor CloudM_ZapFX_N : CloudM_ZapFX{States{SpawnFrame:CLOF NOPQRM 1
stop}}
actor CloudM_ZapFX_O : CloudM_ZapFX{States{SpawnFrame:CLOF OPQRMN 1
stop}}
actor CloudM_ZapFX_P : CloudM_ZapFX{States{SpawnFrame:CLOF PQRMNO 1
stop}}
actor CloudM_ZapFX_Q : CloudM_ZapFX{States{SpawnFrame:CLOF QRMNOP 1
stop}}
actor CloudM_ZapFX_R : CloudM_ZapFX{States{SpawnFrame:CLOF RMNOPQ 1
stop}}



actor Cloudman_W_NormalBar : NormalBar {Args 228,73}
actor Cloudman_W_ScriptBar : ScriptBar {}