actor Windman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_6G"
dropitem "WindStormWep"
Weapon.AmmoUse 0
Weapon.AmmoGive 28
Obituary "$OB_WINDQUAKE"
weapon.ammotype "FlyingKickAmmo"
weapon.ammotype2 "YouDontMessWithChinAmmo"
+WEAPON.NOAUTOAIM
States
{
Spawn:
C_06 G 1
loop

Deselect:
WINB A 0 A_TakeInventory("WindInAir")
goto DeselectSwap
Select:
WINB A 0
goto SelectSwap

Ready:
WINB A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_WINDMAN)
WINB A 0 A_GunFlash("Flash",1)
goto Ready1
Ready1:
WINB A 6 A_GiveInventory("Windman_Ready_P")
WINB A 0 A_GiveInventory("YouDontMessWithChinAmmo",2)
WINB A 0 A_GiveInventory("Windman_Ammo2_P")
loop

Fire:
WINB B 6 A_GiveInventory("Windman_Fire_P")
WINB CA 6 A_GiveInventory("Windman_Ammo2_P")
WINB A 0 A_GiveInventory("Windman_Ammo2_P")
goto Ready1

AltFire:
WINB A 0 A_JumpIfInventory("IBeFlyin",1,"AltFire2")
WINB A 0 A_JumpIfInventory("WindInAir",1,"AltFire3")
WINB B 6 A_GiveInventory("Windman_Alt_P")
WINB CA 6 A_GiveInventory("Windman_Ammo2_P")
WINB A 0 A_GiveInventory("Windman_Ammo2_P")
goto Ready1

NoAmmo:
WINB A 0
goto Ready1
AltFire2:
WINB A 1 A_GiveInventory("WindStompFlag",1)
goto Ready1
AltFire3:
WINB A 1 A_RailWait
goto Ready1

Flash:
TNT1 A 1 A_JumpIfInventory("IBeFlyin",1,"Flash.Fly")
loop
Flash.Fly:
TNT1 A 0 A_PlaySoundEx("class/windstart","SoundSlot7")
TNT1 A 0 ACS_NamedExecuteWithResult("core_nogravityplayer",0,2)
Flash.FlyLoop:
TNT1 A 0 A_GiveInventory("WindInAir",1)
TNT1 A 0 A_TakeInventory("FlyingKickAmmo",1)
TNT1 A 0 A_PlaySoundEx("class/windloop","Body")
TNT1 A 0 A_JumpIfInventory("WindStompFlag",1,"Flash.Quake")
TNT1 A 1 A_JumpIfInventory("HatinFlyin",1,"Flash.FlyEnd")
TNT1 A 0 A_JumpIfInventory("WindStompFlag",1,"Flash.Quake")
TNT1 A 1 A_JumpIfInventory("HatinFlyin",1,"Flash.FlyEnd")
TNT1 A 0 A_JumpIfInventory("WindStompFlag",1,"Flash.Quake")
TNT1 A 1 A_JumpIfInventory("HatinFlyin",1,"Flash.FlyEnd")
TNT1 A 0 A_JumpIfInventory("WindStompFlag",1,"Flash.Quake")
TNT1 A 1 A_JumpIfInventory("HatinFlyin",1,"Flash.FlyEnd")
TNT1 A 0 A_JumpIfInventory("WindStompFlag",1,"Flash.Quake")
TNT1 A 1 A_JumpIfInventory("HatinFlyin",1,"Flash.FlyEnd")
TNT1 A 0 A_JumpIfInventory("FlyingKickAmmo",1,"Flash.FlyLoop")
TNT1 A 0 A_TakeInventory("IBeFlyin",1)
goto Flash.FlyEnd
TNT1 A 0 A_GiveInventory("WindInAir",1)
TNT1 A 0 A_TakeInventory("FlyingKickAmmo",1,1)
TNT1 A 0 A_PlaySoundEx("class/windloop","Body")
TNT1 A 0 A_JumpIfInventory("WindStompFlag",1,"Flash.Quake")
TNT1 A 1 A_JumpIfInventory("HatinFlyin",1,"Flash.FlyEnd")
TNT1 A 0 A_JumpIfInventory("WindStompFlag",1,"Flash.Quake")
TNT1 A 1 A_JumpIfInventory("HatinFlyin",1,"Flash.FlyEnd")
TNT1 A 0 A_JumpIfInventory("WindStompFlag",1,"Flash.Quake")
TNT1 A 1 A_JumpIfInventory("HatinFlyin",1,"Flash.FlyEnd")
TNT1 A 0 A_JumpIfInventory("WindStompFlag",1,"Flash.Quake")
TNT1 A 1 A_JumpIfInventory("HatinFlyin",1,"Flash.FlyEnd")
TNT1 A 0 A_JumpIfInventory("WindStompFlag",1,"Flash.Quake")
TNT1 A 1 A_JumpIfInventory("HatinFlyin",1,"Flash.FlyEnd")
TNT1 A 0 A_JumpIfInventory("FlyingKickAmmo",1,"Flash.FlyLoop")
TNT1 A 0 A_TakeInventory("IBeFlyin",1)
goto Flash.FlyEnd
Flash.FlyEnd:
TNT1 A 0 ACS_NamedExecuteWithResult("core_nogravityplayer",0,0)
TNT1 A 0 A_GiveInventory("AirFraudAchieved",1)
Flash.AirFraud:
TNT1 A 1 A_RailWait
TNT1 A 0 A_JumpIfInventory("AirFraudAchieved",1,"Flash.AirFraud")
TNT1 A 0 A_TakeInventory("WindInAir")
goto Flash
Flash.Quake:
TNT1 A 0 ACS_NamedExecuteWithResult("core_nogravityplayer",0,0)
TNT1 A 0 A_GiveInventory("Windman_QuakeStart_P")
Flash.QuakeLoop:
TNT1 A 0 A_GiveInventory("Windman_Quaking_P")
TNT1 A 1 A_JumpIf(z-floorz==0,"Flash.QuakeCrash")
loop
Flash.QuakeCrash:
TNT1 A 1 A_GiveInventory("Windman_FloorQuake_P")
TNT1 AAA 1 A_RailWait//Delay so count_inv can fetch Quaking total
TNT1 A 0 A_TakeInventory("Quaking")
TNT1 A 1 A_TakeInventory("WindInAir")
Goto Flash
}
}

