actor ThunderBoltBoss : MegaBuster 
{
Weapon.AmmoUse 1
Weapon.AmmoGive 28
Weapon.SlotNumber 1
Obituary "%o was fried by %k's Thunder Bolt."
weapon.ammotype "RainAmmo"
inventory.pickupsound "weapon/weaponup"
+WEAPON.AMMO_OPTIONAL
Scale 2.0
States
{
Spawn:
WEA3 R 1
loop
Ready:
CLOH A 0 ACS_ExecuteAlways(991,0,14)
CLOH A 0 A_Gunflash
CLOH A 1 A_WeaponReady(WRF_NOSWITCH)
Goto Ready+2
Deselect:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
CLOH A 1 A_Lower
Loop
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
CLOH A 1 A_Raise
Loop
Fire:
CLOH A 0 A_JumpIfNoAmmo("NoAmmo")
CLOH BCDE 3
CLOH A 0 A_PlaySoundEx("weapon/thunderbolt","Weapon")
CLOH FGH 2
CLOH A 0 A_FireCustomMissile("CloudBolt",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)
CLOH IJKL 2
CLOH A 0 A_Refire
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 SetPlayerProperty(0,1,0)
CLOH A 0 A_GiveInventory("NoItem")
CLOH A 0 A_SpawnItemEx("CloudDowner",0,0,150,0,0,150,0)
CLOH BCDE 3
CLOH U 0 A_PlaySoundEx("weapon/thunderbolt","Weapon")
CLOH E 3
CLOH U 0 A_PlaySoundEx("weapon/thunderbolt","Weapon")
CLOH E 3
CLOH U 0 A_PlaySoundEx("weapon/thunderbolt","Weapon")
CLOH E 3
CLOH U 0 A_PlaySoundEx("weapon/thunderbolt","Weapon")
CLOH E 3
CLOH U 0 A_PlaySoundEx("weapon/thunderbolt","Weapon")
CLOH E 3
CLOH U 0 A_PlaySoundEx("weapon/thunderbolt","Weapon")
CLOH E 3
CLOH EDCB 3
CLOH U 0 A_GiveInventory("RainAmmo",7)
CLOH A 0 A_TakeInventory("NoItem",999)
CLOH A 0 SetPlayerProperty(0,0,0)
CLOH A 0 A_ReFire
goto Ready+2
FlyFire:
CLOH A 0 A_JumpIfInventory("RainAmmo",3,"RealAltFire")
goto Ready+2
RealAltFire:
CLOH AL 5
TNT1 A 0 A_PlaySoundEx("weapon/thunderbolt","Weapon")
CLOH A 0 A_FireCustomMissile("CloudDown",0,1,8,0)
//CLOH A 0 A_TakeInventory("RainAmmo",1)
CLOH A 0 A_TakeInventory("RainAmmo",3)
CLOH LA 5
CLOH A 10
goto Ready+2
NoAmmo:
CLOH A 0
//CLOH A 1 ACS_Execute(979,0)
Goto Ready+2
Flash:
TNT1 A 0 A_JumpIfInventory("IBeFlyin",1,"FlyFlash1")
TNT1 A 0 SetPlayerProperty(0, 0, 3)
TNT1 A 0 A_JumpIfInventory("FlightDisableFlag",1,2)
//TNT1 A 0 A_SetGravity(0.4)
TNT1 A 0 ACS_ExecuteAlways(648,0,10)
TNT1 A 1
loop
FlyFlash1:
TNT1 A 0 A_JumpIfInventory("RainAmmo",1,"FlyFlash2")
TNT1 A 0 A_TakeInventory("IBeFlyin",1)
goto Flash+1
FlyFlash2:
TNT1 A 0 A_JumpIfInventory("FlightDisableFlag",1,2)
TNT1 A 0 SetPlayerProperty(0, 1, 3)
TNT1 A 0 A_TakeInventory("RainAmmo",1)
TNT1 AAAAAAAAAAAAAA 1 A_JumpIfInventory("HatinFlyin",1,"Flash")
goto Flash
}
}

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

actor IBeFlyin : Inventory
{
inventory.amount 1
inventory.maxamount 1
}

actor HatinFlyin : Inventory
{
inventory.amount 1
inventory.maxamount 1
}

actor NoItem : Inventory
{
inventory.amount 1
inventory.maxamount 1
}

actor CloudBolt : ThunderBolt
{
States
{
Spawn:
CLOF ABCDEF 1 A_SpawnItemEx("CloudFX")
loop
Death:
TNT1 A 0 A_CustomMissile("CloudBoltSplit",0,0,90,2,0)
TNT1 A 0 A_CustomMissile("CloudBoltSplit",0,0,-90,2,0)
TNT1 A 1
stop
}
}

