//Mobility recoded
actor ChargeKickWep_NormalBar : NormalBar { args 4, 225 }

actor ChargeKickWep : BaseMM8BDMWep 10055
{
//$Category MM8BDM-Weapons/Close
//$Title Charge Kick
//$Sprite WEA2E0
Weapon.AmmoUse 2
Weapon.AmmoGive 28
Weapon.SlotNumber 4
Inventory.Pickupmessage "$PU_CHARGEKICK"
Obituary "$OB_CHARGEKICK"
Tag "$TAG_CHARGEKICK"
weapon.ammotype "ChargeKickAmmo"
inventory.icon "CHARSI"
States
{
SpawnLoop:
WEA2 E -1
loop

Ready:
TNT1 A 0 ACS_NamedExecuteWithResult("core_weaponcolor",CLR_CHARGEKICK)
TNT1 A 0 A_JumpIfInventory("IsMegaMan",1,"ReadyMega")
TNT1 A 0 A_JumpIfInventory("IsProtoMan",1,"ReadyProto")
TNT1 A 0 A_JumpIfInventory("IsBass",1,"ReadyBass")
TNT1 A 0 A_JumpIfInventory("IsDuo",1,"ReadyDuo")
TNT1 A 1
Goto Ready+1

ReadyMega:
38ME A 0 A_JumpIfInventory("UltAttackFlag",1,"UltimateAttackCheck")
38ME A 1 A_WeaponReady
Goto ReadyMega
ReadyProto:
38PR A 0 A_JumpIfInventory("UltAttackFlag",1,"UltimateAttackCheck")
38PR A 1 A_WeaponReady
Goto ReadyProto
ReadyBass:
38BA A 0 A_JumpIfInventory("UltAttackFlag",1,"UltimateAttackCheck")
38BA A 1 A_WeaponReady
Goto ReadyBass
ReadyDuo:
38DU A 0 A_JumpIfInventory("UltAttackFlag",1,"UltimateAttackCheck")
38DU A 1 A_WeaponReady
Goto ReadyDuo

Deselect:
"####" A 0
Goto DeselectSwap
Select:
"####" A 0
Goto SelectSwap

Fire:
"####" A 0 A_JumpIfNoAmmo("NoAmmo")
"####" A 0 A_JumpIfInventory("PowerGearPowerup",1,"GearCheck")
Fire.Resume:
"####" A 0 A_PlaySoundEx("weapons/mm5/chargekickfire","Weapon")
"####" A 0 ACS_NamedExecute("VC_SetState",0,36)
"####" A 0 A_JumpIfInventory("IsDuo",1,"Fire.Duo")
"####" A 0 ACS_NamedExecuteWithResult("core_stopplayer", 0, true)
"####" A 0 A_SpawnItemEx("PropBlowerEffect")
"####" B 2 A_Recoil(CallACS("VC_XYMob",-20))
"####" C 2 A_GiveInventory("ChargeKickClassPickUp",1)
"####" D 8 ACS_NamedExecuteWithResult("core_stopplayer", 0, false)
"####" C 5
"####" B 5
"####" A 0 A_Refire
Goto Ready+1

Fire.Duo:
"####" A 0 ACS_NamedExecuteWithResult("core_stopplayer", 0, true)
"####" D 1 Offset(-120,39)A_Recoil(CallACS("VC_XYMob",-20))
"####" D 1 Offset(-60,35)
"####" D 1 Offset(20,33)A_GiveInventory("ChargeKickClassPickUp",1)
"####" D 1 Offset(22,35)
"####" D 1 Offset(24,36)ACS_NamedExecuteWithResult("core_stopplayer", 0, false)
"####" D 1 Offset(26,37)
"####" D 1 Offset(26,38)
"####" D 1 Offset(26,39)
"####" D 1 Offset(26,40)
"####" D 1 Offset(26,41)
"####" D 1 Offset(26,42)
"####" D 1 Offset(24,43)
"####" D 1 Offset(22,44)
"####" D 1 Offset(20,45)
"####" D 1 Offset(15,46)
"####" D 1 Offset(10,47)
"####" E 1 Offset(-15,49)
"####" E 1 Offset(-39,51)
"####" E 1 Offset(-78,53)
"####" Z 1 Offset(-78,200)
"####" Z 1 Offset(-78,200)
"####" A 1 Offset(78,98)ACS_NamedExecute("VC_SetState",0,0)
"####" A 1 Offset(39,62)SetPlayerProperty(0,0,4)
"####" A 1 Offset(15,41)
"####" A 2
"####" A 0 A_Refire
Goto Ready+1

GearCheck:
"####" A 0 A_JumpIfInventory("ChargeKickAmmo",5,"Fire.Gear")
Goto Fire.Resume

Fire.Gear:
"####" A 0 A_GiveInventory("GearChargeKickFlag",1)
"####" A 0 A_PlaySoundEx("weapon/chargekick","Weapon")
"####" A 0 A_SpawnItemEx("GearChargeKickDust",-16)
"####" A 0 A_SpawnItemEx("ChargeKick2")
"####" A 0 A_GunFlash("GearKicking")
"####" BC 2
KickingCont:
"####" A 0 A_JumpIfInventory("PowerGearPowerup",1,1)
Goto ChargeFinish
"####" A 0 A_JumpIfInventory("ChargeKickAmmo",1,1)
Goto ChargeFinish
"####" D 2
"####" D 1 A_JumpIf(ACS_NamedExecuteWithResult("VC_CheckBtn",4)==3,"KickingCont")
"####" D 1
ChargeFinish:
"####" A 0 A_SpawnItemEx("ReSolidifier")
"####" A 0 A_TakeInventory("GearChargeKickFlag",1)
"####" CB 4
Goto Ready+1

NoAmmo:
"####" A 1 ACS_NamedExecuteAlways("core_noammo",0)
Goto Ready+1

GearKicking:
SLSA B 0 A_ChangeFlag("SOLID",False)
SLSA B 0 A_TakeInventory("UnSolid",1)
TNT1 A 0 A_TakeInventory("ChargeKickAmmo",6)
TNT1 A 0 ACS_NamedExecute("VC_SetState",0,36)
TNT1 A 0 A_ChangeVelocity(32,0,momz,CVF_RELATIVE|CVF_REPLACE)
TNT1 A 0 A_JumpIfInventory("PowerGearPowerup",1,1) Goto End TNT1 A 0 A_JumpIfInventory("ChargeKickAmmo",1,1) Goto End TNT1 A 0 A_JumpIfInventory("GearChargeKickFlag",1,1) Goto End
TNT1 A 1
TNT1 A 0 A_JumpIfInventory("PowerGearPowerup",1,1) Goto End TNT1 A 0 A_JumpIfInventory("ChargeKickAmmo",1,1) Goto End TNT1 A 0 A_JumpIfInventory("GearChargeKickFlag",1,1) Goto End
TNT1 A 1
TNT1 A 0 A_JumpIfInventory("PowerGearPowerup",1,1) Goto End TNT1 A 0 A_JumpIfInventory("ChargeKickAmmo",1,1) Goto End TNT1 A 0 A_JumpIfInventory("GearChargeKickFlag",1,1) Goto End
TNT1 A 1
TNT1 A 0 A_JumpIfInventory("PowerGearPowerup",1,1) Goto End TNT1 A 0 A_JumpIfInventory("ChargeKickAmmo",1,1) Goto End TNT1 A 0 A_JumpIfInventory("GearChargeKickFlag",1,1) Goto End
TNT1 A 1
TNT1 A 0 A_JumpIfInventory("PowerGearPowerup",1,1) Goto End TNT1 A 0 A_JumpIfInventory("ChargeKickAmmo",1,1) Goto End TNT1 A 0 A_JumpIfInventory("GearChargeKickFlag",1,1) Goto End
TNT1 A 1
TNT1 A 0 A_TakeInventory("ChargeKickAmmo",1)
Goto GearKicking+3
End:
TNT1 A 0
stop
}
}

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

