actor King_W : BaseMM8BDMWep_CBM 
{
tag "$TAGC_BG"
dropitem "ProtoUpgrade"
Weapon.AmmoUse 0
Weapon.AmmoGive 168
Obituary "$OB_KINGSPIN"
Inventory.Pickupmessage "King?"
weapon.ammotype "DinnerAmmo"
weapon.ammotype2 "EnoughShieldAmmo"
inventory.icon "KingWep1"
States
{
Spawn:
C_0B G 1
loop

Deselect:
KINH A 0 OffSet(2,34)A_JumpIfHealthLower(1,"DeselectDeath")
KINH AAA 0 A_Lower
KINH A 1 A_Lower
goto Deselect+1
Select:
KINH AAA 0 A_Raise
KINH A 1 A_Raise
loop

Ready:
KINH A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_KINGMAN)
goto Ready1
Ready1:
KINH A 0 A_GunFlash("Flash",GFF_NOEXTCHANGE)
goto Ready2

Ready2:
KINH A 0 A_JumpIfInventory("TheKingStaminaDelay",1,"Ready2a")
KINH A 0 A_JumpIfInventory("DinnerAmmo",12,"Ready3")
KINH A 2 A_WeaponReady(8)
KINH A 0 A_GiveInventory("DinnerAmmo",2)
KINH A 0 A_JumpIfInventory("TheKingLostShield",1,2)
KINH A 0 A_TakeInventory("TheKingStamina",1)
KINH A 0 A_TakeInventory("TheKingStamina",2)
goto Ready2+1
Ready2a:
KINH A 0 A_JumpIfInventory("DinnerAmmo",12,"Ready3a")
KINH A 2 A_WeaponReady(8)
KINH A 0 A_JumpIfInventory("TheKingLostShield",1,2)
KINH A 0 A_TakeInventory("TheKingStamina",1)
KINH A 0 A_TakeInventory("TheKingStamina",2)
goto Ready2

Ready3:
KINH A 0 A_JumpIfInventory("TheKingStaminaDelay",1,"Ready3a")
KINH A 2 A_WeaponReady
KINH A 0 A_GiveInventory("DinnerAmmo",2)
KINH A 0 A_JumpIfInventory("TheKingLostShield",1,2)
KINH A 0 A_TakeInventory("TheKingStamina",1)
KINH A 0 A_TakeInventory("TheKingStamina",2)
goto Ready3+1
Ready3a:
KINH A 2 A_WeaponReady
KINH A 0 A_GiveInventory("DinnerAmmo",2)
goto Ready3

Flash:
TNT1 A 1
stop

Fire:
KINH A 0 A_JumpIf(CallACS("cbm_GetPointerButtonInput",0,true) & BT_JUMP,"FireAir")
goto FireGround
FireAir:
KINH E 0 A_PlaySoundEx("weapon/TheKingAxeV","Weapon")
KINH D 0 A_JumpIfInventory("PlayerPropertyRage",1,"FireAir_R")
KINH E 1 A_FireCustomMissile("TheKingSlash2",0,0,0,0,1,15)
KINH E 1 OffSet(-10,42)
KINH F 1 OffSet(1,33)A_FireCustomMissile("TheKingSlash2",0,0,0,0)
KINH F 1 OffSet(-11,52)
KINH F 1 OffSet(-23,72)A_FireCustomMissile("TheKingSlash2",0,0,0,0,1,-15)
TNT1 A 2
goto FireEnd
FireAir_R:
KINH E 1 A_FireCustomMissile("TheKingSlash2",0,0,0,0,1,15)
KINH F 1 OffSet(1,33)A_FireCustomMissile("TheKingSlash2",0,0,0,0)
KINH F 1 OffSet(-23,72)A_FireCustomMissile("TheKingSlash2",0,0,0,0,1,-15)
TNT1 A 2
goto FireEnd
FireGround:
KINH D 0 A_JumpIfInventory("PlayerPropertyRage",1,"FireGround_R")
KINH D 3 A_PlaySoundEx("weapon/TheKingAxeH","Weapon")
KINH H 1 A_FireCustomMissile("TheKingSlash1_H",0,0,0,0)
KINH H 1 OffSet(-40,34)
KINH H 1 OffSet(-82,36)
KINH H 1 OffSet(-126,38)
KINH H 1 OffSet(-172,40)
KINH H 1 OffSet(-220,42)
TNT1 A 3
goto FireEnd
FireGround_R:
KINH D 2 A_PlaySoundEx("weapon/TheKingAxeH","Weapon")
KINH H 1 A_FireCustomMissile("TheKingSlash1_H",0,0,0,0)
KINH H 1 OffSet(-50,34)
KINH H 1 OffSet(-102,36)
KINH H 1 OffSet(-156,38)
KINH H 1 OffSet(-202,40)
TNT1 A 2
goto FireEnd
FireEnd:
KINH A 0 A_JumpIfInventory("PlayerPropertyRage",1,"FireEnd_R")
KINH A 1 OffSet(14,172)
KINH A 1 OffSet(12,152)
KINH A 1 OffSet(10,132)
KINH A 1 OffSet(8,112)
KINH A 1 OffSet(6,92)
KINH A 1 OffSet(4,72)
KINH A 1 OffSet(2,52)
Goto Ready2
FireEnd_R:
KINH A 1 OffSet(16,192)
KINH A 1 OffSet(12,152)
KINH A 1 OffSet(8,112)
KINH A 1 OffSet(4,72)
Goto Ready2

AltFire:
KINH A 0 A_JumpIfInventory("DinnerAmmo",1,"AltFire2")
Goto Ready2
AltFire2:
KINH E 0 A_GiveInventory("VivifyCycle1",1)
KINH E 0 A_Refire(1)
KINH E 1 offset(-4,34)A_JumpIfInventory("PlayerPropertyRage",1,"AltFire2_R")
KINH E 1 offset(-8,34)
goto SpinToWin
AltFire2_R:
KINH E 1 offset(-6,34)
goto SpinToWin
SpinToWin:
KINH I 0 A_JumpIfInventory("DinnerAmmo",1,"SpinToWin2")
goto AltFireEnd
SpinToWin2:
KINH I 0 A_JumpIfInventory("PlayerPropertyRage",1,"SpinToWin_R")
KINH I 1 offset(-6,52)A_GiveInventory("TheKingSpinSnd_P",1)
KINH J 1 offset(-6,52)A_GiveInventory("TheKingSpinBoost",1)
KINH J 0 A_Refire("SpinToWin")
goto AltFireEnd
SpinToWin_R:
KINH IJ 1 offset(-6,52)A_GiveInventory("TheKingSpinBoost",1)
KINH J 0 A_Refire("SpinToWin")
goto AltFireEnd

AltFireEnd:
KINH I 0 A_GiveInventory("TheKingSpinSnd_P",1)
KINH IJ 2 offset(-6,52)
KINH IJ 3 offset(-6,52)A_TakeInventory("VivifyCycle1")
KINH E 1 offset(-8,34)A_JumpIfInventory("PlayerPropertyRage",1,"AltFireEnd_R")
KINH E 1 offset(-4,34)
Goto Ready2
AltFireEnd_R:
KINH E 1 offset(-6,34)
Goto Ready2


NoAmmo:
KINH A 0
Goto Ready2
}
}

