actor Topman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_3E"
dropitem "TopTwistWep"
Weapon.AmmoUse 0
Obituary "$OB_TOPSPIN"
weapon.ammotype "DiscoTopAmmo"
+WEAPON.NOAUTOAIM
States
{
Spawn:
C_03 E 1
loop

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

Ready:
XTOP A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_TOPMAN)
XTOP A 0 A_TakeInventory("DiscoTopAmmo")
XTOP A 0 A_TakeInventory("SpinTime",1)
XTOP A 1 A_WeaponReady
wait

AltFire:
XTOP F 0 A_GiveInventory("Topman_Alt_P")
XTOP E 2 Offset(-1,32)
XTOP E 2 Offset(-70,72)
XTOP E 2 Offset(-121,112)
XTOP F 2 Offset(1,32)
XTOP F 2 Offset(-21,56)
XTOP F 2 Offset(-33,84)
XTOP B 2 Offset(-4,69)
XTOP B 2 A_WeaponReady(14)
XTOP A 10
Goto Ready+1
BotFire:
XTOP A 0 A_Jump(128,"AltFire")
XTOP A 0 A_GiveInventory("DiscoTopAmmo",70)
goto Fire+1
Fire:
XTOP A 0 A_JumpIfInventory("IsBot",1,"BotFire")
XTOP A 0 A_JumpIfInventory("SpinTime",1,"SpinEnd")
//XTOP A 0 A_JumpIfInventory("IsBot",1,"BotFire")
XTOP A 0 A_GiveInventory("VivifyCycle1",1)
XTOP C 1 A_GiveInventory("TopmanWindUpSlow1",1)
//XTOP C 1 A_JumpIf(momz==0, "NoAmmo")
//XTOP C 0

XTOP C 0 A_GunFlash("Flash.Charge",1)
Goto FireCharge//Spin


Flash.Charge:
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",35,2)
TNT1 A 1 A_GiveInventory("Topman_Flash_P")
loop
TNT1 A 0 A_TakeInventory("TopmanWindUpSlow1")
TNT1 A 0 A_GiveInventory("TopmanWindUpSlow2",1)
Flash.Charge2:
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",70,2)
TNT1 A 1 A_GiveInventory("Topman_Flash_P")
loop
TNT1 A 0 A_TakeInventory("TopmanWindUpSlow2")
TNT1 A 0 A_GiveInventory("TopmanWindUpSlow3",1)
Flash.Charge3:
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",105,2)
TNT1 A 1 A_GiveInventory("Topman_Flash_P")
loop
TNT1 A 0 A_TakeInventory("TopmanWindUpSlow3")
TNT1 A 0 A_GiveInventory("TopmanWindUpSlow4",1)
Flash.Charge4:
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",140,2)
TNT1 A 1 A_GiveInventory("Topman_Flash_P")
loop
TNT1 A 0 A_TakeInventory("TopmanWindUpSlow4")
TNT1 A 0 A_GiveInventory("TopmanWindUpSlow5",1)
Flash.Charge5:
TNT1 A 1 A_GiveInventory("Topman_Flash_P")
loop

