actor RollingBurnoutWep_NormalBar : NormalBar { args 219, 249 }
actor RollingBurnoutWep_ScriptBar : ScriptBar {}

actor RollingBurnoutWep : BaseMM8BDMWep
{
Weapon.AmmoUse 3
Weapon.AmmoGive 30
Weapon.SlotNumber 5
Inventory.Pickupmessage "$PU_ROLLINGBURNOUT"
Obituary "$OB_ROLLINGBURNOUT"
Tag "$TAG_ROLLINGBURNOUT"
weapon.ammotype "RollingBurnoutAmmo"
inventory.icon "RBRNICON"
+WEAPON.AMMO_OPTIONAL
States
{
SpawnLoop:
RBRN Z 1
loop
Ready:
RBRN A 0 ACS_NamedExecuteWithResult("core_weaponcolor",CLR_ROLLINGBURNOUT)
RBRN A 1 A_WeaponReady
Goto Ready+1
ReadyC: Goto Ready+1
Deselect:
RBRN A 0
goto DeselectSwap
Select:
RBRN A 0
goto SelectSwap

Fire:
RBRN A 0 A_JumpIfNoAmmo("NoAmmo")
RBRN A 1
RBRN A 0 A_Refire("Hold")
RBRN H 0 A_GiveInventory("RollingBurnoutFlag",12)
Goto Fire1
Hold:
RBRN A 0 A_JumpIfInventory("RollingBurnoutAmmo", 4, "Hold2")
goto NoAmmo
Hold2:
RBRN A 0 A_JumpIfInventory("WeaponCharge",18,"Charge")
RBRN A 1 A_GiveInventory("WeaponCharge", 1 + CallACS("core_checkrune", RUNE_RAGE))
RBRN A 0 A_Refire
RBRN H 0 A_GiveInventory("RollingBurnoutFlag",12)
Goto Fire1
Charge:
RBRN A 0 A_JumpIfInventory("WeaponCharge",19,"Charge1")
RBRN A 0 A_PlaySoundEx("weapon/coilstart","Weapon")
Goto Charge1
Charge1:
RBRN I 0 A_JumpIfInventory("WeaponCharge",35,"Charge2Start")
RBRN I 1 ACS_NamedExecuteWithResult("core_chargecolor", CLR_ROLLINGBURNOUTCHG1,TCLR_CHARGE1)
RBRN I 0 A_Refire("Charge1.a")
RBRN H 0 A_GiveInventory("RollingBurnoutLevel",2)
RBRN H 0 A_GiveInventory("RollingBurnoutFlag",18)
Goto Fire2
Charge1.a:
RBRN A 1 ACS_NamedExecuteWithResult("core_chargecolor", CLR_ROLLINGBURNOUT,TCLR_NONE)
RBRN A 0 A_GiveInventory("WeaponCharge", 1 + CallACS("core_checkrune", RUNE_RAGE))
RBRN A 0 A_Refire("Charge1")
RBRN H 0 A_GiveInventory("RollingBurnoutLevel",2)
RBRN H 0 A_GiveInventory("RollingBurnoutFlag",18)
Goto Fire2
Charge2Start:
RBRN A 0 A_GunFlash("Sound.BusterCharge", GFF_NOEXTCHANGE)
Goto Charge2
Charge2:
RBRN J 1 ACS_NamedExecuteWithResult("core_chargecolor", CLR_ROLLINGBURNOUTCHG2,TCLR_CHARGE2)
RBRN J 0 A_Refire("Charge2.a")
RBRN H 0 A_GiveInventory("RollingBurnoutLevel",3)
RBRN H 0 A_GiveInventory("RollingBurnoutFlag",24)
Goto Fire3
Charge2.a:
RBRN K 1 ACS_NamedExecuteWithResult("core_chargecolor", CLR_ROLLINGBURNOUTCHG3,TCLR_CHARGE3)
RBRN K 0 A_Refire("Charge2.b")
RBRN H 0 A_GiveInventory("RollingBurnoutLevel",3)
RBRN H 0 A_GiveInventory("RollingBurnoutFlag",24)
Goto Fire3
Charge2.b:
RBRN A 1 ACS_NamedExecuteWithResult("core_chargecolor", CLR_ROLLINGBURNOUT,TCLR_NONE)
RBRN A 0 A_JumpIfInventory("WeaponCharge", 35, 2)
RBRN A 0 A_GiveInventory("WeaponCharge", 1 + CallACS("core_checkrune", RUNE_RAGE))
RBRN A 0 A_Refire("Charge2")
RBRN H 0 A_GiveInventory("RollingBurnoutLevel",3)
RBRN H 0 A_GiveInventory("RollingBurnoutFlag",24)
Goto Fire3

Fire2:
RBRN A 0 A_JumpIfInventory("RollingBurnoutAmmo", 6, "Fire1")
RBRN H 0 A_TakeInventory("RollingBurnoutFlag",999)
RBRN H 0 A_TakeInventory("RollingBurnoutLevel",999)
RBRN H 0 A_GiveInventory("RollingBurnoutFlag",12)
goto Fire2
Fire3:
RBRN A 0 A_JumpIfInventory("RollingBurnoutAmmo", 10, "Fire1")
RBRN H 0 A_TakeInventory("RollingBurnoutFlag",999)
RBRN H 0 A_TakeInventory("RollingBurnoutLevel",999)
RBRN H 0 A_GiveInventory("RollingBurnoutFlag",18)
RBRN H 0 A_GiveInventory("RollingBurnoutLevel",2)
goto Fire1
Fire1:
RBRN A 0 A_TakeInventory("WeaponCharge",999)
RBRN A 0 ACS_NamedExecuteWithResult("core_chargecolor", CLR_ROLLINGBURNOUT,TCLR_NONE)
TNT1 A 0 A_JumpIfNoAmmo("NoAmmo")
TNT1 A 0 A_JumpIf(floorz-z<-9,"Grounding")
FireContinued:
RBRN H 0 A_GiveInventory("RollingBurnoutAmmoTake_P",1)
RBRN H 0 A_PlaySoundEx("weapons/mmqg/rollingburnoutdash1","Weapon")
RBRN H 0 ACS_NamedExecuteAlways("core_freezeplayer",0,0,1)
RBRN ABCDEF 1
RBRN H 0 ACS_NamedExecuteAlways("core_unsolidplayer",0,0,USP_TOGGLEON)
goto Burning
Grounding:
RBRN G 0 ThrustThingZ(0,6,1,1)
RBRN G 1 A_JumpIf(CallACS("core_CheckFooting"),"FireContinued")
loop
Burning:
RBRN H 0 A_GunFlash
TNT1 A 0 A_JumpIfInventory("RollingBurnoutLevel",3,"Level3")
BurningLoop:
RBRN F 1 A_ChangeVelocity(26, 0, 0, CVF_RELATIVE|CVF_REPLACE)
RBRN F 0 A_TakeInventory("RollingBurnoutFlag",1)
RBRN F 0 A_JumpIfInventory("RollingBurnoutFlag",1,"BurningLoop")
RBRN F 1 A_Jump(256, "End")
wait
Level3:
RBRN H 0 A_GiveInventory("RollingBurningIt",1)
RBRN H 0 A_PlaySoundEx("weapons/mmqg/rollingburnoutdash2","Weapon")
RBRN L 0 ACS_NamedExecuteWithResult("core_chargecolor", CLR_ROLLINGBURNOUTBRN1,TINT_ROLLINGBURNOUTBRN1)
RBRN L 1 A_ChangeVelocity(33, 0, 0, CVF_RELATIVE|CVF_REPLACE)
RBRN L 0 A_TakeInventory("RollingBurnoutFlag",1)
RBRN L 0 A_JumpIfInventory("RollingBurnoutFlag",1,"Level3.b")
RBRN L 1 A_Jump(256, "End")
wait
Level3.b:
RBRN M 0 ACS_NamedExecuteWithResult("core_chargecolor", CLR_ROLLINGBURNOUTBRN2,TINT_ROLLINGBURNOUTBRN2)
RBRN M 1 A_ChangeVelocity(33, 0, 0, CVF_RELATIVE|CVF_REPLACE)
RBRN M 0 A_TakeInventory("RollingBurnoutFlag",1)
RBRN M 0 A_JumpIfInventory("RollingBurnoutFlag",1,"Level3.c")
RBRN M 1 A_Jump(256, "End")
wait
Level3.c:
RBRN N 0 ACS_NamedExecuteWithResult("core_chargecolor", CLR_ROLLINGBURNOUTBRN3,TINT_ROLLINGBURNOUTBRN3)
RBRN N 1 A_ChangeVelocity(33, 0, 0, CVF_RELATIVE|CVF_REPLACE)
RBRN N 0 A_TakeInventory("RollingBurnoutFlag",1)
RBRN N 0 A_JumpIfInventory("RollingBurnoutFlag",1,"Level3")
RBRN N 1 A_Jump(256, "End")
wait

End:
RBRN A 0 ACS_NamedExecuteWithResult("core_chargecolor", CLR_ROLLINGBURNOUT,TCLR_NONE)
RBRN H 0 A_GiveInventory("RollingBurnoutEnd",1)
RBRN H 0 A_TakeInventory("RollingBurningIt",1)
RBRN H 0 ACS_NamedExecuteAlways("core_freezeplayer",0,0,0)
RBRN H 0 ACS_NamedExecuteAlways("core_unsolidplayer",0,0,USP_TOGGLEOFF_DAMAGE,ACS_NamedExecuteWithResult("core_getmaxhealth")/10)
RBRN H 0 A_TakeInventory("RollingBurnoutFlag",999)
RBRN H 0 A_TakeInventory("RollingBurnoutLevel",999)
RBRN H 0 A_ScaleVelocity(0.25)
RBRN FEDCBGH 3
Goto Ready+1
NoAmmo:
RBRN A 1 ACS_NamedExecuteAlways("core_noammo",0)
Goto Ready+1
Flash:
TNT1 AAA 0 A_SpawnItemEx("RollingBurnoutSmoke",random(-48,48),random(-48,48),random(-12,64),momx/4,momy/4,momz/4,0,SXF_ABSOLUTEMOMENTUM|SXF_NOCHECKPOSITION|SXF_TRANSFERTRANSLATION)
TNT1 A 1 A_GiveInventory("RollingBurnout_P",1)
TNT1 A 0 A_JumpIfInventory("RollingBurnoutEnd",1,"NoFlash")
loop
NoFlash:
TNT1 A 0 A_TakeInventory("RollingBurnoutEnd",999)
stop
}
}

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

