actor Ballade_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_KC"
dropitem "BalladeCrackerWep"
Weapon.AmmoUse 0
Weapon.AmmoUse2 1
Weapon.AmmoGive2 3
Obituary "$OB_BALLADECRACKERC"
Inventory.Pickupmessage "Power up! Ballade Cracker!"
weapon.ammotype "InsertBalladeJokeHereAmmo"
weapon.ammotype2 "BalladeMineAmmo"
States
{
Spawn:
C_0K C 1
loop

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

Ready:
BLLD A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_BALLADE)
BLLD A 0 A_GunFlash("Flash",1)
goto Ready1
Ready1:
BLLD A 0 A_JumpIfNoAmmo("Ready2")
BLLD A 1 A_WeaponReady
wait
Ready2:
BLLD A 1 A_WeaponReady(8)
BLLD A 0 A_JumpIfNoAmmo("Ready2")
goto Ready1

Fire:
BLLD A 0 A_JumpIfInventory("IsBot",1,"BotFire")
BLLD D 0 A_GunFlash("NoFlash",1)
BLLD F 0 A_GiveInventory("Ballade_Fire_P")
BLLD BCDEFG 2
BLLD A 9
BLLD AA 4 A_TakeInventory("BalladeFocusFlag")
Goto Ready+1

Flash:
TNT1 A 2
TNT1 A 0 A_GiveInventory("BalladeFocusFlag",1)
loop

AltFire:
BLLD A 0 A_JumpIfNoAmmo("NoAmmo")
BLLD A 0 A_GiveInventory("VivifyDelay8",1)
BLLD A 0 A_Refire(1)
BLLD A 2 OffSet(-10,52)
BLLD H 2 OffSet(-1,33)
BLLD H 2 OffSet(-21,57)
BLLD H 2 OffSet(-33,67)
BLLD H 0 A_GiveInventory("Ballade_AltFireCheck_P")
BLLD H 0 A_GiveInventory("BalladeMineThrust_P",1)
BLLD H 2 OffSet(-21,57)
BLLD H 2 OffSet(-1,33)
BLLD A 2 OffSet(-10,52)
goto Ready1
NoAmmo:
BLLD A 0 A_GiveInventory("Ballade_NoAmmoRefund_P")
Goto Ready1

BotFire:
BLLD A 0 A_Jump(64,"BotFire2")
BLLD A 0 A_Jump(192,2)
BLLD A 0 A_GiveInventory("BalladeFocusFlag",random(1,30))
goto Fire+1
BLLD A 0 A_Jump(128,2)
BLLD A 0 A_GiveInventory("BalladeFocusFlag",random(8,20))
goto Fire+1
BLLD A 0 A_Jump(64,2)
BLLD A 0 A_GiveInventory("BalladeFocusFlag",random(16,30))
goto Fire+1
BLLD A 0 A_Jump(32,2)
BLLD A 0 A_GiveInventory("BalladeFocusFlag",random(19,37))
goto Fire+1
BLLD A 0 A_GiveInventory("BalladeFocusFlag",30)
goto Fire+1
BotFire2:
goto AltFire+1

}
}

actor InsertBalladeJokeHereAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 3
+INVENTORY.IGNORESKILL
}
actor BalladeMineAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 3
+INVENTORY.IGNORESKILL
}

actor BalladeFocusFlag : Inventory
{
inventory.amount 1
inventory.maxamount 30
}

actor Ballade_NoAmmoHelpF : Inventory
{
inventory.amount 1
inventory.maxamount 3
}

actor BalladeMineDelay1 : Powerup
{
Powerup.Duration 35
}
actor BalladeMineDelay2 : BalladeMineDelay1 {}
actor BalladeMineDelay3 : BalladeMineDelay1 {}
actor BalladeMineDelay4 : BalladeMineDelay1 {}
actor BalladeMineDelay5 : BalladeMineDelay1 {}

actor BalladeMineThrust_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0
TNT1 A 0 A_Recoil(-15)
TNT1 A 0 A_JumpIfInventory("PlayerPropertyGrounded",1,"No")
goto PickupT
PickupT:
TNT1 A 0 A_JumpIfInventory("BalladeMineDelay5",1,"P_5")
TNT1 A 0 A_JumpIfInventory("BalladeMineDelay4",1,"P_4")
TNT1 A 0 A_JumpIfInventory("BalladeMineDelay3",1,"P_3")
TNT1 A 0 A_JumpIfInventory("BalladeMineDelay2",1,"P_2")
TNT1 A 0 A_JumpIfInventory("BalladeMineDelay1",1,"P_1")
goto P_0
P_30:
TNT1 A 0 A_JumpIfInventory("IsUnderWater",1,"P_30W")
TNT1 A 0 ThrustThingZ(0,30,0,0)
stop
P_30W:
TNT1 A 0 ThrustThingZ(0,16,0,0)
stop
P_0:
TNT1 A 0 A_GiveInventory("BalladeMineDelay1",1)
goto P_30
P_1:
TNT1 A 0 A_GiveInventory("BalladeMineDelay2",1)
goto P_30
P_2:
TNT1 A 0 A_GiveInventory("BalladeMineDelay3",1)
goto P_30
P_3:
TNT1 A 0 A_GiveInventory("BalladeMineDelay4",1)
goto P_30
P_4:
TNT1 A 0 A_GiveInventory("BalladeMineDelay5",1)
goto P_30
P_5:
TNT1 A 0 A_GiveInventory("BalladeMineDelay5",1)
TNT1 A 0 ThrustThingZ(0,4,0,0)
stop
No:
TNT1 A 0
stop
}
}

