actor HyperBusterUpgrade : BaseMM8BDMBusterUpgrade
{
inventory.amount 1
inventory.maxamount 1
Tag "$TAG_HYPERBUSTER"
inventory.pickupmessage "$PU_HYPERBUSTER"
inventory.icon "HYBUICON"
Inventory.PickupSound "item/1up"
Inventory.RespawnTics 350
scale 2.0
+COUNTITEM
+INVBAR
states
{
SpawnLoop:
HYBU Z 1 
loop
Use:
TRBB I 0 A_PlaySoundEx("item/refill","Voice")
TNT1 A 0 A_GiveInventory("BusterGiven",1)
TRBB I 0 A_GiveInventory("HyperBuster",1)
TRBB I 0 A_SelectWeapon("HyperBuster")
stop
}
}

actor HyperBusterUpgrade_Respawn : 8BDMItemRespawn
{
	translation "192:192=192:192", "198:198=198:198"
	mass 350
}
actor HyperBusterUpgrade_RespawnShadow : 8BDMItemRespawnShadow
{
	mass 350
	States
	{
	Spawn:
		HYBU Z 0
		goto Super::Spawn
	}
}


actor HyperBuster_ScriptBar : ScriptBar{}

actor HyperBuster : BaseMM8BDMWep
{
Weapon.AmmoUse 1
Weapon.AmmoGive 3
Weapon.SlotNumber 1
weapon.ammotype "BusterAmmo"
inventory.icon "NULLICON"
Dropitem ""
Inventory.Pickupmessage "$PU_HYPERBUSTER"
Obituary "$OB_HYPERBUSTER"
Tag "$TAG_HYPERBUSTER"
States
{
SpawnLoop:
HYBU Z 1
stop
Ready:
HYBU A 0 A_JumpIfInventory("BusterGiven",1,"TakeBusters")
Goto Ready2
TakeBusters:
HYBU A 0 A_GiveInventory("TakeBuster", 1)
Goto Ready2
Ready2:
HYBU B 0 ACS_NamedExecuteWithResult("core_weaponcolor",CLR_MEGABUSTER)
HYBU B 0 ACS_NamedExecuteWithResult("core_chargecolor",CLR_MEGABUSTER,TCLR_NONE)
HYBU B 0 A_TakeInventory("WeaponCharge",999)
HYBU B 2 A_WeaponReady
Goto Ready2+2
ReadyC: Goto Ready2+2
Deselect:
HYBU B 0
goto DeselectSwap
Select:
HYBU B 0
goto SelectSwap
AltFire:
HYBU B 0 A_JumpIfInventory("Vile_ClassAltfire", 1, "ClassAltfire")
HYBU B 0 A_JumpIf(CallACS("Vile_class_altfire"), "ClassAltfire")
HYBU B 1 A_JumpIfInventory("MM8BDMPlayer", 1, 1)
wait
ClassAltfire:
HYBU B 0 
goto Super::Altfire
Fire:
HYBU B 0 A_JumpIfNoAmmo("Hold")
HYBU B 0 A_PlaySoundEx("weapons/busters/arrowbusterfire","Weapon")
HYBU B 0 A_FireCustomMissile("MegaShot",0,0,8,0)
HYBU B 1 A_TakeInventory("WeaponCharge",999)
HYBU CD 3
HYBU B 1
HYBU B 0 A_Refire
goto Ready2+2
Fire2:
HYBU B 0 A_TakeInventory("WeaponCharge",999)
HYBU C 0 A_PlaySoundEx("weapons/busters/arrowbusterfire2","Weapon")
HYBU B 1 ACS_NamedExecuteWithResult("core_chargecolor",CLR_MEGABUSTER,TCLR_NONE)
HYBU C 0 A_FireCustomMissile("MidShot",0,0,8,0)
HYBU CD 3
HYBU B 0 A_Refire
goto Ready2+2
Fire3:
HYBU B 0 A_TakeInventory("WeaponCharge",999)
HYBU B 0 A_PlaySoundEx("weapon/napalm","Weapon")
HYBU B 0 
HYBU C 0 ACS_NamedExecuteWithResult("core_chargecolor",CLR_MEGABUSTER,TCLR_NONE)
HYBU C 0 A_FireCustomMissile("HyperChargeShot",0,0,8,0)
HYBU CD 3 
HYBU C 9
HYBU B 0 A_Refire
goto Ready2+2
BotFire:
HYBU B 0 A_Jump(16, "Fire3")
HYBU A 0 A_Refire("Charge2")
Goto Fire3
Hold:
//BUST B 0 A_JumpIfInventory("WeaponCharge",34,"Charge2Start")
HYBU B 0 A_JumpIfInventory("WeaponCharge",18,"Charge")
HYBU B 1 A_GiveInventory("WeaponCharge", 1 + CallACS("core_checkrune", RUNE_RAGE))
HYBU B 0 A_Refire
Goto Ready2+2
Charge:
//HYBU B 0 A_JumpIfInventory("WeaponCharge",34,"Charge2Start")
HYBU B 0 A_JumpIfInventory("WeaponCharge",19,"Charge1")
HYBU B 0 A_PlaySoundEx("weapon/chargeup","Weapon")
Goto Charge1
Charge1:
HYBU B 0 A_JumpIfInventory("WeaponCharge",35,"Charge2Start")
HYBU A 1 ACS_NamedExecuteWithResult("core_chargecolor",CLR_MEGACHARGE1,TCLR_CHARGE1)
HYBU A 0 A_Refire("Charge1.a")
Goto Fire2
Charge1.a:
HYBU B 1 ACS_NamedExecuteWithResult("core_chargecolor",CLR_MEGABUSTER,TCLR_NONE)
HYBU B 0 A_GiveInventory("WeaponCharge", 1 + CallACS("core_checkrune", RUNE_RAGE))
HYBU A 0 A_Refire("Charge1")
Goto Fire2
Charge2Start:
HYBU B 0 A_GunFlash("Sound.BusterCharge", GFF_NOEXTCHANGE)
Goto Charge2
Charge2:
HYBU B 1 ACS_NamedExecuteWithResult("core_chargecolor",CLR_MEGACHARGE2,TCLR_CHARGE2)
HYBU A 0 A_Refire("Charge2.a")
Goto Fire3
Charge2.a:
HYBU I 1 ACS_NamedExecuteWithResult("core_chargecolor",CLR_MEGACHARGE3,TCLR_CHARGE3)
HYBU A 0 A_Refire("Charge2.b")
Goto Fire3
Charge2.b:
HYBU J 1 ACS_NamedExecuteWithResult("core_chargecolor",CLR_MEGABUSTER,TCLR_NONE)
HYBU B 0 A_JumpIfInventory("IsBot", 1, "BotFire")
HYBU B 0 A_JumpIfInventory("WeaponCharge", 35, 2)
HYBU B 0 A_GiveInventory("WeaponCharge", 1 + CallACS("core_checkrune", RUNE_RAGE))
HYBU B 0 A_Refire("Charge2")
Goto Fire3
}
}