actor King_W2 : BaseMM8BDMWep_CBM 
{
tag "$TAGC_BG2"
dropitem "ProtoUpgrade"
weapon.preferredskin "King-Shield"
Weapon.AmmoUse 0
Weapon.AmmoGive 168
Obituary "$OB_KINGSHIELD"
Inventory.Pickupmessage "King!"
weapon.ammotype "DinnerAmmo"
weapon.ammotype2 "EnoughShieldAmmo"
inventory.icon "KingWep2"
States
{
Spawn:
C_0B G 1
loop

Deselect:
KINH S 0 A_GiveInventory("StopShield",1)
KINH S 0 A_JumpIfHealthLower(1,"DeselectDeath")
KINH S 0 OffSet(-2,34)A_JumpIfInventory("TheKingLostShield",1,"Deselect2")
KINH SSS 0 A_Lower
KINH S 1 A_Lower
goto Deselect+3
Deselect2:
KINH KKK 0 A_Lower
KINH K 1 A_Lower
loop
Select:
KINH S 0 A_JumpIfInventory("TheKingLostShield",1,"Select2")
KINH SSS 0 A_Raise
KINH S 1 A_Raise
goto Select+1
Select2:
KINH KKK 0 A_Raise
KINH K 1 A_Raise
loop

Ready:
KINH S 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_KINGMAN)
goto Ready1
Ready1:
KINH S 0 A_JumpIfInventory("TheKingLostShield",1,"Ready4")
KINH S 0 A_GiveInventory("VivifyDelay10",1)
KINH S 0 A_TakeInventory("StopShield",1)
KINH S 0 A_GunFlash("Flash",GFF_NOEXTCHANGE)
goto Ready2
Ready2:
KINH S 0 A_JumpIfInventory("VivifyDelay10",1,"Ready2a")
KINH S 0 A_JumpIfInventory("TheKingStaminaDelay",1,"Ready2b")
goto Ready3
Ready2a:
KINH S 2 A_WeaponReady(4)
KINH S 0 A_GiveInventory("DinnerAmmo",2)
goto Ready2
Ready2b:
KINH S 2 A_WeaponReady
KINH S 0 A_GiveInventory("DinnerAmmo",2)
goto Ready2

Ready3:
KINH S 2 A_WeaponReady
KINH S 0 A_GiveInventory("DinnerAmmo",2)
KINH S 0 A_TakeInventory("TheKingStamina",3)
loop

Ready4:
KINH K 2 A_WeaponReady(4)
KINH K 0 A_GiveInventory("DinnerAmmo",1)
KINH K 0 A_TakeInventory("TheKingStamina",2)
KINH K 0 A_JumpIfInventory("TheKingStamina",1,"Ready4")
KINH L 0 A_TakeInventory("TheKingLostShield",1)
KINH L 2 A_WeaponReady(12)
KINH L 0 A_GiveInventory("DinnerAmmo",1)
KINH M 2 A_WeaponReady(12)
KINH M 0 A_GiveInventory("DinnerAmmo",1)
goto Ready1+2

Fire:
KINH S 0 A_GunFlash("NoFlash",GFF_NOEXTCHANGE)
KINH S 0 A_GiveInventory("StopShield",1)
KINH S 0 A_PlaySoundEx("weapon/TheKingShield","Weapon")
KINH S 0 A_GiveInventory("TheKingShieldChargeSlow",1)
KINH S 0 A_JumpIfInventory("PlayerPropertyRage",1,"FireRage")
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,-14,2,momx,momy,momz,0,8)
KINH S 1 OffSet(18,30)A_SpawnItemEx("TheKingShieldFX",28,-14,2,momx,momy,momz,0,1+8)
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,-10,2,momx,momy,momz,0,8)
KINH S 1 OffSet(36,28)A_SpawnItemEx("TheKingShieldFX",28,-10,2,momx,momy,momz,0,1+8)
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,-7,2,momx,momy,momz,0,8)
KINH S 1 OffSet(50,26)A_SpawnItemEx("TheKingShieldFX",28,-7,2,momx,momy,momz,0,1+8)
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,-4,2,momx,momy,momz,0,8)
KINH S 1 OffSet(64,24)A_SpawnItemEx("TheKingShieldFX",28,-4,2,momx,momy,momz,0,1+8)
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,-2,2,momx,momy,momz,0,8)
KINH S 1 OffSet(76,22)A_SpawnItemEx("TheKingShieldFX",28,-2,2,momx,momy,momz,0,1+8)
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,0,2,momx,momy,momz,0,8)
KINH S 1 OffSet(88,20)A_SpawnItemEx("TheKingShieldFX",28,0,2,momx,momy,momz,0,1+8)
KINH S 0 A_JumpIfInventory("TheKingStamina",224,"FireEndBreak")
KINH S 0 A_GiveInventory("VivifyDelay6",1)
KINH S 0 A_TakeInventory("StopShield",1)
KINH S 0 A_GunFlash("Flash.MainF",GFF_NOEXTCHANGE)
KINH S 0 A_SpawnItemEx("TheKingShieldSparkle0",0,0,28)
goto FireL1
FireRage:
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,-14,2,momx,momy,momz,0,8)
KINH S 1 OffSet(18,30)A_SpawnItemEx("TheKingShieldFX",28,-14,2,momx,momy,momz,0,1+8)
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,-4,2,momx,momy,momz,0,8)
KINH S 1 OffSet(64,24)A_SpawnItemEx("TheKingShieldFX",28,-4,2,momx,momy,momz,0,1+8)
KINH S 0 A_TakeInventory("StopShield",1)
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,0,2,momx,momy,momz,0,8)
KINH S 1 OffSet(88,20)A_SpawnItemEx("TheKingShieldFX",28,0,2,momx,momy,momz,0,1+8)
KINH S 0 A_JumpIfInventory("TheKingStamina",224,"FireEndBreak")
KINH S 0 //A_GiveInventory("VivifyDelay4",1)
KINH S 0 A_TakeInventory("StopShield",1)
KINH S 0 A_GunFlash("Flash.MainF",GFF_NOEXTCHANGE)
KINH S 0 A_SpawnItemEx("TheKingShieldSparkle0",0,0,28)
goto FireL1
FireL1:
KINH R 1 OffSet(98,19)A_GiveInventory("EnoughShieldAmmo",1)
KINH R 0 A_Refire(1)
goto FireEnd
KINH R 0 A_JumpIfInventory("TheKingStamina",224,"FireEndBreak")
KINH R 0 A_JumpIfInventory("VivifyDelay6",1,"FireL1")
KINH S 0 A_GiveInventory("VivifyDelay6",1)
goto FireL2
FireL2:
KINH S 1 A_GiveInventory("EnoughShieldAmmo",1)
KINH S 0 A_Refire(1)
goto FireEnd
KINH S 0 A_JumpIfInventory("TheKingStamina",224,"FireEndBreak")
KINH S 0 A_JumpIfInventory("VivifyDelay6",1,"FireL2")
KINH T 0 A_GiveInventory("VivifyDelay6",1)
goto FireL3
FireL3:
KINH T 1 A_GiveInventory("EnoughShieldAmmo",1)
KINH T 0 A_Refire(1)
goto FireEnd
KINH T 0 A_JumpIfInventory("TheKingStamina",224,"FireEndBreak")
KINH T 0 A_JumpIfInventory("VivifyDelay6",1,"FireL3")
KINH U 0 A_GiveInventory("VivifyDelay6",1)
goto FireL4
FireL4:
KINH U 1 A_GiveInventory("EnoughShieldAmmo",1)
KINH U 0 A_Refire(1)
goto FireEnd
KINH U 0 A_JumpIfInventory("TheKingStamina",224,"FireEndBreak")
KINH U 0 A_JumpIfInventory("VivifyDelay6",1,"FireL4")
KINH T 0 A_GiveInventory("VivifyDelay6",1)
goto FireL5
FireL5:
KINH T 1 A_GiveInventory("EnoughShieldAmmo",1)
KINH T 0 A_Refire(1)
goto FireEnd
KINH T 0 A_JumpIfInventory("TheKingStamina",224,"FireEndBreak")
KINH T 0 A_JumpIfInventory("VivifyDelay6",1,"FireL5")
KINH S 0 A_GiveInventory("VivifyDelay6",1)
goto FireL6
FireL6:
KINH S 1 A_GiveInventory("EnoughShieldAmmo",1)
KINH S 0 A_Refire(1)
goto FireEnd
KINH S 0 A_JumpIfInventory("TheKingStamina",224,"FireEndBreak")
KINH S 0 A_JumpIfInventory("VivifyDelay6",1,"FireL6")
KINH R 0 A_GiveInventory("VivifyDelay6",1)
goto FireL1