actor RollingBurningIt : Once {}
actor RollingBurnoutFlag : CutterFlag {}
actor RollingBurnoutLevel : CutterFlag {}
actor RollingBurnoutEnd : PowerUp {Powerup.Duration 5}
actor RollingBurnoutTrail_C : PowerUp {Powerup.Duration 2}

actor RollingBurnout : BasicProjectile
{
Obituary "$OB_ROLLINGBURNOUT"
Radius 38
Height 38
+RIPPER
Damage (CallACS("mmqg_cbm_damage",12))
+DONTBLAST
damagetype "RollingBurnout"
Speed 15
States
{
Spawn:
TNT1 F 0 A_SpawnItemEx("OilPitIgnite")
TNT1 AAA 3
stop
}
}

actor RollingBurnout2 : RollingBurnout {Damage (CallACS("mmqg_cbm_damage",14))}
actor RollingBurnout3 : RollingBurnout {Damage (CallACS("mmqg_cbm_damage",17))}

actor RollingBurnoutTrail : BasicProjectile
{
Obituary "$OB_ROLLINGBURNOUT"
Damage (CallACS("mmqg_cbm_damage",12))
+RIPPER
+FLOORHUGGER
damagetype "RollingBurnoutTrail"
Radius 24
Height 16
states
{
Spawn:
TNT1 A 0
RBRN TUTUTUTUV 2
stop
}
}

