actor AirMan_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_2B"
dropitem "AirShooterWep"
Weapon.AmmoUse 0
Weapon.AmmoGive 28
Obituary "$OB_AIRSHOOTER"
weapon.ammotype "Can'tDefeatAmmo"
States
{
Spawn:
C_02 B 1
loop

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

Ready:
AIRA A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_AIRMAN)
AIRA A 0 A_GunFlash("Flash",1)
goto Ready2
Ready2:
AIRA A 0 A_JumpIfInventory("Can'tDefeatAmmo",4,"Ready3")
AIRA A 5 A_WeaponReady(8)
AIRA A 0 A_JumpIfInventory("AirTurbineFlag",1,"Ready2")
AIRA A 0 A_GiveInventory("Can'tDefeatAmmo",1)
loop
Ready3:
AIRA A 5 A_WeaponReady
AIRA A 0 A_JumpIfInventory("AirTurbineFlag",1,"Ready3")
AIRA A 0 A_GiveInventory("Can'tDefeatAmmo",1)
loop

Fire:
AIRA A 0 A_JumpIfInventory("IsBot",1,"BotFire")
AIRA A 0 A_GiveInventory("Airman_Fire_P")
AIRA BC 6
AIRA A 7
Goto Ready2
AltFire:
AIRA C 0 A_GiveInventory("VivifyDelay6",1)
AIRA B 0 A_Refire(1)
AIRA B 6 A_GiveInventory("Airman_AltFire_P")
AIRA C 6
AIRA A 7
Goto Ready2

BotFire:
AIRA A 0 A_JumpIfCloser(350,"BotFire2")
AIRA A 0 A_JumpIfInventory("Can'tDefeatAmmo",4,"AltFire")
AIRA A 5
AIRA A 0 A_GiveInventory("Can'tDefeatAmmo",1)
goto AltFire
BotFire2:
TNT1 A 0 A_Jump(192,"BotFire3")
goto BotFire+1
BotFire3:
AIRA A 0
goto Fire+1

Flash:
TNT1 A 1 A_GiveInventory("Airman_Flash_P")
loop
}
}

actor Can'tDefeatAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 28
+INVENTORY.IGNORESKILL
}

actor AirTurbineFlag : Inventory {}

actor AirTurbineDelay : Inventory
{
inventory.amount 1
inventory.maxamount 33
}

actor AirmanItem : BasicClassItem
{
inventory.icon "AIRICON"
inventory.pickupmessage "ARBABRRBAL"
Tag "Toggle Air Shoes"
states
{
Spawn:
AIRA Z 1
loop
UseCBM:
TNT1 A 0 A_JumpIfInventory("AirTurbineFlag",1,"Take")
TNT1 A 0 A_JumpIfInventory("Can'tDefeatAmmo",2,"Use2")
fail
Use2:
TNT1 A 0 A_PlaySoundEx("class/windstart","SoundSlot7")
TNT1 A 0 A_TakeInventory("AirTurbineDelay")
TNT1 A 0 A_GiveInventory("AirTurbineFlag",1)
fail
Take:
TNT1 A 0 A_TakeInventory("AirTurbineFlag")
TNT1 A 0 A_TakeInventory("CBM_200_SpeedPower")
fail
}
}


actor Airman_Fire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/airshooter","Weapon")
TNT1 A 0 A_FireCustomMissile("Airman_AirShot",-18,0,-8,0)//-18
TNT1 A 0 A_FireCustomMissile("Airman_AirShot",18,0,-8,0)//15
TNT1 A 0 A_FireCustomMissile("Airman_AirShot",0,1,-8,0)
stop
}
}


actor Airman_AltFire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/airwall","Body")
TNT1 A 0 A_TakeInventory("Can'tDefeatAmmo",1)
TNT1 A 0 A_TakeInventory("Can'tDefeatAmmo",3,1)
TNT1 A 0 A_SpawnItemEX("Airman_AirWall_H",0,-8,32,0,0,0,0,SXF_TRANSFERPITCH)//512
TNT1 A 0 A_JumpIfInventory("PlayerPropertySpread",1,1)
stop
TNT1 A 0 A_SpawnItemEX("Airman_AirWall_H",0,-8,32,0,0,0,15,512)
TNT1 A 0 A_SpawnItemEX("Airman_AirWall_H",0,-8,32,0,0,0,-15,512)
stop
}
}

actor Airman_Flash_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("AirTurbineFlag",1,"P_Turbine")
stop
P_Turbine:
TNT1 A 0 A_JumpIfInventory("Can'tDefeatAmmo",1,"P_Check")
TNT1 A 0 A_TakeInventory("AirTurbineDelay")
TNT1 A 0 A_TakeInventory("AirTurbineFlag")
TNT1 A 0 A_PlaySoundEx("S3_K/MetalSpark","SoundSlot7")
TNT1 A 0 A_TakeInventory("CBM_200_SpeedPower")
stop
P_Check:
TNT1 A 0 A_JumpIf(CallACS("core_CheckFooting"),"P_Ground")//A_CheckFloor()
TNT1 A 0 A_GiveInventory("Airman_Flash_P2")
TNT1 A 0 A_JumpIfInventory("CBM_200_SpeedPower",1,2)
TNT1 A 0 A_GiveInventory("CBM_200_SpeedPowerGiver",1)
TNT1 A 0 A_JumpIfInventory("AirTurbineDelay",1,3)
TNT1 A 0 A_TakeInventory("Can'tDefeatAmmo",1)
TNT1 A 0 A_GiveInventory("AirTurbineDelay",33)
TNT1 A 0
TNT1 A 0 A_TakeInventory("AirTurbineDelay",3)
stop
P_Ground:
TNT1 A 0 A_TakeInventory("CBM_200_SpeedPower")
TNT1 A 0 A_TakeInventory("AirTurbineDelay",1)
stop
}
}