FireEnd:
KINH S 0 A_GunFlash("NoFlash",GFF_NOEXTCHANGE)
KINH S 0 A_GiveInventory("StopShield",1)
KINH S 0 A_TakeInventory("TheKingShieldChargeSlow")
KINH S 0 A_JumpIfInventory("PlayerPropertyRage",1,"FireEndR")
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,0,2,momx,momy,momz,0,8)
KINH S 1 OffSet(88,20)A_SpawnItemEx("TheKingShieldFX",28,0,2,momx,momy,momz,0,1+8)
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,-2,2,momx,momy,momz,0,8)
KINH S 1 OffSet(76,22)A_SpawnItemEx("TheKingShieldFX",28,-2,2,momx,momy,momz,0,1+8)
KINH S 0 //A_TakeInventory("EnoughShieldAmmo",999)
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,-4,2,momx,momy,momz,0,8)
KINH S 1 OffSet(64,24)A_SpawnItemEx("TheKingShieldFX",28,-4,2,momx,momy,momz,0,1+8)
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,-7,2,momx,momy,momz,0,8)
KINH S 1 OffSet(50,26)A_SpawnItemEx("TheKingShieldFX",28,-7,2,momx,momy,momz,0,1+8)
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,-10,2,momx,momy,momz,0,8)
KINH S 0 A_GiveInventory("TheKingStaminaDelay",1)
KINH S 1 OffSet(36,28)A_SpawnItemEx("TheKingShieldFX",28,-10,2,momx,momy,momz,0,1+8)
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,-14,2,momx,momy,momz,0,8)
KINH S 1 OffSet(18,30)A_SpawnItemEx("TheKingShieldFX",28,-14,2,momx,momy,momz,0,1+8)
goto Ready1
FireEndR:
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,0,2,momx,momy,momz,0,8)
KINH S 1 OffSet(88,20)A_SpawnItemEx("TheKingShieldFX",28,0,2,momx,momy,momz,0,1+8)
KINH S 0 //A_TakeInventory("EnoughShieldAmmo",999)
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,-4,2,momx,momy,momz,0,8)
KINH S 1 OffSet(64,24)A_SpawnItemEx("TheKingShieldFX",28,-4,2,momx,momy,momz,0,1+8)
KINH S 0 A_GiveInventory("TheKingStaminaDelay",1)
KINH S 0 A_SpawnItemEx("TheKingShieldHitbox0_H",28,-10,2,momx,momy,momz,0,8)
KINH S 1 OffSet(36,28)A_SpawnItemEx("TheKingShieldFX",28,-10,2,momx,momy,momz,0,1+8)
goto Ready1
FireEndBreak:
KINH K 0 A_GunFlash("NoFlash",GFF_NOEXTCHANGE)
KINH K 0 A_GiveInventory("StopShield",1)
KINH K 0 A_PlaySoundEx("DyHead/YayoiPunch","Weapon")
KINH K 0 A_TakeInventory("TheKingShieldChargeSlow")
KINH K 0 A_SpawnItemEx("TheKingShieldDeath",28,0,2,8,0,momz+3,0,1)

