actor GyroAttackBoss : BaseMM8BDMWep_CBM 
{
dropitem "GyroAttackWepCDropped"
Weapon.AmmoUse 0
Weapon.AmmoGive 56
Weapon.SlotNumber 1
Obituary "$OB_GYROATTACK"
weapon.ammotype "GyroFly"
States
{
Spawn:
C_05 D 1
loop
Ready:
GYAR A 0 ACS_ExecuteAlways(998,0,803)
GYAR A 0 A_GunFlash
goto Ready2
Ready2:
GYAR A 0 A_JumpIfInventory("GyroTrigger2", 1, "Ready3")
GYAR A 0 //A_JumpIfInventory("GyroFly",1,"Ready2HasAmmo")
GYAR A 5 A_WeaponReady//(WRF_NOSECONDARY)
GYAR A 0 A_GiveInventory("GyroFly",1)
Goto Ready2
Ready2HasAmmo:
GYAR A 5 A_WeaponReady
GYAR A 0 A_GiveInventory("GyroFly",1)
Goto Ready2
Ready3:
GYAR A 1 A_WeaponReady
Goto Ready2
Deselect:
GYAR A 0 //SetPlayerProperty(0,0,3)
GYAR A 0 A_TakeInventory("GyroTrigger",999)
GYAR A 0 A_TakeInventory("GyroTrigger2",999)
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
GYAR A 1 A_Lower
goto Deselect+3
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
GYAR A 1 A_Raise
Loop
Fire:
//GYAR A 0 A_JumpIfInventory("GyroTrigger2", 1, "Fire2")
GYAR A 0 A_GiveInventory("GyromanMain_CI",1)
GYAR BCDEF 2
GYAR G 0 A_JumpIfInventory("GyroTrigger2",1,2)
GYAR G 0 A_GiveInventory("GyroFly",1)
GYAR GIHAA 2
GYAR A 0 A_JumpIfInventory("GyroTrigger2",1,2)
GYAR A 0 A_GiveInventory("GyroFly",1)
GYAR A 0 A_Refire
Goto Ready2

Altfire:
GYAR J 0 A_JumpIfInventory("GyroTrigger2",1,"FallCheck")
GYAR J 0 A_JumpIfInventory("FlightDisableFlag",1,2)
GYAR J 1 A_JumpIfInventory("GyroFly",1,"Fly")
GYAR J 0
goto Fall
Fly:
GYAR J 0 A_GiveInventory("GyroTrigger",1)
GYAR J 0 A_GiveInventory("GyroTrigger2",1)
GYAR J 0 A_SpawnItemEx("GyroAmmoHelper")
//GYAR J 1
GYAR J 0 A_ReFire("FlyHold")
Goto Ready3
FlyAgain:
GYAR J 0 A_GiveInventory("GyroTrigger",1)
GYAR J 0 A_ReFire("FlyHold")
Goto Ready3
FlyHold:
GYAR J 1 A_GiveInventory("GyroTriggerX",1)
GYAR J 0 A_ReFire(2)
GYAR J 0 A_TakeInventory("GyroTriggerX",99)
goto Ready3
GYAR J 0 A_JumpIfInventory("GyroTrigger", 1,"FlyHold")
GYAR J 0 A_TakeInventory("GyroTriggerX",99)
goto Ready3
FallCheck:
GYAR J 0 A_JumpIfInventory("GyroTrigger",1,"Fall")
GYAR J 0 A_JumpIfInventory("FlightDisableFlag",1,"Fall")
GYAR J 0 A_JumpIfInventory("GyroFly",1,"FlyAgain")
goto Fall
Fall:
GYAR J 0 SetPlayerProperty(0,0,3)
GYAR J 0 A_TakeInventory("GyroTrigger",999)
GYAR J 0 A_ReFire("FallHold")
goto Ready2
FallHold:
GYAR J 1 A_RailWait
GYAR J 0 A_ReFire("FallHold")
goto Ready2
Flash:
TNT1 A 0 A_JumpIfInventory("GyroTrigger",1,"TimeToFly")
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
TNT1 A 0 SetPlayerProperty(0,0,3)
TNT1 A 1
loop
TimeToFly:
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
TNT1 A 0 A_JumpIfInventory("FlightDisableFlag",1,2)
TNT1 A 0 SetPlayerProperty(0,1,3)
TNT1 A 1
TNT1 A 0 SetPlayerProperty(0,0,3)
TNT1 A 0 A_JumpIfInventory("GyroFly",1,"CheckMyFlag")
TNT1 A 0 A_TakeInventory("GyroTrigger",1)
TNT1 A 0
goto FAmmoDrain
CheckMyFlag:
TNT1 A 0 A_JumpIfInventory("GyroTrigger",1,"TimeToFly")
goto FAmmoDrain
FAmmoDrain:
TNT1 A 1 A_JumpIf(z-floorz==0,"CanFlyAgain")
TNT1 A 0 A_JumpIf(momz==0,"momzverify")
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
TNT1 A 0 A_JumpIfInventory("GyroTrigger",1,"TimeToFly")
TNT1 A 0
loop
momzverify:
TNT1 A 1 A_JumpIf(z-floorz==0, "CanFlyAgain")
TNT1 A 0 A_JumpIf(momz==0,"CanFlyAgain")
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
TNT1 A 0
goto FAmmoDrain
CanFlyAgain:
TNT1 A 0 A_TakeInventory("GyroTrigger",999)
TNT1 A 0 A_TakeInventory("GyroTrigger2",999)
goto Flash
NoFlash:
TNT1 A 0
stop

}
}

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