BotFireCharge:
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",140,2)
XTOP "#" 0 A_Jump(32,"Spin")
goto FireCharge+1
XTOP "#" 0 A_Jump(96,"Spin")
goto FireCharge+1
FireCharge:
XTOP "#" 0 A_JumpIfInventory("IsBot",1,"BotFireCharge")
XTOP "#" 1 OffSet(-5,32)
XTOP "#" 0 A_ReFire(1)
goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",140,16)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",80,12)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,8)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-15,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0
XTOP "#" 1 OffSet(-25,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-35,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,6)
XTOP "#" 1 OffSet(-45,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-55,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",80,7)
XTOP "#" 1 OffSet(-65,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,8)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-75,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",140,7)
XTOP "#" 1 OffSet(-85,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-95,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,6)
XTOP "#" 1 OffSet(-105,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-115,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",140,12)
XTOP "#" 1 OffSet(-125,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",80,12)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,8)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-135,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0
XTOP "#" 1 OffSet(-145,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-155,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,6)
XTOP "#" 1 OffSet(-165,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-175,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",80,8)
XTOP "#" 1 OffSet(-185,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,8)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-195,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0
XTOP "#" 1 OffSet(-205,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-215,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,6)
XTOP "#" 1 OffSet(-225,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-235,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",140,6)
XTOP "#" 1 OffSet(-245,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",80,12)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,8)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-255,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",140,13)
XTOP "#" 1 OffSet(-265,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-275,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,6)
XTOP "#" 1 OffSet(-285,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-295,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",80,9)
XTOP "#" 1 OffSet(-305,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",140,17)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,8)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-315,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0
XTOP "#" 1 OffSet(-325,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-335,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,9)
XTOP "#" 1 OffSet(-345,32)
XTOP "#" 0 A_ReFire(1)goto Spin

//XTOP C 1 OffSet(-352,32)

XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(-400,32)
XTOP "#" 0 A_ReFire(1)
goto Spin
XTOP "#" 0
XTOP "#" 1 OffSet(-400,32)
XTOP "#" 0 A_ReFire(1)
goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",80,6)
XTOP "#" 1 OffSet(-400,32)
XTOP "#" 0 A_ReFire(1)
goto Spin
XTOP "#" 0
XTOP "#" 1 OffSet(-400,32)
XTOP "#" 0 A_ReFire(1)
goto Spin
XTOP "#" 1 OffSet(-400,32)
XTOP "#" 0 A_JumpIfInventory("TopmanSpinSwap",1,2)
XTOP "#" 0 A_ReFire(3)
goto Spin
XTOP C 1 OffSet(-400,32)A_TakeInventory("TopmanSpinSwap",1)
XTOP C 0 A_ReFire(3)
goto Spin
XTOP D 1 OffSet(-400,32)A_GiveInventory("TopmanSpinSwap",1)
XTOP D 0 A_ReFire(1)
goto Spin
//XTOP C 1 OffSet(160,32)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",140,6)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",80,2)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,4)
XTOP "#" 1 OffSet(155,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(145,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,6)
XTOP "#" 1 OffSet(135,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(125,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",140,9)
XTOP "#" 1 OffSet(115,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",80,12)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,8)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(105,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0
XTOP "#" 1 OffSet(95,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(85,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,6)
XTOP "#" 1 OffSet(75,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(65,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",140,6)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",80,8)
XTOP "#" 1 OffSet(55,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,8)
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(45,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",140,"FireCharge")
XTOP "#" 1 OffSet(35,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,3)
XTOP "#" 1 OffSet(25,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",48,"FireCharge")
XTOP "#" 1 OffSet(15,32)
XTOP "#" 0 A_ReFire(1)goto Spin
XTOP "#" 0 A_JumpIfInventory("DiscoTopAmmo",20,"FireCharge")
XTOP "#" 1 OffSet(5,32)
XTOP "#" 0 A_ReFire("FireCharge")goto Spin

Spin:
XTOP B 0 A_GunFlash("NoFlash",1)
XTOP B 0 A_GiveInventory("TopmanTimer2",21)
XTOP B 0 A_PlaySoundEx("weapon/topspin","Weapon")

XTOP B 0 //A_Recoil(-60)
XTOP B 0 //A_ChangeVelocity(75,0,momz,3)
XTOP B 0 //A_GiveInventory("SpinTime",1)
XTOP B 0 A_WeaponReady(14)//Reset Offsets

XTOP B 0 ACS_NamedExecuteWithResult("core_unsolidplayer",0,USP_TOGGLEON)

XTOP B 0 A_GiveInventory("Top_ChargeBoostPickup",1)

XTOP A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
XTOP AA 1 OffSet(-26,39)A_GiveInventory("TopManRadius11_P",1)
XTOP C 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
XTOP CC 1 OffSet(-75,57)A_GiveInventory("TopManRadius11_P",1)
XTOP C 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
XTOP CC 1 OffSet(-6,45)A_GiveInventory("TopManRadius11_P",1)
XTOP C 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
XTOP CC 1 OffSet(63,49)A_GiveInventory("TopManRadius11_P",1)
goto SpinLoop

SpinLoop:
XTOP C 1 OffSet(63,49)A_GiveInventory("TopManRadius_P",1)
XTOP C 0 A_JumpIfInventory("TopmanTimer",1,"SpinLoop")
goto SpinLoopD1
SpinLoopD1:
TNT1 A 0 A_GiveInventory("TopmanDodgeCheck_P")
goto SpinLoopD2
SpinLoopD2:
TNT1 A 1 A_TakeInventory("TopmanTimer2",1+CallACS("core_checkrune",RUNE_RAGE))
TNT1 A 0 A_JumpIfInventory("TopmanTimer2",1,"SpinLoopD2")
goto SpinEnd

SpinEnd:
TNT1 A 0 ACS_NamedExecuteWithResult("core_unsolidplayer",0,USP_TOGGLEOFF_DAMAGE,CallACS("core_getmaxhealth")/10)
TNT1 A 0 A_GiveInventory("VivifyDelay10",1)
TNT1 A 0 A_TakeInventory("VivifyCycle1")
TNT1 A 0 A_GiveInventory("TopmanFullReset_P")
goto DelayOffset

DelayOffset:
XTOP A 3 offset(14,112)
XTOP A 3 offset(9,92)
XTOP A 3 offset(5,72)
XTOP A 3 offset(2,52)A_TakeInventory("VivifyDelay10")
Goto Ready+1
}
}

actor DiscoTopAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 140
+INVENTORY.IGNORESKILL
}

actor TopmanWindUpSlow : PowerSpeed
{
powerup.duration -4
Speed 0.5
+POWERSPEED.NOTRAIL
+INVENTORY.ALWAYSPICKUP
}
//Stacking powerup speeds
//0.92//0.9131//0.90471//0.89474//0.88236
actor TopmanWindUpSlow1 : TopmanWindUpSlow
{
powerup.duration -2
Speed 0.92
}
actor TopmanWindUpSlow2 : TopmanWindUpSlow{Speed 0.85}
actor TopmanWindUpSlow3 : TopmanWindUpSlow{Speed 0.77}
actor TopmanWindUpSlow4 : TopmanWindUpSlow{Speed 0.68}
actor TopmanWindUpSlow5 : TopmanWindUpSlow
{
powerup.duration 0x7FFFFFFC
Speed 0.60
}

actor TopmanSpinSwap : Inventory {}

actor TopmanIsDodgy_F : Powerup
{
Powerup.Duration -2
}

actor Top_ChargeD6 : Powerup{Powerup.Duration 6}
actor Top_ChargeD5 : Powerup{Powerup.Duration 5}
actor Top_ChargeD4 : Powerup{Powerup.Duration 4}
actor Top_ChargeD3 : Powerup{Powerup.Duration 3}
actor Top_ChargeD2 : Powerup{Powerup.Duration 2}

actor Top_ChargeS6 : Top_ChargeD6{}
actor Top_ChargeS5 : Top_ChargeD5{}
actor Top_ChargeS4 : Top_ChargeD4{}
actor Top_ChargeS3 : Top_ChargeD3{}
actor Top_ChargeS2 : Top_ChargeD2{}
actor Top_ChargeS1 : Powerup
{
Powerup.Duration 1
}

actor TopmanTimer : Inventory
{
inventory.amount 1
inventory.maxamount 99
}
actor TopmanTimer2 : TopmanTimer{}

actor TopmanFullReset_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("DiscoTopAmmo")
TNT1 A 0 A_TakeInventory("TopmanTimer")
TNT1 A 0 A_TakeInventory("TopmanTimer2")
TNT1 A 0 A_TakeInventory("TopmanWindUpSlow")
TNT1 A 0 A_TakeInventory("TopmanWindUpSlow1")
TNT1 A 0 A_TakeInventory("TopmanWindUpSlow2")
TNT1 A 0 A_TakeInventory("TopmanWindUpSlow3")
TNT1 A 0 A_TakeInventory("TopmanWindUpSlow4")
TNT1 A 0 A_TakeInventory("TopmanWindUpSlow5")
stop
}
}
actor Topman_Alt_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/topmanshot","weapon")
TNT1 A 0 A_FireCustomMissile("SpinTop",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("SpinTop",15,0,8,0)
TNT1 A 0 A_FireCustomMissile("SpinTop",-15,0,8,0)
stop
}
}

actor Topman_Flash_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("Top_ChargePickupFlag",1)
TNT1 A 0 A_JumpIfInventory("Top_ChargeD6",1,"P_End")
TNT1 A 0 A_JumpIfInventory("Top_ChargeD5",1,"P_End")
TNT1 A 0 A_JumpIfInventory("Top_ChargeD4",1,"P_End")
TNT1 A 0 A_JumpIfInventory("Top_ChargeD3",1,"P_End")
TNT1 A 0 A_JumpIfInventory("Top_ChargeD2",1,"P_End")
goto P_DCheck
P_DCheck:
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",140,"P_D4")
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",105,"P_D3")
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",70,"P_D2")
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",35,"P_D1")
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,3)
TNT1 A 0 A_GiveInventory("Top_ChargeD6")
goto P_Dam2
P_D1:
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,3)
TNT1 A 0 A_GiveInventory("Top_ChargeD5")
goto P_Dam2
P_D2:
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,3)
TNT1 A 0 A_GiveInventory("Top_ChargeD4")
goto P_Dam2
P_D3:
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,3)
TNT1 A 0 A_GiveInventory("Top_ChargeD3")
goto P_Dam2
P_D4:
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
TNT1 A 0 A_GiveInventory("Top_ChargeD3")
goto P_Dam3
P_D5:
TNT1 A 0 A_GiveInventory("Top_ChargeD2")
goto P_Dam3

P_Dam2:
TNT1 A 0 A_SpawnItemEx("TopManChargeSpin2",0,0,28,momx,momy,momz,0,2+8)
goto P_End
P_Dam3:
TNT1 A 0 A_SpawnItemEx("TopManChargeSpin3",0,0,28,momx,momy,momz,0,2+8)
goto P_End

P_End:
TNT1 A 0 A_GiveInventory("Top_ChargePickupSnd",1)
TNT1 A 0 A_GiveInventory("DiscoTopAmmo",1+CallACS("core_checkrune",RUNE_RAGE))
stop
}
}


actor Top_ChargePickupFlag : CustomInventory
{
States
{
Pickup:
TNT1 A 0 //A_JumpIfInventory("DiscoTopAmmo",140,"P_Flag")
TNT1 A 0 A_JumpIfInventory("Top_ChargeS6",1,"No")
TNT1 A 0 A_JumpIfInventory("Top_ChargeS5",1,"No")
TNT1 A 0 A_JumpIfInventory("Top_ChargeS4",1,"No")
TNT1 A 0 A_JumpIfInventory("Top_ChargeS3",1,"No")
TNT1 A 0 A_JumpIfInventory("Top_ChargeS2",1,"No")
goto P_Flag
P_Flag:
TNT1 A 0 A_GiveInventory("VivifyCycle1",1)
stop
No:
TNT1 A 0
stop
}
}

actor Top_ChargePickupSnd : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("Top_ChargeS6",1,"No")
TNT1 A 0 A_JumpIfInventory("Top_ChargeS5",1,"No")
TNT1 A 0 A_JumpIfInventory("Top_ChargeS4",1,"No")
TNT1 A 0 A_JumpIfInventory("Top_ChargeS3",1,"No")
TNT1 A 0 A_JumpIfInventory("Top_ChargeS2",1,"No")
TNT1 A 0 A_JumpIfInventory("Top_ChargeS1",1,"No")
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",140,"P_S4")
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",84,"P_S3")//105
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",42,"P_S2")//70
TNT1 A 0 //A_JumpIfInventory("DiscoTopAmmo",35,"P_S1")
goto P_S1//0
P_S0:
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,3)
TNT1 A 0 A_GiveInventory("Top_ChargeS6",1)
goto P_Snd
P_S1:
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,3)
TNT1 A 0 A_GiveInventory("Top_ChargeS5",1)
goto P_Snd
P_S2:
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,3)
TNT1 A 0 A_GiveInventory("Top_ChargeS4",1)
goto P_Snd
P_S3:
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,3)
TNT1 A 0 A_GiveInventory("Top_ChargeS3",1)
goto P_Snd
P_S4:
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
TNT1 A 0 A_GiveInventory("Top_ChargeS2",1)
goto P_Snd
P_S5:
TNT1 A 0 A_GiveInventory("Top_ChargeS1",1)
goto P_Snd
P_Snd:
TNT1 A 0 A_PlaySoundEx("weapon/BRGSpin","Weapon")
stop
No:
TNT1 A 0
stop
}
}