KINH K 0 A_JumpIfInventory("PlayerPropertyRage",1,"FireEndBreakR")
KINH K 1 OffSet(88,20)
KINH K 1 OffSet(76,22)
KINH K 0 A_TakeInventory("EnoughShieldAmmo")
KINH K 1 OffSet(64,24)
KINH K 1 OffSet(50,26)
KINH K 1 OffSet(36,28)A_GiveInventory("TheKingLostShield",1)
KINH K 1 OffSet(18,30)
goto Ready4
FireEndBreakR:
KINH K 1 OffSet(88,20)
KINH K 0 A_TakeInventory("EnoughShieldAmmo")
KINH K 1 OffSet(64,24)
KINH K 1 OffSet(36,28)A_GiveInventory("TheKingLostShield",1)
goto Ready4


AltFire:
KINH "#" 0 A_GunFlash("NoFlash",GFF_NOEXTCHANGE)
KINH "#" 0 A_GiveInventory("StopShield",1)
KINH "#" 0 A_GiveInventory("VivifyFlag1",1)
KINH "#" 0 A_Refire(1)
KINH "#" 0 A_GiveInventory("TheKingShieldChargeSlow",1)
KINH "#" 0 A_GunFlash("Flash.AltF",GFF_NOEXTCHANGE)
KINH "#" 2 OffSet(-16,42)
KINH "#" 2 OffSet(-32,52)
KINH "#" 2 OffSet(-46,62)
KINH "#" 2 OffSet(-60,72)
goto AltFire_1
AltFire_1://Start Up
KINH "#" 2 OffSet(-64,72)
KINH "#" 2 OffSet(-60,72)
KINH "#" 0 A_Refire("AltFire_2")
goto AltFireEnd
AltFire_2:
KINH "#" 2 OffSet(-64,72)
KINH "#" 2 OffSet(-60,72)
KINH "#" 0 A_Refire("AltFire_3")
goto AltFireEnd
AltFire_3:
KINH "#" 2 OffSet(-64,72)
KINH "#" 2 OffSet(-60,72)
KINH "#" 0 A_Refire("AltFire_4")
goto AltFireEnd
AltFire_4:
KINH "#" 2 OffSet(-64,72)
KINH "#" 2 OffSet(-60,72)
KINH "#" 0 A_Refire("AltFire2")
goto AltFireEnd
AltFire2:
KINH "#" 0 A_PlaySoundEx("misc/kingblast","Weapon")
KINH "#" 0 A_FireCustomMissile("TheKingXAttack",0,0,0,0)
KINH "#" 2 OffSet(-64,72)//A_RailWait
KINH "#" 2 OffSet(-60,72)
KINH "#" 0 A_Refire(1)
goto AltFireEnd
KINH "#" 2 OffSet(-64,72)
KINH "#" 2 OffSet(-60,72)
KINH "#" 0 A_Refire(1)
goto AltFireEnd
KINH "#" 2 OffSet(-64,72)
KINH "#" 2 OffSet(-60,72)
KINH "#" 0 A_Refire(1)
goto AltFireEnd
KINH "#" 2 OffSet(-64,72)
KINH "#" 2 OffSet(-60,72)
KINH "#" 0 A_Refire(1)
goto AltFireEnd
KINH "#" 2 OffSet(-64,72)
KINH "#" 2 OffSet(-60,72)
KINH "#" 0 A_Refire(1)
goto AltFireEnd
KINH "#" 2 OffSet(-64,72)
KINH "#" 2 OffSet(-60,72)
KINH "#" 0 A_Refire("AltFire_1")
goto AltFireEnd

