actor KinglyBladeWep_NormalBar : NormalBar{args 4,57}
actor KinglyBladeWep_ScriptBar : ScriptBar{}
actor KinglyBladeWep : BaseMM8BDMWep
{
Weapon.AmmoUse 2
Weapon.AmmoGive 30
Weapon.SlotNumber 4
Inventory.Pickupmessage "$PU_KINGLYBLADE"
Obituary "$OB_KINGLYBLADE"
Tag "$TAG_KINGLYBLADE"
weapon.ammotype "KinglyBladeAmmo"
inventory.icon "KBLDICON"
States
{
SpawnLoop:
KBLD Z 1
loop
Ready:
KSWG A 0 ACS_NamedExecuteWithResult("core_weaponcolor",COLOR_KINGLYBLADE)
KSWG A 1 A_WeaponReady
Goto Ready+1
ReadyC: Goto Ready+1
Deselect:
KSWG A 0 
goto DeselectSwap
Select:
KSWG A 0 
goto SelectSwap
Fire:
KSWG A 0 A_JumpIfNoAmmo("NoAmmo")
KSWG A 1
KSWG A 0 A_Refire("Hold")
Goto Fire1
Altfire:
KSWG A 0 A_JumpIfInventory("Vile_ClassAltfire", 1, "ClassAltfire")
KSWG A 0 A_JumpIf(CallACS("Vile_class_altfire"), "ClassAltfire")
KSWG A 1 A_JumpIfInventory("MM8BDMPlayer", 1, 1)
wait
KSWG A 0 A_JumpIfNoAmmo("NoAmmo")
KSWG A 0 A_JumpIfInventory("KinglyBladeAmmo", 2, "Fire1")
goto NoAmmo
ClassAltfire:
KSWG A 0 
goto Super::Altfire
Hold:
KSWG A 0 A_JumpIfInventory("KinglyBladeAmmo", 2, "Hold2")
goto NoAmmo
Hold2:
KSWG A 0 A_JumpIfInventory("WeaponCharge",18,"Charge")
KSWG A 1 A_GiveInventory("WeaponCharge", 1 + CallACS("core_checkrune", RUNE_RAGE))
KSWG A 0 A_Refire
Goto Fire1
Charge:
KSWG A 0 A_JumpIfInventory("WeaponCharge",19,"Charge1")
KSWG A 0 A_PlaySoundEx("weapon/coilstart","Weapon")
Goto Charge1
Charge1:
KSWG R 0 A_JumpIfInventory("WeaponCharge",35,"Charge2Start")
KSWG R 1 ACS_NamedExecuteWithResult("core_chargecolor", COLOR_KINGLYBLADE2,TCLR_CHARGE1)
KSWG R 0 A_Refire("Charge1.a")
Goto Fire2
Charge1.a:
KSWG A 1 ACS_NamedExecuteWithResult("core_chargecolor", COLOR_KINGLYBLADE,TCLR_NONE)
KSWG A 0 A_GiveInventory("WeaponCharge", 1 + CallACS("core_checkrune", RUNE_RAGE))
KSWG A 0 A_Refire("Charge1")
Goto Fire2
Charge2Start:
KSWG A 0 A_GunFlash("Sound.BusterCharge", GFF_NOEXTCHANGE)
Goto Charge2
Charge2:
KSWG A 1 ACS_NamedExecuteWithResult("core_chargecolor", COLOR_KINGLYBLADE3,TCLR_CHARGE2)
KSWG A 0 A_Refire("Charge2.a")
Goto Fire3
Charge2.a:
KSWG S 1 ACS_NamedExecuteWithResult("core_chargecolor", COLOR_KINGLYBLADE4,TCLR_CHARGE3)
KSWG S 0 A_Refire("Charge2.b")
Goto Fire3
Charge2.b:
KSWG T 1 ACS_NamedExecuteWithResult("core_chargecolor", COLOR_KINGLYBLADE,TCLR_NONE)
KSWG T 0 A_JumpIfInventory("WeaponCharge", 35, 2)
KSWG T 0 A_GiveInventory("WeaponCharge", 1 + CallACS("core_checkrune", RUNE_RAGE))
"####" "#" 0 A_JumpIfInventory("IsBot", 1, "BotFire")
KSWG T 0 A_Refire("Charge2")
Goto Fire3
BotFire:
"####" "#" 0 A_Jump(16, "Fire3")
"####" "#" 0 A_Refire("Charge2")
Goto Fire3

Fire1:
KSWG A 0 ACS_NamedExecuteWithResult("core_chargecolor", COLOR_KINGLYBLADE,TCLR_NONE)
KSWG D 0 A_TakeInventory("WeaponCharge",999)
KSWG D 0 A_PlaySoundEx("Weapon/KinglyBlade","Weapon")
KSWG D 0 A_FireCustomMissile("KinglyBladeA",0,1,8,0)
KSWG BCDEFG 2
KSWG CBA 2 
KSWG A 0 A_Refire
Goto Ready+1
Fire2:
KSWG A 0 ACS_NamedExecuteWithResult("core_chargecolor", COLOR_KINGLYBLADE,TCLR_NONE)
KSWG D 0 A_TakeInventory("WeaponCharge",999)
KSWG D 0 A_JumpIfInventory("KinglyBladeAmmo",5,2)
goto Fire1
KSWG D 0
KSWG D 0 A_TakeInventory("WeaponCharge",999)
KSWG H 0 A_PlaySoundEx("Weapon/KinglyBlade","Weapon")
KSWG H 0 A_TakeInventory("KinglyBladeAmmo",5,TIF_NOTAKEINFINITE)
KSWG H 0 A_FireCustomMissile("KinglyBladeB",0,0,8,0)
KSWG BCHIJK 2
TNT1 A 3
KSWG CBA 2
KSWG AAA 1 A_Refire
Goto Ready+1
Fire3:
KSWG A 0 ACS_NamedExecuteWithResult("core_chargecolor", COLOR_KINGLYBLADE,TCLR_NONE)
KSWG D 0 A_TakeInventory("WeaponCharge",999)
KSWG L 0 A_JumpIfInventory("KinglyBladeAmmo",10,2)
goto Fire2
KSWG L 0
KSWG L 0 A_PlaySoundEx("Weapon/KinglyBlade","Weapon")
KSWG H 0 A_TakeInventory("KinglyBladeAmmo",10,TIF_NOTAKEINFINITE)
KSWG B 2 A_FireCustomMissile("KinglyBladeKing",0,0,8,0)
KSWG CLMNOPQ 2
KSWG CBA 1
KSWG A 5
Goto Ready+1
NoAmmo:
KSWG A 0 ACS_NamedExecuteAlways("core_noammo",0)
Goto Ready+1
}
}