actor Top_ChargeBoostPickup : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("TopmanWindUpSlow",1)
TNT1 A 0 A_TakeInventory("TopmanWindUpSlow1")
TNT1 A 0 A_TakeInventory("TopmanWindUpSlow2")
TNT1 A 0 A_TakeInventory("TopmanWindUpSlow3")
TNT1 A 0 A_TakeInventory("TopmanWindUpSlow4")
TNT1 A 0 A_TakeInventory("TopmanWindUpSlow5")

TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",140,"Spin140")
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",122,"Spin122")
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",105,"Spin105")
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",87,"Spin87")
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",70,"Spin70")
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",52,"Spin52")
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",35,"Spin35")
TNT1 A 0 A_JumpIfInventory("DiscoTopAmmo",17,"Spin17")
goto Spin0
Spin0:
TNT1 A 0 A_ChangeVelocity(15,0,-2.5,1)
TNT1 A 0 A_GiveInventory("TopmanTimer",1)
stop
Spin17:
TNT1 A 0 A_ChangeVelocity(30,0,-2.5,1)
TNT1 A 0 A_GiveInventory("TopmanTimer",4)
stop
Spin35:
TNT1 A 0 A_ChangeVelocity(45,0,-2.5,1)
TNT1 A 0 A_GiveInventory("TopmanTimer",5)
stop
Spin52:
TNT1 A 0 A_ChangeVelocity(50,0,-2.5,1)
TNT1 A 0 A_GiveInventory("TopmanTimer",6)
stop
Spin70:
TNT1 A 0 A_ChangeVelocity(55,0,momz-2.5,3)
TNT1 A 0 A_GiveInventory("TopmanTimer",7)
stop
Spin87:
TNT1 A 0 A_ChangeVelocity(60,0,momz-2.5,3)
TNT1 A 0 A_GiveInventory("TopmanTimer",8)
stop
Spin105:
TNT1 A 0 A_ChangeVelocity(65,0,momz-2.5,3)
TNT1 A 0 A_GiveInventory("TopmanTimer",9)
goto SpinP
Spin122:
TNT1 A 0 A_ChangeVelocity(70,0,momz-2.5,3)
TNT1 A 0 A_GiveInventory("TopmanTimer",10)
goto SpinP
Spin140:
TNT1 A 0 A_ChangeVelocity(75,0,momz-2.5,3)
TNT1 A 0 A_GiveInventory("TopmanTimer",12)
goto SpinP
SpinP:
TNT1 A 0 A_GiveInventory("TopmanIsDodgy_F",1)
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_noradiusdmgplayer",0,1)
TNT1 A 0 ACS_NamedExecuteWithResult("core_nonshootableplayer",0,1)
stop
}
}