AltFireEnd:
KINH "#" 0 A_TakeInventory("TheKingShieldChargeSlow")
KINH "#" 2 OffSet(-46,62)A_TakeInventory("VivifyFlag1",9)
KINH "#" 2 OffSet(-32,52)
KINH "#" 2 OffSet(-16,42)
KINH "#" 0 A_JumpIfInventory("TheKingLostShield",1,"Ready4")
Goto Ready1+2

AltFireX:
KINH S 0 A_JumpIfInventory("DinnerAmmo",40,1)
Goto Ready2
KINH S 0 A_PlaySoundEx("weapon/TrioCharge3","Weapon")
KINH S 0 A_FireCustomMissile("TheKingShieldLaser",0,0,0,0)
KINH S 4 A_TakeInventory("DinnerAmmo",40,1)
Goto Ready2

Flash2://Old
TNT1 A 0 A_SpawnItemEx("TheKingShieldX1",28,-18,2,momx,momy,momz,0,1+8)
TNT1 A 1 A_SpawnItemEx("TheKingShieldFX",28,-18,2,momx,momy,momz,0,1+8)
loop

Flash:
TNT1 A 0 A_GiveInventory("TheKingShieldHitbox_P",1)
TNT1 A 1 A_SpawnItemEx("TheKingShieldFX",28,-18,2,momx,momy,momz,0,1+8)
wait

Flash.MainF:
TNT1 A 0 A_GiveInventory("TheKingShieldHitboxB_P",1)
TNT1 A 1 A_SpawnItemEx("TheKingShieldFX0",28,0,2,momx,momy,momz,0,1+8)
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
TNT1 A 1 A_SpawnItemEx("TheKingShieldFX0",28,0,2,momx,momy,momz,0,1+8)
TNT1 A 1 A_SpawnItemEx("TheKingShieldFX0",28,0,2,momx,momy,momz,0,1+8)
TNT1 A 0 A_GiveInventory("DinnerAmmo",1)
goto Flash.MainF+1

Flash.AltF:
TNT1 A 4
TNT1 A 0 A_GiveInventory("DinnerAmmo",1)
loop

NoAmmo:
MGCH A 0
Goto Ready+2
}
}


actor DinnerAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 168
+INVENTORY.IGNORESKILL
}

actor EnoughShieldAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 112
+INVENTORY.IGNORESKILL
}

actor TheKingShieldChargeSlow : PowerSpeed
{
powerup.duration 0x7FFFFFFC
Speed 0.85
+POWERSPEED.NOTRAIL
+INVENTORY.ALWAYSPICKUP
}


actor TheKingStaminaDelay : Powerup
{
Powerup.Duration 70
}
actor TheKingStamina : Inventory
{
inventory.amount 1
inventory.maxamount 224
}
actor TheKingLostShield : OnceC {}

actor TheKingShieldDelay : Powerup
{
Powerup.Duration 2//35
}

actor TheKingSpinSnd : Powerup
{
+INVENTORY.ADDITIVETIME
Powerup.Duration 3
}

actor TheKingSpinBoost : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("TheKingSpinSnd_P")
TNT1 A 0 A_SpawnItemEx("TheKingSpinAlt",8,0,32,momx,momy,momz,0,8)
TNT1 A 0 A_TakeInventory("DinnerAmmo",1)
TNT1 A 0 A_TakeInventory("DinnerAmmo",2,1)
TNT1 A 0 A_JumpIf(z-floorz==0,"Ground")
TNT1 A 0 A_Recoil(-1)
stop
Ground:
TNT1 A 0 A_Recoil(-2.5)
stop
}
}

actor TheKingSpinSnd_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("TheKingSpinSnd",1,"No")
TNT1 A 0 A_PlaySoundEx("weapon/TheKingSpin","Weapon")
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
TNT1 AA 0 A_GiveInventory("TheKingSpinSnd",1)
stop
No:
TNT1 A 0 
stop
}
}

actor TheKingSlash1_H : BasicHelper
{
//Speed 1
States
{
Spawn:
TNT1 A 0
TNT1 A 0 //A_SpawnItemEx("TheKingSlash1",4,0,4,90,0,0,0,1)


TNT1 A 0 A_Warp(2,0,0,32,angle,26)
TNT1 A 1 A_SpawnItemEx("TheKingSlash1",4,-10,4,90,0,0,-70)
TNT1 A 0 A_Warp(2,0,0,32,angle,26)
TNT1 A 1 A_SpawnItemEx("TheKingSlash1",4,-5,4,90,0,0,-35)
TNT1 A 0 A_Warp(2,0,0,32,angle,26)
TNT1 A 1 A_SpawnItemEx("TheKingSlash1",4,0,4,90,0,0,0)
TNT1 A 0 A_Warp(2,0,0,32,angle,26)
TNT1 A 1 A_SpawnItemEx("TheKingSlash1",4,5,4,90,0,0,35)
TNT1 A 0 A_Warp(2,0,0,32,angle,26)
TNT1 A 1 A_SpawnItemEx("TheKingSlash1",4,10,4,90,0,0,70)
stop
}
}

actor TheKingSlash1 : ProjSpawnFuncActor
{
PROJECTILE
damagetype "King_Slash"
Obituary "$OB_KINGSLASH1"
+THRUACTORS
+DONTBLAST
+DONTSPLASH
+DONTREFLECT
ReactionTime 1
damage (0)
Radius 4
Height 4
speed 85
scale 2.5
States
{
Spawn:
KGNP J 1
KGNP J 1 A_CountDown
wait
Death:
KGNP JK 2 A_Explode(40,70,0,0,71)
KGNP J 2
stop
}
}