actor GyroTrigger : OnceC{}
actor GyroTrigger2 : OnceC{}
actor GyroTriggerX : Inventory
{
inventory.amount 1
inventory.maxamount 8
}

actor GyroAmmoHelper : BasicHelper
{
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_JumpIfInTargetInventory("IsDead",1,"Death")
TNT1 A 1
TNT1 A 0 A_JumpIfInTargetInventory("GyroTrigger2",1,"AmmoCheck")
TNT1 A 1
stop
AmmoCheck:
TNT1 A 0 A_JumpIfInTargetInventory("GyroFly",1,"AmmoManage")
TNT1 A 1
stop
FlySound:
TNT1 A 0 A_JumpIfInventory("GyroTriggerX",4,2)
TNT1 A 0 A_GiveInventory("GyroTriggerX",1)
goto AmmoManage+1
TNT1 A 0 A_TakeInventory("GyroTriggerX",9)
TNT1 A 0 A_GiveToTarget("GyroFlySoundPickup",1)
goto AmmoManage+1
AmmoManage:
TNT1 A 0 A_JumpIfInTargetInventory("GyroTrigger",1,"FlySound")
TNT1 A 0 A_JumpIfInTargetInventory("GyroTriggerX",1,"AmmoManage6")
TNT1 A 0 A_JumpIfInTargetInventory("GyroTrigger",1,"AmmoManage4")
goto AmmoManage8
AmmoManage0:
TNT1 A 0 A_GiveInventory("WeaponCharge",1)
goto Spawn
AmmoTake:
TNT1 A 0 A_TakeFromTarget("GyroFly",1)
TNT1 A 0 A_TakeInventory("WeaponCharge",99)
TNT1 A 0 A_JumpIfInTargetInventory("GyroFly",1,"Spawn")
TNT1 A 1
stop

AmmoManage4:
TNT1 A 0 A_JumpIfInventory("WeaponCharge",4,"AmmoTake")
goto AmmoManage0
AmmoManage6:
TNT1 A 0 A_JumpIfInventory("WeaponCharge",6,"AmmoTake")
goto AmmoManage0
AmmoManage8:
TNT1 A 0 A_JumpIfInventory("WeaponCharge",8,"AmmoTake")
goto AmmoManage0

Death:
TNT1 A 1
stop
}
}

actor GyroFlySoundPickup : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("Classes/Hind","Body")
stop
}
}

actor GyroAttackClass
{
Translation "198:198=104:104"
PROJECTILE
Radius 16
Height 8
scale 2.5
damage (15)
speed 40
Obituary "$OB_GYROATTACK"
damagetype "GyroAttack"
States
{
Spawn:
GYCS A 0
GYCS A 0 A_PlaySoundEx("weapon/gyroattack","Auto")
GYCS A 2
GYCS B 2
loop
Death:
GYRO A 0 A_JumpIf(z-floorz==0,"Floor")
GYRO A 0 A_JumpIf(z-ceilingz==0-8, "Ceiling")
stop
Floor:
GYRO A 0 A_SpawnItemEx("GyroAttackClass2",0,0,1,40,0,0,0,1)
//GYRO A 0 A_CustomMissile("GyroAttackClass2",0,0,1,2,0)
stop
Ceiling:
GYRO A 0 A_SpawnItemEx("GyroAttackClass2",0,0,-1,40,0,0,0,1)
//GYRO A 0 A_CustomMissile("GyroAttackClass2",0,0,-1,2,0)
stop
XDeath:
GYRO A 0
stop
}
}

actor GyroAttackClassB : GyroAttackClass{translation "198:198=74:74"}
actor GyroAttackClassR : GyroAttackClass{translation "198:198=41:41"}
actor GyroAttackClassO : GyroAttackClass{translation "198:198=128:128"}
actor GyroAttackClassP : GyroAttackClass{translation "198:198=232:232"}

actor GyroAttackClass2 : GyroAttackClass
{
damage (13)
States
{
Death:
goto XDeath
}
}


actor GyromanMain_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("GyroAttackClass",0,0,8,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("GyroAttackClassB",0,0,8,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("GyroAttackClassR",0,0,8,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("GyroAttackClassO",0,0,8,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("GyroAttackClassP",0,0,8,0)
goto Done
}
}