actor Airman_Flash_P2 : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEX("AirTurbineFX",random(32,64),0,random(8,64),0,0,frandom(0.1,1.1),random(90,270),1)
stop
}
}


actor AirTurbineFX : BasicGraphicEffect
{
+FORCEXYBILLBOARD
Alpha 0.75
Speed 80
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 0 A_Jump(4,"FX10")
TNT1 A 0 A_SetScale(ScaleX-frandom(0,1))
TNT1 A 0 A_Jump(256,"FX1","FX2","FX3","FX4","FX5","FX6","FX7","FX8","FX9")
FX1:
AIRA J 1
AIRA KLMN 2
stop
FX2:
AIRA IJ 1
AIRA KLM 2
AIRA N 3
stop
FX3:
AIRA K 2
AIRA LM 3
AIRA N 2
stop
FX4:
AIRA LM 3
AIRA N 4
stop
FX5:
AIRA IJ random(0,1)
AIRA KLMN random(1,2)
stop
FX6:
AIRA IJ random(1,2)
AIRA KLM random(2,3)
AIRA N random(0,1)
stop
FX7:
AIRA IJKLMN random(1,2)
stop
FX8:
AIRA J 1
AIRA KL random(1,2)
AIRA MN random(2,3)
stop
FX9:
AIRA I 1
AIRA JKLMN 2
stop
FX10:
AIRA IJKLMN random(1,3)
stop
}
}

/*
actor AirWind
{
PROJECTILE
Radius 32
Height 24
scale 2.5
speed 40
States
{
Spawn:
AIWI ABCD 3 A_RadiusThrust (740000, 1, 0)
loop
}
}
*/

actor Airman_AirShot : ProjSpawnFuncActor
{
PROJECTILE
damagetype "AirM_Shot"
Obituary "$OB_AIRSHOOTER"
+NOEXPLODEFLOOR
damage (120)//150
Radius 7//6
Height 8//7
speed 28
scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 ThrustThing(angle*256/360,8,1,0)
TNT1 A 0 A_Jump(256,1,2,3,4,5,6)
AIRS AABBCC 1 ThrustThingZ(0,3-(momz <= 0),0,1)
goto Spawn+3
Death:
AIRS GHIJ 2
stop
}
}

actor Airman_AirWall_H : BasicHelper
{
Args 0
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SetArg(1,Angle*100000.0)
//TNT1 A 0 A_SetArg(1,CallACS("cbm_FetchPointerAngle",2)*360.0/256.0*100000.0)//Record Player Angle
//TNT1 A 0 ACS_NamedExecuteWithResult("cbm_CopyPointerAnglePitch",2,1)//Player Pitch
TNT1 A 0 A_SpawnItemEx("Airman_AirWall",2,0,0,15,0,0,0,1+512+SXF_TRANSFERSPECIAL)//32768
TNT1 A 0 A_SpawnItemEx("Airman_AirWall",2,0,0,15,random(4,8),random(-2,2),0,512+32768)
TNT1 A 0 A_SpawnItemEx("Airman_AirWall",2,0,0,15,random(-8,-4),random(-2,2),0,512+32768)
TNT1 A 0 A_SpawnItemEx("Airman_AirWall",2,0,0,15,random(12,16),random(-3,3),0,512+32768)
TNT1 A 0 A_SpawnItemEx("Airman_AirWall",2,0,0,15,random(-16,-12),random(-3,3),0,512+32768)
TNT1 A 0 A_SpawnItemEx("Airman_AirWall",2,0,0,15,random(20,24),random(-4,4),0,512+32768)
TNT1 A 0 A_SpawnItemEx("Airman_AirWall",2,0,0,15,random(-24,-20),random(-4,4),0,512+32768)
stop
}
}

actor Airman_AirWall : Airman_AirShot
{
damagetype "AirM_Wall"
-NOEXPLODEFLOOR
+BOUNCEONFLOORS
+BOUNCEONWALLS
+BOUNCEONCEILINGS
BounceFactor 0.5
WallBounceFactor 0.5
damage (90)
Radius 8
Height 10
speed 0
States
{
Spawn:
AIRS A 0
AIRS AABBCC 1 A_Recoil(3)
AIRS A 0 A_Stop
AIRS ABC 2
AIRS A 0 A_SpawnItemEx("Airman_AirWall2",0,0,0,cos(-pitch)*22,0,sin(-pitch)*22,Args[1]/100000.0,4)
stop
}
}

actor AirM_WallProtect : PowerProtection
{
Powerup.Duration 4
DamageFactor "AirM_Wall", 0.19
}

actor Airman_AirWall2 : Airman_AirShot
{
damagetype "AirM_Wall"
-NOEXPLODEFLOOR
damage (150)
Radius 8
Height 10
speed 22
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Jump(256,1,2,3,4,5,6)
SpawnL:
AIRS AABBCC 1 A_ScaleVelocity(1.05)
loop
}
}


actor AirMan_W_NormalBar : NormalBar {Args 4,198}
actor AirMan_W_ScriptBar : ScriptBar {}