actor TheKingSlash2 : TheKingSlash1
{
Obituary "$OB_KINGSLASH2"
speed 46
Args 3
States
{
Spawn:
TNT1 A 1
KGMP T 0 A_CountDownArg(0)
KGMP T 2 A_Explode(20,64,0,0,65)
KGMP U 0 A_CountDownArg(0)
KGMP U 2 A_Explode(20,64,0,0,65)
KGMP V 0 A_CountDownArg(0)
KGMP V 2 A_Explode(20,64,0,0,65)
KGMP V 1 A_CountDownArg(0)
wait
Death:
TNT1 A 0
TNT1 A 2 A_Explode(20+Args[0]*10,64,0,0,65)
stop
}
}

actor TheKingSpinAlt : BasicImplosion
{
Damagetype "King_AxeSpin"
Obituary "$OB_KINGSPIN"
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(40+CallACS("core_checkrune",RUNE_SPREAD,2)*80,128,0,0,16)
stop
}
}



actor TheKingShieldX1 : BasicHelper
{
+NOTIMEFREEZE
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox0",0,-16,0,momx,momy,momz,0,8)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox0",0,-8,0,momx,momy,momz,0,8)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox0",0,0,0,momx,momy,momz,0,8)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox0",0,8,0,momx,momy,momz,0,8)
TNT1 A 1 A_SpawnItemEx("TheKingShieldHitbox0",0,16,0,momx,momy,momz,0,8)
stop
}
}

actor TheKingShieldX2 : BasicHelper
{
+NOTIMEFREEZE
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox2",0,-24,0,momx,momy,momz,0,8)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox2",0,-16,0,momx,momy,momz,0,8)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox2",0,-8,0,momx,momy,momz,0,8)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox3",0,0,0,momx,momy,momz,0,8)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox2",0,8,0,momx,momy,momz,0,8)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox2",0,16,0,momx,momy,momz,0,8)
TNT1 A 1 A_SpawnItemEx("TheKingShieldHitbox2",0,24,0,momx,momy,momz,0,8)
stop
}
}

actor TheKingShieldSparkle0 : BasicExplosion
{
RenderStyle None
States
{
Spawn:
TNT1 A 0

TNT1 A 0 A_SpawnItemEx("TheKingShieldSparkle1",28,0,0,1,0,-3,0,1)

TNT1 A 0 A_SpawnItemEx("TheKingShieldSparkle1",28,-10,0,1,3,-2,0,1)
TNT1 A 0 A_SpawnItemEx("TheKingShieldSparkle1",28,10,0,1,-3,-2,0,1)

TNT1 A 0 A_SpawnItemEx("TheKingShieldSparkle1",28,-10,10,1,4,-1,0,1)
TNT1 A 0 A_SpawnItemEx("TheKingShieldSparkle1",28,10,10,1,-4,-1,0,1)

TNT1 A 0 A_SpawnItemEx("TheKingShieldSparkle1",28,-10,20,1,5,0,0,1)
TNT1 A 0 A_SpawnItemEx("TheKingShieldSparkle1",28,10,20,1,-5,0,0,1)

TNT1 A 0 A_SpawnItemEx("TheKingShieldSparkle1",28,-10,30,1,4,1,0,1)
TNT1 A 0 A_SpawnItemEx("TheKingShieldSparkle1",28,10,30,1,-4,1,0,1)

TNT1 A 0 A_SpawnItemEx("TheKingShieldSparkle1",28,-10,40,1,3,2,0,1)
TNT1 A 0 A_SpawnItemEx("TheKingShieldSparkle1",28,10,40,1,-3,2,0,1)

TNT1 A 0 A_SpawnItemEx("TheKingShieldSparkle1",28,0,50,1,0,3,0,1)
TNT1 A 1
stop
}
}

actor TheKingShieldSparkle1 : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
States
{
SpawnFrame:
TNT1 A 0
KGMP NOPQ 3
stop
}
}
actor TheKingShieldSparkle2 : TheKingShieldSparkle1
{
Scale 1.5
}


actor TheKingShieldHitbox0_H : BasicHelper
{
+NOTIMEFREEZE
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox0",0,-16,0,momx,momy,momz,0,8)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox0",0,-8,0,momx,momy,momz,0,8)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox0",0,0,0,momx,momy,momz,0,8)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox0",0,8,0,momx,momy,momz,0,8)
TNT1 A 1 A_SpawnItemEx("TheKingShieldHitbox0",0,16,0,momx,momy,momz,0,8)
stop
}
}

actor TheKingShieldHitbox_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox1",28,-34,2)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox2",28,-26,2)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox3",28,-18,2)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox4",28,-10,2)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitbox5",28,-2,2)
stop
}
}
actor TheKingShieldHitboxB_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitboxB1",28,-24,2)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitboxB2",28,-16,2)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitboxB3",28,-8,2)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitboxB4",28,0,2)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitboxB5",28,8,2)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitboxB6",28,16,2)
TNT1 A 0 A_SpawnItemEx("TheKingShieldHitboxB7",28,24,2)
stop
}
}


actor TheKingShieldHitbox0 : BasicShieldHitbox
{
+NODAMAGE
+THRUSPECIES
Species "TheKing"
Height 54//42
States
{
Spawn:
TNT1 A 0
TNT1 A 2
stop
Pain:
TNT1 A 0 A_SpawnItemEx("TheKingShieldDeathFX",3,0,16)
TNT1 A 1 A_PlaySound("item/protoreflect")
stop
}
}
actor TheKingShieldHitbox1 : BasicShieldHitbox
{
+NODAMAGE
+THRUSPECIES
Species "TheKing"
Meleerange 28
Accuracy -34
Mass 2
Height 54//42
States
{
Pain:
TNT1 A 0 A_SpawnItemEx("TheKingShieldDeathFX",3,0,16)
TNT1 A 0 A_PlaySound("item/protoreflect")
goto Spawn
}
}
actor TheKingShieldHitbox2 : TheKingShieldHitbox1
{
Accuracy -26
}
actor TheKingShieldHitbox3 : TheKingShieldHitbox1
{
Accuracy -18
}
actor TheKingShieldHitbox4 : TheKingShieldHitbox1
{
Accuracy -10
}
actor TheKingShieldHitbox5 : TheKingShieldHitbox1
{
Accuracy -2
}