actor KinglyBladeAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 30
+INVENTORY.IGNORESKILL
}

actor KinglyBladeA : BasicProjectile
{
+BRIGHT
PROJECTILE
Obituary "$OB_KINGLYBLADE"
speed 30
Radius 14
Height 21
scale 3.0
damagetype "KinglyBlade"
damage (CallACS("vile_cbm_damage",14))
States
{
Spawn:
TNT1 A 0 A_JumpIfInventory("WeaponCharge",10,"Death")
KBLD I 0 A_PlaySoundEx("Weapon/FireballShot","Weapon")
KBLD IJ 1 
KBLD I 0 A_PlaySoundEx("Weapon/FireballShot","Weapon")
KBLD KL 1 
TNT1 A 0 A_GiveInventory("WeaponCharge",1)
loop
Death:
TNT1 A 0 A_SpawnItemEx("SpurShotFlashyEndStar")
stop
}
}

actor KinglyBladeB : BasicProjectile
{
+BRIGHT
PROJECTILE
+RIPPER
Obituary "$OB_KINGLYBLADE"
speed 28
Radius 21
Height 40
scale 3.0
damagetype "KinglyBlade"
damage (CallACS("vile_cbm_damage",14))
var int user_PierceRipper;
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_GiveInventory("PierceRipperLimit", 3)
Spawn2:
TNT1 A 0 A_JumpIfInventory("WeaponCharge",4,"Death")
KBLD M 0 A_PlaySoundEx("Weapon/KinglyBlade","Weapon")
KBLD MN 2
KBLD O 0 A_PlaySoundEx("Weapon/KinglyBlade","Weapon")
KBLD OP 2
TNT1 A 0 A_GiveInventory("WeaponCharge",1)
loop
Death:
TNT1 A 0 A_SpawnItemEx("SpurShotFlashyEndStar")
stop
}
}