actor RollingBurnoutTrailCharged : RollingBurnoutTrail
{
Damage (CallACS("mmqg_cbm_damage",15))
scale 3.0
states
{
Spawn:
TNT1 A 0
RBRN TUTUTUTUTUTUTUTUV 2
stop
}
}

actor RollingBurnoutSmoke : BasicGraphicEffect
{
States
{
SpawnFrame:
RBRN W 0 ACS_NamedExecuteWithResult("core_changeClientProperty", APROP_Alpha, 19660, AAPTR_TARGET) // 0.3 * 65536
RBRN W 0 A_Jump(256,1,2,3,4)
RBRN WXWXWX 2
RBRN WXWXW 2 A_FadeOut(0.2)
TNT1 A 2
stop
}
}

actor RollingBurnout_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("RollingBurnoutLevel",3,"Level3")
TNT1 A 0 A_JumpIfInventory("RollingBurnoutLevel",2,"Level2")
TNT1 A 0 A_SpawnItemEx("RollingBurnout",60,0,40,0,0,0,0,1)
goto AttackEnd
Level2:
TNT1 A 0 A_SpawnItemEx("RollingBurnout2",60,0,40,0,0,0,0,1)
goto AttackEnd
Level3:
TNT1 A 0 A_SpawnItemEx("RollingBurnout3",60,0,40,0,0,0,0,1)
goto AttackEnd

AttackEnd:
TNT1 A 0 A_JumpIfInventory("RollingBurnoutTrail_C",1,"End")
goto Trail
End:
TNT1 A 0
stop
Trail:
TNT1 A 0 A_JumpIfInventory("RollingBurnoutLevel",3,"Trail3")
TNT1 A 0 A_SpawnItemEx("RollingBurnoutTrail")
TNT1 A 0 A_JumpIf(CallACS("core_checkrune", RUNE_SPREAD),"End")
TNT1 A 0 A_GiveInventory("RollingBurnoutTrail_C",1)
stop
Trail3:
TNT1 A 0 A_SpawnItemEx("RollingBurnoutTrailCharged")
TNT1 A 0 A_JumpIf(CallACS("core_checkrune", RUNE_SPREAD),"End")
TNT1 A 0 A_GiveInventory("RollingBurnoutTrail_C",1)
stop
}
}

actor RollingBurnoutAmmoTake_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("RollingBurnoutLevel",3,"Level3")
TNT1 A 0 A_JumpIfInventory("RollingBurnoutLevel",2,"Level2")
TNT1 A 0 A_TakeInventory("RollingBurnoutAmmo",3,TIF_NOTAKEINFINITE)
goto Trail
Level2:
TNT1 A 0 A_TakeInventory("RollingBurnoutAmmo",6,TIF_NOTAKEINFINITE)
stop
Level3:
TNT1 A 0 A_TakeInventory("RollingBurnoutAmmo",10,TIF_NOTAKEINFINITE)
stop
}
}

actor RollingBurnoutProtect : PowerProtection {Powerup.Duration 7 damagefactor "RollingBurnout", 0.0}
actor RollingBurnoutTrailProtect : PowerProtection {Powerup.Duration 8 damagefactor "RollingBurnoutTrail", 0.0}