actor ElementSuperchargeWep_NormalBar : NormalBar{args 100,70}
actor ElementSuperchargeWep_ScriptBar : ScriptBar{}

actor ElementSuperchargeWep : BaseMM8BDMWep 
{
Weapon.AmmoUse 4
Weapon.AmmoGive 28
Weapon.SlotNumber 2
Inventory.Pickupmessage "$PU_ELEMENTSUPERCHARGE"
Obituary "$OB_ELEMENTSUPERCHARGE"
Tag "$TAG_ELEMENTSUPERCHARGE"
weapon.ammotype "ElementSuperchargeAmmo"
inventory.icon "ELSGICON"
States
{
SpawnLoop:
ELSG Z 1
loop
Ready:
ELSG A 0 ACS_NamedExecuteWithResult("core_weaponcolor",COLOR_ELEMENTSUPERCHARGE)
ReadyX:
ELSG A 0 A_JumpIfInventory("WeaponCharge",50,"Ready1")
ELSG A 0 A_GiveInventory("WeaponCharge",1)
ELSG A 1 A_WeaponReady
ELSG A 0 A_JumpIfNoAmmo("ReadyX")
loop
ReadyC: Goto ReadyX
Ready1:
ELSG A 0 A_PlaySoundEx("weapon/tenorcharge1","Weapon")
Ready2:
ELSG D 0 ACS_NamedExecuteWithResult("core_weaponcolor",COLOR_ELEMENTSUPERCHARGE2,1)
ELSG DDD 1 A_WeaponReady
ELSG A 0 ACS_NamedExecuteWithResult("core_weaponcolor",COLOR_ELEMENTSUPERCHARGE,1)
ELSG AAA 1 A_WeaponReady
goto Ready2
Deselect:
ELSG A 0 A_TakeInventory("WeaponCharge",99999)
ELSG A 0 
goto DeselectSwap
Select:
ELSG A 0 A_TakeInventory("WeaponCharge",99999)
ELSG A 0 
goto SelectSwap
Fire:
ELSG A 0 A_JumpIfNoAmmo("NoAmmo")
ELSG A 0 A_JumpIfInventory("WeaponCharge", 50, "Fire2")
ELSG A 0 A_JumpIfInventory("ElementSuperchargeAmmo", 1, "FireR")
goto NoAmmo
Altfire:
ELSG A 0 A_TakeInventory("WeaponCharge",999)
ELSG A 0 ACS_NamedExecuteWithResult("core_weaponcolor",COLOR_ELEMENTSUPERCHARGE,1)
ELSG A 0 A_JumpIfInventory("Vile_ClassAltfire", 1, "ClassAltfire")
ELSG A 0 A_JumpIf(CallACS("Vile_class_altfire"), "ClassAltfire")
ELSG A 1 A_JumpIfInventory("MM8BDMPlayer", 1, "FireR")
wait
ClassAltfire:
ELSG A 0 
goto Super::Altfire
FireR:
ELSG A 0 A_TakeInventory("WeaponCharge",999)
ELSG A 0 A_PlaySoundEx("weapon/mbuster","Weapon")
ELSG A 0 A_FireCustomMissile("MegaShot",0,0,8,0)
ELSG A 0 ACS_NamedExecuteWithResult("core_weaponcolor",COLOR_ELEMENTSUPERCHARGE,1)
ELSG BC 2
ELSG A 3
ELSG A 0 //A_JumpIfInventory("ElementSuperchargeAmmo", 3, "Hold")
ELSG A 0 A_Refire
goto Ready+1
Fire2:
ELSG A 0 A_TakeInventory("WeaponCharge",999)
ELSG A 0 A_PlaySoundEx("weapon/napalm","Weapon")
ELSG A 1 ACS_NamedExecuteWithResult("core_weaponcolor",COLOR_ELEMENTSUPERCHARGE,1)
ELSG A 0 A_TakeInventory("ElementSuperchargeAmmo",4,TIF_NOTAKEINFINITE)
ELSG A 0 A_FireCustomMissile("ElementSuperchargeChargeShot",0,0,8,0)
ELS0 ABCDEF 1
ELSG A 15
ELSG B 0 A_Refire
goto Ready+1
NoAmmo:
ELSG A 0
goto Altfire
}
}

actor ElementSuperchargeAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 28
+INVENTORY.IGNORESKILL
}