actor TheKingShieldHitboxB1 : TheKingShieldHitbox1
{
-NOTARGETSWITCH
+QUICKTORETALIATE
+INVULNERABLE
+NOPAIN
-SHOOTABLE
Accuracy -24
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_RearrangePointers(0,0,2)
TNT1 A 0 //A_ClearTarget
TNT1 A 0 A_ChangeFlag("INVULNERABLE",0)
TNT1 A 0 A_ChangeFlag("NOPAIN",0)
TNT1 A 0 A_ChangeFlag("SHOOTABLE",1)
goto SpawnL
SpawnL:
TNT1 A 0
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TRACER),"Death2")
TNT1 A 0 A_JumpIfInventory("StopShield",1,"SpawnStop",8)
KNIA L 1 A_Warp(8,Meleerange,Accuracy,/*Mass*/2,0,24)
loop
Pain:
TNT1 A 0 A_ChangeFlag("NOPAIN",1)
TNT1 A 0 A_ChangeFlag("SHOOTABLE",0)
TNT1 A 0 A_SpawnItemEx("TheKingShieldDeathFX",3,0,16)
TNT1 A 0 A_PlaySound("item/protoreflect")
TNT1 A 0 A_JumpIfInventory("TheKingShieldDelay",1,"PainEnd",8)
TNT1 A 0 A_JumpIfInventory("EnoughShieldAmmo",14,"PainFire",8)
goto PainEnd
PainFire:
TNT1 A 1 //1 tic delay is needed for target to register
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_GiveIfPlayerHitMe",808)
goto PainEnd
PainEnd:
TNT1 A 0 A_ChangeFlag("NOPAIN",0)
TNT1 A 0 A_ChangeFlag("SHOOTABLE",1)
goto SpawnL
}
}
actor TheKingShieldHitboxB2 : TheKingShieldHitboxB1
{
Accuracy -16
}
actor TheKingShieldHitboxB3 : TheKingShieldHitboxB1
{
Accuracy -8
}
actor TheKingShieldHitboxB4 : TheKingShieldHitboxB1
{
-NORADIUSDMG
//+DONTTHRUST
Accuracy 0
Mass 99999
}
actor TheKingShieldHitboxB5 : TheKingShieldHitboxB1
{
Accuracy 8
}
actor TheKingShieldHitboxB6 : TheKingShieldHitboxB1
{
Accuracy 16
}
actor TheKingShieldHitboxB7 : TheKingShieldHitboxB1
{
Accuracy 24
}

actor TheKingShieldDeathFX : BasicGraphicEffect
{
+BRIGHT
renderstyle add
alpha 0.9
Scale 1.4
states
{
SpawnFrame:
KGNP M 0 A_SetScale(scaleX + 0.1, 2.5) 
KGNP M 1 A_FadeOut(0.05)
loop
}
}

actor TheKingShieldDeath : ProjSpawnFuncActor
{
var int user_NoTranslation;
PROJECTILE
DamageType "King_ShieldDrop"
Obituary "$OB_KINGSHIELDX"
-NOGRAVITY
+THRUGHOST
+SKYEXPLODE
+BOUNCEONFLOORS
//+BOUNCEONWALLS
+BOUNCEONCEILINGS
//+ALLOWBOUNCEONACTORS
+CANBOUNCEWATER
BounceFactor 0.91
BounceCount 4
Species "TheKing"
ReactionTime 35
Damage (250)
Height 54
Radius 26
Speed 14
Scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 ACS_NamedExecuteWithResult("core_copytranslation")
SpawnLoop:
KGNP S 1
TNT1 A 1 A_CountDown
loop
Death:
KGNP M 0 A_SetGravity(0.0)
KGNP M 1 A_FadeOut(0.15)
wait
}
}

actor TheKingShieldFX : ProtoShieldFX
{
States
{
Spawn:
TNT1 A 0
KGNP A 1
stop
}
}

actor TheKingShieldFX0 : ProtoShieldFX
{
States
{
Spawn:
TNT1 A 0
KGNP A 1 A_SpawnItemEx("TheKingShieldSparkle2",random(4,8),random(-48,48),random(-4,70),0,0,0,0,1,196)
stop
}
}




actor TheKingShieldCounter : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("TheKingShieldDelay",1,"No")
TNT1 A 0 A_GiveInventory("TheKingShieldDelay",1)
TNT1 A 0 A_TakeInventory("EnoughShieldAmmo",14)
TNT1 A 0 A_TakeInventory("EnoughShieldAmmo",14,1)
TNT1 A 0 //A_PlaySoundEx("weapon/heat1","SoundSlot7")
TNT1 A 0 A_SpawnItemEx("TheKingShieldHelper")
stop
No:
TNT1 A 0
stop
}
}

actor TheKingShieldHelper : BasicExplosion
{
RenderStyle None
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_PlaySoundEx("weapon/heat1","Weapon")
TNT1 AAAA 1 A_GiveToTarget("TheKingShieldFX1_P")
TNT1 AAAA 1 A_GiveToTarget("TheKingShieldFX2_P")
TNT1 AAAA 1 A_GiveToTarget("TheKingShieldFX3_P")
TNT1 A 1 A_GiveToTarget("TheKingShieldFire_P")
stop
}
}