actor Ballade_NoAmmoRefund_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("Ballade_NoAmmoHelpF",1,3)
TNT1 A 0 A_GiveInventory("BalladeMineAmmo",3)
TNT1 A 0 A_PlaySoundEx("item/RaThorSoul","Body")
TNT1 A 0
stop
}
}


actor Ballade_AltFireCheck_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("BalladeMineAmmo",3,"Check3")
TNT1 A 0 A_JumpIfInventory("BalladeMineAmmo",2,"Check2")
TNT1 A 0 A_JumpIfInventory("BalladeMineAmmo",1,"Check1")
goto FireMine2
Check3:
TNT1 A 0 A_TakeInventory("BalladeMineAmmo",1,1)
TNT1 A 0 A_JumpIfInventory("BalladeMineAmmo",3,"FireMine2")
TNT1 A 0 A_SpawnItemEx("Ballade_BCMineEmergency3")
goto FireMine
Check2:
TNT1 A 0 A_TakeInventory("BalladeMineAmmo",1,1)
TNT1 A 0 A_JumpIfInventory("BalladeMineAmmo",2,"FireMine2")
TNT1 A 0 A_SpawnItemEx("Ballade_BCMineEmergency2")
goto FireMine
Check1:
TNT1 A 0 A_TakeInventory("BalladeMineAmmo",1,1)
TNT1 A 0 A_JumpIfInventory("BalladeMineAmmo",1,"FireMine2")
TNT1 A 0 A_SpawnItemEx("Ballade_BCMineEmergency1")
goto FireMine
FireMine:
TNT1 A 0 A_GiveInventory("Ballade_NoAmmoHelpF")
TNT1 A 0 A_SpawnItemEx("Ballade_BCMine",0,0,16)
stop
FireMine2:
TNT1 A 0 A_SpawnItemEx("Ballade_BCMine2",0,0,16)
stop
}
}

actor Ballade_Fire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/crackerthrow","Weapon")
TNT1 A 0 A_JumpIfInventory("BalladeFocusFlag",30,"Fire4")
TNT1 A 0 A_JumpIfInventory("BalladeFocusFlag",20,"Fire3")
TNT1 A 0 A_JumpIfInventory("BalladeFocusFlag",10,"Fire2")
TNT1 A 0 A_FireCustomMissile("Ballade_BCShot",0,0,8,0)
goto End
Fire2:
TNT1 A 0 A_FireCustomMissile("Ballade_BCShot2",0,0,8,0)
goto End
Fire3:
TNT1 A 0 A_FireCustomMissile("Ballade_BCShot3",0,0,8,0)
goto End
Fire4:
TNT1 A 0 A_FireCustomMissile("Ballade_BCShot4",0,0,8,0)
goto End
End:
TNT1 A 0 A_TakeInventory("BalladeFocusFlag")
stop
}
}

actor Ballade_BCShot : ProjSpawnFuncActor
{
PROJECTILE
damagetype "Ballade_Shot"
Obituary "$OB_BALLADECRACKER"
+SKYEXPLODE
+EXPLODEONWATER
Accuracy 4
damage (120)
Radius 9
Height 17
speed 20
scale 2.5
States
{
Spawn:
TNT1 A 0
goto Spawn4
Spawn1:
TNT1 A 0 A_Jump(256,1,2,3,4)
BALA ABCD 1
goto Spawn1+1
Spawn2:
TNT1 A 0 A_Jump(256,1,2,3,4)
BALA ABCD 2
goto Spawn2+1
Spawn3:
TNT1 A 0 A_Jump(256,1,2,3,4)
BALA ABCD 3
goto Spawn3+1
Spawn4:
TNT1 A 0 A_Jump(256,1,2,3,4)
BALA ABCD 4
goto Spawn4+1
Death:
TNT1 A 0 A_PlaySoundEx("weapon/crackerexplode","Weapon")
TNT1 A 0 A_Explode(160,96,0,0,10)
TNT1 A 0 A_SpawnItemEx("BasicBoom5FX_4_210",0,0,0,0,0,0,0,1)
TNT1 A 2
stop
}
}