actor ElementSuperchargeChargeShot : BasicProjectile
{
+BRIGHT
PROJECTILE
+SEEKERMISSILE
-EXTREMEDEATH
+HEXENBOUNCE
bouncefactor 0.5
wallbouncefactor 0.5
damagetype "ElementSupercharge"
Obituary "$OB_ELEMENTSUPERCHARGE"
Speed 1
var int user_orbdamage;
Damage (CallACS("vile_cbm_damage",55-user_orbdamage))
radius 16
height 12
scale 2.0
reactiontime 30
States
{
Spawn:
ELCG A 0
ELCG A 0 ACS_NamedExecuteAlways("core_targetyawpitch", 0, 0) // Set the starting pitch
ELCG A 2 A_SetUserVar("user_orbdamage",0)
ELCG D 0 A_ChangeVelocity(cos(pitch)*46, 0, sin(-pitch)*46, CVF_RELATIVE|CVF_REPLACE)
ELCG ABCA 3
ELCG B 0 A_Stop
ELCG EFDE 3
ELCG B 0 A_PlaySoundEx("weapon/napalm","Weapon")
ELCG C 0 A_SetUserVar("user_orbdamage",10)
ELCG CCC 1 A_SeekerMissile (80, 90, SMF_LOOK|SMF_PRECISE, 256, 800)
ELCG C 1 ACS_NamedExecuteAlways("core_lookatptr", 0, AAPTR_TRACER) 

ELCG D 0 A_ChangeVelocity(cos(pitch)*46, 0, sin(-pitch)*46, CVF_RELATIVE|CVF_REPLACE)
ELCG BCAB 3
ELCG C 0 A_Stop
ELCG FDEF 3 
ELCG C 0 A_SetUserVar("user_orbdamage",25)
ELCG C 0 A_PlaySoundEx("weapon/napalm","Weapon")
ELCG AAA 1 A_SeekerMissile (80, 90, SMF_LOOK|SMF_PRECISE, 256, 800)//A_ChangeVelocity(Cos(pitch)*35,0,sin(pitch)*25,CVF_RELATIVE)
ELCG A 1 ACS_NamedExecuteAlways("core_lookatptr", 0, AAPTR_TRACER) 
ELCG D 0 A_ChangeVelocity(cos(pitch)*46, 0, sin(-pitch)*46, CVF_RELATIVE|CVF_REPLACE)
OngoingLoop:
ELCG A 0 A_Changeflag("HEXENBOUNCE",0)
ELCG B 0 //A_ChangeVelocity(Cos(pitch)*35,0,sin(pitch)*25,CVF_RELATIVE)
ELCG BCA 4 A_Countdown
loop
Death:
MMFX A 0 A_PlaySoundEx("weapon/drillexplode", "Weapon")
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,0,0,7,0)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,0,0,-7,0)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,10,0,0,0)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,10,0,0,45)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,10,0,0,90)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,10,0,0,135)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,10,0,0,180)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,10,0,0,225)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,10,0,0,270)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,10,0,0,315)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,5,0,5,0)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,5,0,5,45)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,5,0,5,90)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,5,0,5,135)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,5,0,5,180)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,5,0,5,225)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,5,0,5,270)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,5,0,5,315)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,5,0,-5,0)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,5,0,-5,45)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,5,0,-5,90)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,5,0,-5,135)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,5,0,-5,180)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,5,0,-5,225)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,5,0,-5,270)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,2,5,0,-5,315)
MMFX FGHI 3 A_Stop
stop
Explode:
MMFX A 0 A_PlaySoundEx("weapon/drillexplode", "Weapon")
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,0,0,7,0)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,0,0,-7,0)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,10,0,0,0)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,10,0,0,45)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,10,0,0,90)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,10,0,0,135)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,10,0,0,180)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,10,0,0,225)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,10,0,0,270)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,10,0,0,315)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,5,0,5,0)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,5,0,5,45)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,5,0,5,90)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,5,0,5,135)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,5,0,5,180)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,5,0,5,225)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,5,0,5,270)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,5,0,5,315)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,5,0,-5,0)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,5,0,-5,45)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,5,0,-5,90)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,5,0,-5,135)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,5,0,-5,180)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,5,0,-5,225)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,5,0,-5,270)
MMFX A 0 A_SpawnItemEx("ElementBurstShot",0,0,-8,5,0,-5,315)
MMFX FGHI 3 A_Stop
stop
XDeath:
TNT1 A 0
stop
}
}

actor ElementBurstShot : BasicProjectile
{
PROJECTILE
damagetype "ElementSupercharge"
Obituary "$OB_ELEMENTSUPERCHARGE"
Radius 6
Height 6
Damage (CallACS("vile_cbm_damage",4))
Speed 50
scale 2.5
reactiontime 25
States
{
Spawn:
MMFX F 0 
MMFX FGHI 3
stop
}
}