actor KinglyBladeKing : BasicProjectile
{
+BRIGHT
var int user_weaponangle;
PROJECTILE
Obituary "$OB_KINGLYBLADE"
speed 50
Radius 18
Height 24
damagetype "KinglyBlade3"
scale 3.75
damage (CallACS("vile_cbm_damage",15))
States
{
Spawn:
TNT1 A 0 A_JumpIfInventory("WeaponCharge",5,"Death")
TNT1 A 0 A_PlaySoundEx("Weapon/KinglyBlade","Weapon")
KBLD G 2
TNT1 A 1
TNT1 A 0 A_SpawnItemEx("KinglyBladeSlashLeft",0,0,8)
TNT1 A 0 A_PlaySoundEx("Weapon/KinglyBlade","Weapon")
KBLD G 2
TNT1 A 1
TNT1 A 0 A_SpawnItemEx("KinglyBladeSlashRight",0,0,8)
TNT1 A 0 A_GiveInventory("WeaponCharge",1)
loop
XDeath:
TNT1 A 0 A_SpawnItemEx("PropBlowerEffect")
TNT1 A 0 A_JumpIfInventory("Cutterflag",10,"Death")
KBLD H 2 A_Explode(CallACS("vile_cbm_damage",5), 50, 0, 0, 32)
TNT1 A 0 A_PlaySoundEx("Weapon/KinglyBlade","Weapon")
TNT1 AA 0 A_SpawnItemEx("KinglyBladeSlash",random(32,160),0,random(8,64),0,0,0,0+user_weaponangle)
TNT1 A 0 A_SpawnItemEx("KinglyBladeSlash",random(96,128),0,random(18,30),0,0,0,0+user_weaponangle)
TNT1 A 0 A_SpawnItemEx("KinglyBladeSlash",random(64,96),0,random(18,30),0,0,0,60+user_weaponangle)
TNT1 AA 0 A_SpawnItemEx("KinglyBladeSlash",random(32,160),0,random(8,64),0,0,0,120+user_weaponangle)
TNT1 A 0 A_SpawnItemEx("KinglyBladeSlash",random(96,128),0,random(18,30),0,0,0,120+user_weaponangle)
TNT1 A 0 A_SpawnItemEx("KinglyBladeSlash",random(64,96),0,random(18,30),0,0,0,180+user_weaponangle)
TNT1 AA 0 A_SpawnItemEx("KinglyBladeSlash",random(32,160),0,random(8,64),0,0,0,240+user_weaponangle)
TNT1 A 0 A_SpawnItemEx("KinglyBladeSlash",random(96,128),0,random(18,30),0,0,0,240+user_weaponangle)
TNT1 A 0 A_SpawnItemEx("KinglyBladeSlash",random(64,96),0,random(18,30),0,0,0,300+user_weaponangle)
TNT1 A 2 A_Explode(CallACS("vile_cbm_damage",5), 50, 0, 0, 32)
TNT1 A 0 A_PlaySoundEx("Weapon/KinglyBlade","Weapon")
TNT1 AA 0 A_SpawnItemEx("KinglyBladeSlash",random(32,160),0,random(8,64),0,0,0,0+user_weaponangle)
TNT1 A 0 A_SpawnItemEx("KinglyBladeSlash",random(64,96),0,random(18,30),0,0,0,0+user_weaponangle)
TNT1 A 0 A_SpawnItemEx("KinglyBladeSlash",random(96,128),0,random(18,30),0,0,0,60+user_weaponangle)
TNT1 AA 0 A_SpawnItemEx("KinglyBladeSlash",random(32,160),0,random(8,64),0,0,0,120+user_weaponangle)
TNT1 A 0 A_SpawnItemEx("KinglyBladeSlash",random(64,96),0,random(18,30),0,0,0,120+user_weaponangle)
TNT1 A 0 A_SpawnItemEx("KinglyBladeSlash",random(96,128),0,random(18,30),0,0,0,180+user_weaponangle)
TNT1 AA 0 A_SpawnItemEx("KinglyBladeSlash",random(32,160),0,random(8,64),0,0,0,240+user_weaponangle)
TNT1 A 0 A_SpawnItemEx("KinglyBladeSlash",random(64,96),0,random(18,30),0,0,0,240+user_weaponangle)
TNT1 A 0 A_SpawnItemEx("KinglyBladeSlash",random(96,128),0,random(18,30),0,0,0,300+user_weaponangle)
TNT1 A 0 A_SetUserVar(user_weaponangle,user_weaponangle+random(15,30))
TNT1 A 0 A_GiveInventory("Cutterflag",1)
loop
Death:
TNT1 A 0 A_SpawnItemEx("SpurShotFlashyEnd")
stop
}
}

actor KinglyBladeProtection : PowerProtection {powerup.duration 4 damagefactor "KinglyBlade3", 0.0}
 
actor KinglyBladeSlash : BasicProjectile
{
+BRIGHT
var int user_PierceRipper;
PROJECTILE
Obituary "$OB_KINGLYBLADE"
speed 0
Radius 7
Height 14
damagetype "KinglyBlade3"
scale 2.5
+RIPPER
damage (0)
States
{
Spawn:
KBLD A 0 
KBLD A 0 A_Jump(128,"Upside")
Spawn2:
KBLD A 0 A_Jump(128,"Right")
TNT1 A 0 A_PlaySoundEx("Weapon/KinglyBlade","Weapon")
Left:
KBLD ABCDEF 1 A_Explode(CallACS("vile_cbm_damage",7), 50, 0, 0, 32)
stop
Upside:
KBLD A 0 A_SetScale(scalex,-2.5)
goto Spawn2
Right:
KBLD A 0 A_SetScale(-2.5,scaley)
goto Left
}
}
 
actor KinglyBladeSlashLeft : KinglyBladeSlash
{
States
{
Spawn:
KBLD A 0 
TNT1 A 0 A_PlaySoundEx("Weapon/KinglyBlade","Weapon")
KBLD ABCDEF 1 A_Explode(CallACS("vile_cbm_damage",6), 50, 0, 0, 32)
stop
}
}

actor KinglyBladeSlashRight : KinglyBladeSlashLeft
{
xscale -2.5
}