actor WindInAir : OnceC {}

actor WindStompFlag : Powerup
{
Powerup.Duration 3
}

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

actor WindFlightItem : BasicClassItem
{
inventory.icon "WindIcon"
inventory.pickupmessage "At least I can fly compared to Airman."
Tag "Wind Flight Trigger"
states
{
Spawn:
WINB Z 1
loop
UseCBM:
TNT1 A 0 A_JumpIfInventory("IBeFlyin",1,"Use3")
TNT1 A 0 A_JumpIfInventory("FlyingKickAmmo",28,"Use2")
fail
Use2:
TNT1 A 0 A_GiveInventory("IBeFlyin",1)
TNT1 A 0 A_TakeInventory("HatinFlyin")
fail
Use3:
TNT1 A 0 A_GiveInventory("HatinFlyin",1)
TNT1 A 0 A_TakeInventory("IBeFlyin")
fail
}
}

actor Windman_Ready_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("YouDontMessWithChinAmmo",14,4)
TNT1 A 0 A_JumpIfInventory("IBeFlyin",1,2)
TNT1 A 0 A_WeaponReady(WRF_NOSECONDARY)//(WRF_NOFIRE)
goto Ammo
Ready2:
TNT1 A 0 A_WeaponReady//(WRF_NOPRIMARY)
goto Ammo
Ready3:
TNT1 A 0 A_WeaponReady
goto Ammo
}
}

actor Windman_Ammo2_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("WindInAir",1,2)
TNT1 A 0 A_GiveInventory("FlyingKickAmmo",1)
TNT1 A 0
stop
}
}


actor Windman_Fire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySound("weapon/gyroattack",1)
TNT1 A 0 A_FireCustomMissile("WindGyro",0,0,-8,0)
TNT1 A 0 A_FireCustomMissile("WindGyroX",0,0,-8,0)
TNT1 A 0 A_FireCustomMissile("WindGyroX2",0,0,-8,0)
stop
}
}
actor Windman_Alt_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("YouDontMessWithChinAmmo",7)
TNT1 A 0 A_TakeInventory("YouDontMessWithChinAmmo",7,1)
TNT1 A 0 A_PlaySound("weapon/mbuster",1)
TNT1 A 0 A_FireCustomMissile("WindClassStormStart",0,0,24,0)
TNT1 A 0 A_FireCustomMissile("WindClassStormStart",0,0,-40,0)
stop
}
}