actor Ballade_BCShot2 : Ballade_BCShot
{
Speed 35
Accuracy 3
States
{
Spawn:
TNT1 A 0
goto Spawn3
}
}

actor Ballade_BCShot3 : Ballade_BCShot
{
Speed 50
Accuracy 2
States
{
Spawn:
TNT1 A 0
goto Spawn2
}
}

actor Ballade_BCShot4 : Ballade_BCShot
{
Speed 65
Accuracy 1
States
{
Spawn:
TNT1 A 0
goto Spawn1
}
}

actor Ballade_BCMineEmergency3 : BasicHelper
{
+SERVERSIDEONLY
//RenderStyle Normal
ReactionTime 150
Scale 2.5
Args 150
States
{
Spawn:
TNT1 A 0 A_SetArg(0,150)
SpawnL:
TNT1 A 0 A_JumpIfInTargetInventory("BalladeMineAmmo",3,"End")
TNT1 A 0 A_CountDownArg(0)
ENKR H 1 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"End")
TNT1 A 0 A_JumpIfInTargetInventory("BalladeMineAmmo",2,"SpawnL")
SpawnWait:
ENKR A 1 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"End")
TNT1 A 0 A_JumpIfInTargetInventory("BalladeMineAmmo",2,"Spawn")
loop
End:
QUIN F 5 A_TakeFromTarget("Ballade_NoAmmoHelpF",1)
stop
Death:
TNT1 A 0 A_TakeFromTarget("Ballade_NoAmmoHelpF",1)
RATH H 5 A_GiveToTarget("BalladeMineAmmo",1)
stop
}
}
actor Ballade_BCMineEmergency2 : Ballade_BCMineEmergency3
{
States
{
Spawn:
TNT1 A 0 A_SetArg(0,150)
SpawnL:
TNT1 A 0 A_JumpIfInTargetInventory("BalladeMineAmmo",2,"End")
TNT1 A 0 A_CountDownArg(0)
PUNK H 1 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"End")
TNT1 A 0 A_JumpIfInTargetInventory("BalladeMineAmmo",1,"SpawnL")
SpawnWait:
PUNK A 1 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"End")
TNT1 A 0 A_JumpIfInTargetInventory("BalladeMineAmmo",1,"Spawn")
loop
}
}
actor Ballade_BCMineEmergency1 : Ballade_BCMineEmergency3
{
States
{
Spawn:
TNT1 A 0
SpawnL:
TNT1 A 0 A_JumpIfInTargetInventory("BalladeMineAmmo",1,"End")
TNT1 A 0 A_CountDownArg(0)
BALD H 1 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"End")
loop
}
}

actor Ballade_BCMine : ProjSpawnFuncActor
{
PROJECTILE
damagetype "Ballade_Mine"
Obituary "$OB_BALLADEMINE"
-NOGRAVITY
+NOEXPLODEFLOOR
+DONTSPLASH
+SKYEXPLODE
+EXPLODEONWATER
ReactionTime 10
Damage (100+CallACS("core_checkrune",RUNE_SPREAD,2)*200)
Radius 20
Height 20
Speed 0
Scale 2.5
States
{
Spawn:
BLLD V 0
BLLD V 0 A_PlaySoundEx("weapon/crackermine", "Weapon")
SpawnL:
BLLD V 0 A_JumpIf(ReactionTime<=4,"SpawnLow")
BLLD VWXY 3
BLLD V 0 A_CountDown
loop
SpawnLow:
BLLD V 0 A_JumpIf(ReactionTime<=1,"SpawnLower")
BLLD RVVSWWTXXUYY 1
BLLD V 0 A_CountDown
loop
SpawnLower:
BLLD RVRWSWTXTYUY 1
BLLD V 0 A_CountDown
loop

Death:
TNT1 A 1 A_SpawnItemEx("Ballade_BCMineBoom",0,0,10)
TNT1 A 2 A_GiveToTarget("BalladeMineAmmo",1)//A_TakeFromTarget("BalladeMineFlag",1)
stop
}
}
actor Ballade_BCMineBoom : BasicExplosion
{
damagetype "Ballade_Mine"
Obituary "$OB_BALLADEMINE"
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Explode(100+CallACS("core_checkrune",RUNE_SPREAD,2)*200,96,0,0,8)
TNT1 A 0 A_PlaySoundEx("weapon/GameBoyBallade","Weapon")
TNT1 A 0 A_SpawnItemEx("BasicBoom5FX_4_210",0,0,0,0,0,0,0,1)
TNT1 A 2
stop
}
}
actor Ballade_BCMine2 : Ballade_BCMine
{
States
{
Death:
TNT1 A 1 A_SpawnItemEx("Ballade_BCMineBoom",0,0,10)
TNT1 A 2
stop
}
}

//actor Ballade_W_NormalBar : NormalBar {Args 64,62}
actor Ballade_W_ScriptBar : ScriptBar {}