actor ChargeKickClassPickUp : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("IsBass",1,"Pickup2")
TNT1 A 0 A_JumpIfInventory("IsDuo",1,"Pickup3")
TNT1 A 0 A_FireCustomMissile("ChargeKick",0,1,0,0)
stop
Pickup2:
TNT1 A 0 A_FireCustomMissile("ChargeKickB",0,1,0,0)
stop
Pickup3:
TNT1 A 0 A_FireCustomMissile("ChargeKickC",0,1,0,0)
stop
}
}

actor ChargeKick : BasicProjectile
{
Radius 14
Height 25
damage (25)
damagetype "ChargeKick"
Obituary "$OB_CHARGEKICK"
speed 40
States
{
Spawn:
CKIC D 0
CKIC DEF 2
stop
Death:
CKIC C 0 A_SpawnItemEx("PropBlowerEffect")
stop
}
}
actor ChargeKickB : ChargeKick {Obituary "%o was knocked around by %k's charge Dash."}
actor ChargeKickC : ChargeKick {Obituary "%o was knocked around by %k's charge Tackle."}

actor ChargeKick2 : BasicExplosion
{
damagetype "ChargeKickGear"
Obituary "$OB_CHARGEKICK"
+FORCEXYBILLBOARD
+BRIGHT
+NOTIMEFREEZE
Radius 20
Height 16
Scale 2.5
const int OFS = 64;
const int HGT = 32;
const int DMG = 34;
const int RNG = 48;
states
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode")
TNT1 A 2 A_Warp(AAPTR_TARGET,OFS,0,HGT,0,WARPF_NOCHECKPOSITION)
Spawn2:
TNT1 A 0 A_JumpIfInTargetInventory("GearChargeKickFlag",1,1) Goto Death
CKIC D 1 A_Warp(AAPTR_TARGET,OFS,0,HGT,0,WARPF_NOCHECKPOSITION) TNT1 A 0 A_Explode(DMG,RNG,0,0,RNG)
TNT1 A 0 A_JumpIfInTargetInventory("GearChargeKickFlag",1,1) Goto Death
CKIC D 1 A_Warp(AAPTR_TARGET,OFS,0,HGT,0,WARPF_NOCHECKPOSITION) TNT1 A 0 A_Explode(DMG,RNG,0,0,RNG)
TNT1 A 0 A_JumpIfInTargetInventory("GearChargeKickFlag",1,1) Goto Death
CKIC E 1 A_Warp(AAPTR_TARGET,OFS,0,HGT,0,WARPF_NOCHECKPOSITION) TNT1 A 0 A_Explode(DMG,RNG,0,0,RNG)
TNT1 A 0 A_JumpIfInTargetInventory("GearChargeKickFlag",1,1) Goto Death
CKIC E 1 A_Warp(AAPTR_TARGET,OFS,0,HGT,0,WARPF_NOCHECKPOSITION) TNT1 A 0 A_Explode(DMG,RNG,0,0,RNG)
TNT1 A 0 A_JumpIfInTargetInventory("GearChargeKickFlag",1,1) Goto Death
CKIC F 1 A_Warp(AAPTR_TARGET,OFS,0,HGT,0,WARPF_NOCHECKPOSITION) TNT1 A 0 A_Explode(DMG,RNG,0,0,RNG)
TNT1 A 0 A_JumpIfInTargetInventory("GearChargeKickFlag",1,1) Goto Death
CKIC F 1 A_Warp(AAPTR_TARGET,OFS,0,HGT,0,WARPF_NOCHECKPOSITION) TNT1 A 0 A_Explode(DMG,RNG,0,0,RNG)
loop
Death:
TNT1 A 0 
stop
}
}

actor GearChargeKickDust
{
Scale 2.5
Height 16
Radius 8
+NOGRAVITY
+NOINTERACTION
States
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode")
DRIA MNOPQ 2
stop
}
}

actor GearChargeKickFlag : Once {}

Actor GearChargeKickProtect : PowerProtection
{
Powerup.Duration 40
DamageFactor "ChargeKickGear", 0.0
}