actor Windman_Quaking_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_Recoil(-0.5)
TNT1 A 0 ThrustThingZ(0,5,1,1)
TNT1 A 0 A_GiveInventory("Quaking",1+CallACS("core_checkrune",RUNE_RAGE,0))
TNT1 A 0 A_SpawnItemEx("WindQuakeCrush",0,0,-10,0,0,-10)
TNT1 A 0 A_PlaySoundEx("weapon/blizzbowl","Body")
stop
}
}

actor Windman_QuakeStart_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("IBeFlyin",1)
TNT1 A 0 ThrustThingZ(0,5,1,0)
TNT1 A 0 A_SetArg(0,CallACS("cbm_countinv_acs",66,0)/4)//FlyingKickAmmo
TNT1 A 0 A_TakeInventory("FlyingKickAmmo",Args[0]+(Args[0]<1),1)
TNT1 A 0 A_TakeInventory("FlyingKickAmmo",Args[0]+(Args[0]<1))
stop
}
}

actor WindQuakeCrush
{
PROJECTILE
+DONTBLAST
+THRUGHOST
Obituary "$OB_WINDQUAKE"
damagetype "WindM_Crush"
renderstyle none
damage (20+CallACS("core_checkrune",RUNE_SPREAD,2)*40)
Radius 15
Height 2
States
{
Spawn:
TNT1 A 1
stop
}
}

actor WindM_ShotProtect : PowerProtection
{
Powerup.Duration 3
DamageFactor "WindM_Shot", 0.75
}

actor WindGyro : ProjSpawnFuncActor
{
PROJECTILE
damagetype "WindM_Shot"
Obituary "$OB_WINDGYRO"
ReactionTime 2
Damage (110)
Height 16
Radius 16
Speed 26
Scale 2.5
States
{
Spawn:
WINB G 0
WINB GH 2
loop
Spawn2:
WINB ABABABAB 2
WINB GHGHGHGH 2
WINB G 2
WINB H 2 A_CountDown
loop
Death:
TNT1 A 2
Stop
}
}

actor WindGyroX : WindGyro
{
States
{
Spawn:
WINB G 0
WINB GGHH 1 A_Changevelocity(0,2.5,0,CVF_RELATIVE)
Spawn2:
WINB GGHHGG 1
WINB HHGG 1 A_Changevelocity(0,-5,0,CVF_RELATIVE)
WINB HHGGHH 1
WINB GG 1 A_Changevelocity(0,5,0,CVF_RELATIVE)
WINB H 0 A_CountDown
WINB HH 1 A_Changevelocity(0,5,0,CVF_RELATIVE)
loop
}
}

actor WindGyroX2 : WindGyro
{
States
{
Spawn:
WINB G 0
WINB GGHH 1 A_Changevelocity(0,-2.5,0,CVF_RELATIVE)
Spawn2:
WINB GGHHGG 1
WINB HHGG 1 A_Changevelocity(0,5,0,CVF_RELATIVE)
WINB HHGGHH 1
WINB GG 1 A_Changevelocity(0,-5,0,CVF_RELATIVE)
WINB H 0 A_CountDown
WINB HH 1 A_Changevelocity(0,-5,0,CVF_RELATIVE)
loop
}
}


actor WindClassStormStart : ProjSpawnFuncActor
{
PROJECTILE
damagetype "WindM_Pull"
Obituary "$OB_WINDSTORM"
-NOGRAVITY
+RIPPER
+DONTREFLECT
Damage (0)
Radius 16
Height 8
Speed 25
Scale 2.5
States
{
Spawn:
WINB SSTTUUVV 2 A_SpawnItemEx("WindClassBlower2",0,0,14,momx,momy,momz,0,8,0)
loop
Death:
TNT1 A 0 A_JumpIf(z-floorz==0,"Death2")
TNT1 A 1
stop
Death2:
TNT1 A 1 A_SpawnItemEx("WindClassStorm",0,0,0,18)
stop
}
}