actor TheKingShieldFire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("TheKingStamina",24)
TNT1 A 0 A_PlaySoundEx("weapon/centaurflash","SoundSlot7")
//CustomRailgun(25,0, "purple", "white", 1, 1)
TNT1 A 0 A_FireCustomMissile("TheKingShieldLaser",-15,0,0,0)
TNT1 A 0 A_FireCustomMissile("TheKingShieldLaser",0,0,0,0)
TNT1 A 0 A_FireCustomMissile("TheKingShieldLaser",15,0,0,0)
//TNT1 A 0 A_SpawnItemEx("TheKingShieldLaser",28,-18,28,55,0,0,0)
//TNT1 A 0 A_SpawnItemEx("TheKingShieldLaser",28,-18,28,55,0,0,-10)
//TNT1 A 0 A_SpawnItemEx("TheKingShieldLaser",28,-18,28,55,0,0,-20)
//TNT1 A 0 A_SpawnItemEx("TheKingShieldLaser",28,-18,28,55,0,0,-30)
//TNT1 A 0 A_SpawnItemEx("TheKingShieldLaser",28,-18,28,55,0,0,10)
//TNT1 A 0 A_SpawnItemEx("TheKingShieldLaser",28,-18,28,55,0,0,20)
//TNT1 A 0 A_SpawnItemEx("TheKingShieldLaser",28,-18,28,55,0,0,30)
stop
}
}

actor TheKingShieldFX1_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("TheKingShieldFX1",25,0,28,0,0,0,0,1)
stop
}
}
actor TheKingShieldFX2_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("TheKingShieldFX2",25,0,28,0,0,0,0,1)
stop
}
}
actor TheKingShieldFX3_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("TheKingShieldFX3",25,0,28,0,0,0,0,1)
stop
}
}

actor TheKingShieldFX1 : BasicGraphicEffect
{
States
{
SpawnFrame:
KGNP B 1
stop
}
}
actor TheKingShieldFX2 : BasicGraphicEffect
{
States
{
SpawnFrame:
KGNP C 1
stop
}
}
actor TheKingShieldFX3 : BasicGraphicEffect
{
States
{
SpawnFrame:
KGNP D 1
stop
}
}


actor TheKingShieldLaser : ProjSpawnFuncActor
{
PROJECTILE
Obituary "$OB_KINGSHIELD"
DamageType "King_Laser"
+THRUGHOST
+THRUSPECIES
Species "TheKing"

+BOUNCEONFLOORS
+BOUNCEONWALLS
+BOUNCEONCEILINGS
//+ALLOWBOUNCEONACTORS
+CANBOUNCEWATER
+FORCEXYBILLBOARD
+BRIGHT
WALLBOUNCEFACTOR 0.99
BOUNCEFACTOR 0.99
reactiontime 2//150

damage (60)
Height 10
Radius 10
Speed 35
Scale 2.0
States
{
Spawn:
TNT1 A 1
KGNP EEEEEEEEEE 1 A_SpawnItemEx("TheKingShieldLaserFX",0,0,0,0,0,0,0,1)
KGNP E 0 A_CountDown
goto Spawn+1
}
}

actor TheKingShieldLaserFX : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
Scale 2.0
States
{
SpawnFrame:
KGNP E 1 A_FadeOut(0.1)
loop
}
}

actor TheKingXAttack : ProjSpawnFuncActor
{
PROJECTILE
DamageType "King_XShock"
Obituary "$OB_KINGPEWX"
damage (250)
+FORCEXYBILLBOARD
+BRIGHT
Radius 16//42
Height 32//56
Speed 35
Scale 2.0
States
{
Spawn:
KGNP FFGG 1
Xellent:
KGNP H 1 A_SpawnItemEx("TheKingXAttackFX1",0,0,0,0,0,0,0,1)
KGNP I 1 A_SpawnItemEx("TheKingXAttackFX2",0,0,0,0,0,0,0,1)
loop
Death:
TNT1 A 1
stop
}
}

actor TheKingXAttackFX1 : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
renderstyle add
alpha 1.0
Scale 2.0
States
{
SpawnFrame:
KGNP HIHIFGFG 1 A_FadeOut(0.1)
stop
}
}
actor TheKingXAttackFX2 : TheKingXAttackFX1
{
States
{
SpawnFrame:
KGNP IHIHGFGF 1 A_FadeOut(0.1)
stop
}
}


actor TheKingLaser : ProjSpawnFuncActor
{
PROJECTILE
damagetype "King_ShieldLaser"
Obituary "$OB_KINGLASER"
+THRUGHOST
+FORCEXYBILLBOARD
+BOUNCEONFLOORS
+BOUNCEONWALLS
+BOUNCEONCEILINGS
//+ALLOWBOUNCEONACTORS
+CANBOUNCEWATER
+FORCEXYBILLBOARD
+BRIGHT
WALLBOUNCEFACTOR 0.99
BOUNCEFACTOR 0.99
reactiontime 40//150
damage (30)
Radius 9
Height 9
speed 25
scale 2.5
States
{
Spawn:
KGNP L 0
KGNP L 0 A_SpawnItemEx("TheKingLaserFX",0,0,0,0,0,0,0,1)
KGNP L 1 A_CountDown
loop
}
}

actor TheKingLaserFX : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
States
{
SpawnFrame:
KGNP L 6
stop
}
}



actor King_W_NormalBar : NormalBar {Args 215,220}
actor King_W_SecondBar : SecondBar {Args 229,128}
actor King_W_ScriptBar : ScriptBar {}
actor King_W2_NormalBar : NormalBar {Args 215,220}
actor King_W2_SecondBar : SecondBar {Args 229,128}
actor King_W2_ScriptBar : ScriptBar {}