actor CloudBoltSplit : ThunderBoltSplit
{
States
{
Spawn:
CLOF A 1 A_CountDown
CLOF A 0 A_SpawnItemEx("CloudFX")
CLOF B 1 A_CountDown
CLOF B 0 A_SpawnItemEx("CloudFX")
TBOL O 0 A_ChangeFlag("NOCLIP",0)
CLOF C 1 A_CountDown
CLOF C 0 A_SpawnItemEx("CloudFX")
CLOF D 1 A_CountDown
CLOF D 0 A_SpawnItemEx("CloudFX")
TBOL O 0 A_GiveInventory("CutterFlag",1)
CLOF E 1 A_CountDown
CLOF E 0 A_SpawnItemEx("CloudFX")
CLOF F 1 A_CountDown
CLOF F 0 A_SpawnItemEx("CloudFX")
loop
Split:
TNT1 A 0 A_CustomMissile("CloudBoltSplit",0,0,90,2,0)
TNT1 A 0 A_CustomMissile("CloudBoltSplit",0,0,-90,2,0)
stop
}
}

actor CloudDown
{
PROJECTILE
+RIPPER
damagetype "Bolt"
scale 2.5
Speed 0
Radius 25
Height 16
Damage (17)
States
{
Spawn:
CLOD A 0 ThrustThingZ(0, -45, 0, 1)
CLOD ABCDEF 1 A_SpawnItemEx("CloudFXDown")
loop
Death:
TNT1 A 0 A_SpawnItemEx("CloudSpark",30,30,0,30,0,0,0)
TNT1 A 0 A_SpawnItemEx("CloudSpark",30,30,0,30,0,0,45)
TNT1 A 0 A_SpawnItemEx("CloudSpark",30,30,0,30,0,0,90)
TNT1 A 0 A_SpawnItemEx("CloudSpark",30,30,0,30,0,0,135)
TNT1 A 0 A_SpawnItemEx("CloudSpark",30,30,0,30,0,0,180)
TNT1 A 0 A_SpawnItemEx("CloudSpark",30,30,0,30,0,0,-45)
TNT1 A 0 A_SpawnItemEx("CloudSpark",30,30,0,30,0,0,-90)
TNT1 A 0 A_SpawnItemEx("CloudSpark",30,30,0,30,0,0,-135)
stop
}
}

actor CloudSpark
{
PROJECTILE
+FLOORHUGGER
damagetype "Bolt"
scale 2.5
Speed 30
Radius 25
Height 16
Damage (20)
States
{
Spawn:
CLOS ABCDEF 1
loop
Death:
TNT1 A 0
stop
}
}

actor CloudFX
{
scale 2.5
-SOLID
+NOGRAVITY
+CLIENTSIDEONLY
height 0
radius 0
States
{
Spawn:
CLOF ABCDEF 1
stop
}
}

actor CloudFXDown
{
scale 2.5
-SOLID
+NOGRAVITY
+CLIENTSIDEONLY
height 0
radius 0
States
{
Spawn:
CLOD ABCDEF 1
stop
}
}

/*
actor Flier : CustomInventory
{
inventory.amount 1
inventory.maxamount 1
inventory.icon "ClouIcon"
scale 2.0
+COUNTITEM
+INVBAR
states
{
Spawn:
ALIE A 1
stop
Use:
TNT1 A 0 A_JumpIfInventory("Noitem",1,"Spawn")
TNT1 A 0 A_JumpIfInventory("RainAmmo",3,"Transform")
goto Spawn
Transform:
TNT1 A 0 A_TakeInventory("Flier",1)
TNT1 A 0 A_GiveInventory("IBeFlyin",1)
TNT1 A 0 A_GiveInventory("Un-Flier",1)
stop
}
}

actor Un-Flier : CustomInventory
{
inventory.amount 1
inventory.maxamount 1
inventory.icon "ClouIcon"
scale 2.0
+COUNTITEM
+INVBAR
states
{
Spawn:
ALIE A 1
stop
Use:
TNT1 A 1 SetPlayerProperty(0, 0, 3)
TNT1 A 0 A_GiveInventory("Flier",1)
TNT1 A 0 A_TakeInventory("IBeFlyin",1)
TNT1 A 0 A_TakeInventory("Un-Flier",1)
stop
}
}
*/

actor FlightItem : CustomInventory
{
inventory.amount 1
inventory.maxamount 1
inventory.icon "ClouIcon"
scale 2.0
+COUNTITEM
+INVBAR
states
{
Spawn:
ALIE A 1
stop
Use:
TNT1 A 0 A_JumpIfInventory("NoItem",1,"Recharging")
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
Recharging:
TNT1 A 0
fail
}
}

actor CloudDowner
{
PROJECTILE
+RIPPER
-SOLID
+SKYEXPLODE
damagetype "Bolt"
scale 2.5
Speed 0
Radius 25
Height 16
Damage (0)
States
{
Spawn:
TNT1 A 1
Loop
Death:
CLOD A 0 A_SpawnItemEx("CloudDowner2")
}
}

actor CloudDowner2
{
PROJECTILE
-RIPPER
damagetype "Bolt"
scale 2.5
Speed 0
Radius 25
Height 16
Damage (17)
States
{
Spawn:
CLOD A 0 ThrustThingZ(0, -45, 0, 1)
CLOD ABCDEF 1 A_SpawnItemEx("CloudFXDown")
loop
Death:
stop
}
}