actor WindClassStorm : ProjSpawnFuncActor
{
PROJECTILE
damagetype "WindM_Pull"
Obituary "$OB_WINDSTORM"
-NOGRAVITY
+RIPPER
+NOEXPLODEFLOOR
+STEPMISSILE
maxstepheight 15
+BOUNCEONCEILINGS
+DONTREFLECT
BounceCount 1
gravity 3.0
reactiontime 15
Damage (0)
Height 16
Radius 16
speed 25
Scale 2.5
States
{
Spawn:
TNT1 A 0
WINB S 2
SpawnL:
WINB TUVS 4 A_SpawnItemEx("WindClassBlower",0,0,14,momx,momy,momz+2,0,8)
WINB T 0 A_CountDown
loop
Death:
TNT1 A 1 A_SpawnItemEx("WindClassBlower2",0,0,14)
stop
}
}

actor PainWindM_PullHit : Basic_PainFling_H{Args -16,30,0}

actor WindClassBlower : BasicImplosion
{
damagetype "WindM_Pull"
Obituary "$OB_WINDSTORM"
States
{
Spawn:
TNT1 A 0
TNT1 AA 2 A_Explode(80,56,0,0,57)
stop
}
}

actor WindClassBlower2 : WindClassBlower
{
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(80,56,0,0,57)
stop
}
}

actor WindM_PullProtect : PowerProtection
{
Powerup.Duration 10
DamageFactor "WindM_Pull", 0.0
}


actor PainWindM_PushHit : Basic_PainFling_H
{
Args 10,30,0
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SetArg(0,10+CallACS("cbm_countinv_acs_ptr",33,AAPTR_TARGET,AAPTR_TARGET))
goto SpawnCheck
}
}
actor DeathWindM_PushHit : Basic_DeathFling_H
{
Args 15,48,0
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SetArg(0,15+CallACS("cbm_countinv_acs_ptr",33,AAPTR_TARGET,AAPTR_TARGET))
goto Fling
}
}

actor Windman_FloorQuake_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SetArg(4,CallACS("cbm_countinv_acs",33,0))//Record Quaking stack to Args[4]
TNT1 A 0 A_PlaySoundEx("weapon/blizzstrike","Body")

TNT1 A 0 A_JumpIf(Args[4]<8,"Min")
TNT1 A 0 A_JumpIf(Args[4]>=40,"Max")
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_FloorQuakeDamage",200+50*(Args[4]/8),Args[4]/8,66)
TNT1 A 0 A_SpawnItemEx("Windman_FloorQuakeFX_H",0,0,0,0,0,Args[4]/80.0,0,1)
stop
Min:
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_FloorQuakeDamage",200,2,66)
TNT1 A 0 A_SpawnItemEx("Windman_FloorQuakeFX_H",0,0,0,0,0,10/80.0,0,1)
stop
Max:
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_FloorQuakeDamage",450,7,66)
TNT1 A 0 A_SpawnItemEx("Windman_FloorQuakeFX_H",0,0,0,0,0,70/80.0,0,1)
stop
}
}

actor Windman_FloorQuakeSpawn : Basic_FloorQuakeSpawn
{
Obituary "$OB_WINDQUAKE"
damagetype "WindM_Push"
States
{
Quake:
TNT1 A 4 A_SpawnItemEx("Windman_FloorQuakeBoom",0,0,28,0,0,0,0,1+SXF_TRANSFERSPECIAL)//32768
stop
}
}

actor Windman_FloorQuakeBoom : Basic_FloorQuakeBoom
{
Obituary "$OB_WINDQUAKE"
damagetype "WindM_Push"
MeleeRange 30
Accuracy 10
}

actor Windman_FloorQuakeFX_H : Basic_FloorQuakeFX_H
{
var int user_TranslateWhiteColors;
//ActiveSound "misc_L/hugequake2"
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SetArg(4,momz*100.0+0.5)
//TNT1 A 0 Radius_Quake(2,10,0,1+Args[4]/10,0)
//TNT1 A 0 A_ActiveSound
TNT1 A 10 A_SpawnItemEx("Windman_FloorQuakeFX",0,0,-momz,0,0,0,0,1+SXF_TRANSFERSPECIAL)
stop
}
}


actor Windman_FloorQuakeFX : Basic_FloorQuakeFX
{
Accuracy 100
Mass 50
MeleeRange 4
}



actor Windman_W_NormalBar : NormalBar {Args 4,108}
actor Windman_W_SecondBar : SecondBar {Args 4,94}//93