actor TopmanDodgeCheck_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("TopmanIsDodgy_F",1,1)
stop
TNT1 A 0 A_TakeInventory("TopmanIsDodgy_F")
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_noradiusdmgplayer",0,0)
TNT1 A 0 ACS_NamedExecuteWithResult("core_nonshootableplayer",0,0)
stop
}
}

actor Spintop : ProjSpawnFuncActor
{
PROJECTILE
Damagetype "TopM_Toss"
Obituary "$OB_TOPTHROW"
damage (100)
Radius 10
Height 10
speed 35
scale 2.5
States
{
Spawn:
XTOP TUV 3
loop
}
}



actor TopManRadius_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("Topman_TwistyFX",random(-4,4),random(-4,4),28,momx,momy,momz,0,1+2+8)
TNT1 A 0 A_TakeInventory("TopmanTimer",1+CallACS("core_checkrune",RUNE_RAGE))
TNT1 A 0 A_TakeInventory("TopmanTimer2",1+CallACS("core_checkrune",RUNE_RAGE))
TNT1 A 0 A_SpawnItemEx("TopManRadius",0,0,28,momx,momy,momz,0,2+8)
stop
}
}

actor Topman_TwistyFX : BasicGraphicEffect
{
Scale 3.0
States
{
SpawnFrame:
XTOP W 2
stop
}
}
actor Topman_TwistyFX2 : Topman_TwistyFX
{
Scale 2.5
}