actor HyperChargeShot : BasicProjectile
{
+RIPPER
PROJECTILE
damagetype "ChargeShot"
Obituary "$OB_HYPERBUSTER"
Speed 40
Damage (CallACS("vile_cbm_damage",25))
radius 16
height 12
scale 2.5
States
{
Spawn:
HYBU A 0
HYBU EE 0 A_SpawnItemEx("GigaChargeShotFXSP",-8,random(-32,32),random(-32,32))
HYBU E 0 A_SpawnItemEx("BoosterFx",0,0,0,0,cos(pitch)*5.0,-sin(pitch)*5.0,0)
HYBU E 0 A_SpawnItemEx("BoosterFx",0,0,0,0,cos(pitch+180)*5.0,-sin(pitch+180)*5.0,0)
HYBU E 1 A_SetPitch(pitch%360+30)
HYBU EE 0 A_SpawnItemEx("GigaChargeShotFXSP",-8,random(-32,32),random(-32,32))
HYBU E 0 A_SpawnItemEx("BoosterFx",0,0,0,0,cos(pitch)*5.0,-sin(pitch)*5.0,0)
HYBU E 0 A_SpawnItemEx("BoosterFx",0,0,0,0,cos(pitch+180)*5.0,-sin(pitch+180)*5.0,0)
HYBU E 1 A_SetPitch(pitch%360+30)
HYBU FF 0 A_SpawnItemEx("GigaChargeShotFXSP",-8,random(-32,32),random(-32,32))
HYBU E 0 A_SpawnItemEx("BoosterFx",0,0,0,0,cos(pitch)*5.0,-sin(pitch)*5.0,0)
HYBU E 0 A_SpawnItemEx("BoosterFx",0,0,0,0,cos(pitch+180)*5.0,-sin(pitch+180)*5.0,0)
HYBU F 1 A_SetPitch(pitch%360+30)
HYBU FF 0 A_SpawnItemEx("GigaChargeShotFXSP",-8,random(-32,32),random(-32,32))
HYBU E 0 A_SpawnItemEx("BoosterFx",0,0,0,0,cos(pitch)*5.0,-sin(pitch)*5.0,0)
HYBU E 0 A_SpawnItemEx("BoosterFx",0,0,0,0,cos(pitch+180)*5.0,-sin(pitch+180)*5.0,0)
HYBU F 1 A_SetPitch(pitch%360+30)
HYBU GG 0 A_SpawnItemEx("GigaChargeShotFXSP",-8,random(-32,32),random(-32,32))
HYBU E 0 A_SpawnItemEx("BoosterFx",0,0,0,0,cos(pitch)*5.0,-sin(pitch)*5.0,0)
HYBU E 0 A_SpawnItemEx("BoosterFx",0,0,0,0,cos(pitch+180)*5.0,-sin(pitch+180)*5.0,0)
HYBU G 1 A_SetPitch(pitch%360+30)
HYBU GG 0 A_SpawnItemEx("GigaChargeShotFXSP",-8,random(-32,32),random(-32,32))
HYBU E 0 A_SpawnItemEx("BoosterFx",0,0,0,0,cos(pitch)*5.0,-sin(pitch)*5.0,0)
HYBU E 0 A_SpawnItemEx("BoosterFx",0,0,0,0,cos(pitch+180)*5.0,-sin(pitch+180)*5.0,0)
HYBU G 1 A_SetPitch(pitch%360+30)
HYBU HH 0 A_SpawnItemEx("GigaChargeShotFXSP",-8,random(-32,32),random(-32,32))
HYBU E 0 A_SpawnItemEx("BoosterFx",0,0,0,0,cos(pitch)*5.0,-sin(pitch)*5.0,0)
HYBU E 0 A_SpawnItemEx("BoosterFx",0,0,0,0,cos(pitch+180)*5.0,-sin(pitch+180)*5.0,0)
HYBU H 1 A_SetPitch(pitch%360+30)
HYBU HH 0 A_SpawnItemEx("GigaChargeShotFXSP",-8,random(-32,32),random(-32,32))
HYBU E 0 A_SpawnItemEx("BoosterFx",0,0,0,0,cos(pitch)*5.0,-sin(pitch)*5.0,0)
HYBU E 0 A_SpawnItemEx("BoosterFx",0,0,0,0,cos(pitch+180)*5.0,-sin(pitch+180)*5.0,0)
HYBU H 1 A_SetPitch(pitch%360+30)
loop
}
}

actor GigaChargeShotFXSP : BasicGraphicEffect
{
+NOINTERACTION
+NOGRAVITY
+CLIENTSIDEONLY
+FORCEXYBILLBOARD
-SOLID
+BRIGHT
scale 2.5
height 0
radius 0
States
{
SpawnFrame:
HYBU R 0
HYBU RTS 3
Next:
HYBU RTS 3 A_Fadeout(0.1)
loop
}
}