actor TopManRadius : BasicImplosion
{
Obituary "$OB_TOPSPIN"
damagetype "TopM_Spin2"
States
{
Spawn:
TNT1 A 0
TNT1 A 2 A_Explode((CallACS("cbm_getplayervelocity",30,0)*2.675+10)*(CallACS("core_checkrune",RUNE_SPREAD,2)*2+1)*(CallACS("core_checkrune",RUNE_RAGE,2)*1+1),96,0,0,24)
stop
}
}

actor TopManRadius11_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("Topman_TwistyFX2",random(-4,4),random(-4,4),28,momx,momy,momz,0,1+2+8)
TNT1 A 0 A_SpawnItemEx("TopManRadius11",0,0,28,momx,momy,momz,0,2+8)
stop
}
}

actor TopManRadius11 : TopManRadius
{
damagetype "TopM_Spin"
States
{
Spawn:
TNT1 A 0
TNT1 A 2 A_Explode((CallACS("cbm_getplayervelocity",30,0)*2.675+20)*(CallACS("core_checkrune",RUNE_SPREAD,2)*2+1)*(CallACS("core_checkrune",RUNE_RAGE,2)*1+1),96,0,0,24)
stop
}
}

actor TopM_SpinProtect : PowerProtection
{
Powerup.Duration 12
DamageFactor "TopM_Spin", 0.6
}

actor TopManChargeSpin2 : BasicImplosion
{
Obituary "$OB_TOPSPIN"
damagetype "TopM_Windup"
States
{
Spawn:
TNT1 A 0
TNT1 A 2 A_Explode(20+CallACS("core_checkrune",RUNE_SPREAD,2)*40,88,0,0,32)
stop
}
}
actor TopManChargeSpin3 : TopManChargeSpin2
{
States
{
Spawn:
TNT1 A 0
TNT1 A 2 A_Explode(30+CallACS("core_checkrune",RUNE_SPREAD,2)*60,88,0,0,32)
stop
}
}


//actor Topman_W_NormalBar : NormalBar {Args 52,93}
actor Topman_W_ScriptBar : ScriptBar {}