actor StarFlowWep_NormalBar : NormalBar{args 36, 221}
actor StarFlowWep_ScriptBar : ScriptBar {}

actor StarFlowWep : BaseMM8BDMWep
{
Weapon.AmmoUse 1
Weapon.AmmoGive 28
Weapon.SlotNumber 7
Inventory.Pickupmessage "$PU_STARFLOW"
Obituary "$OB_STARFLOW"
Tag "$TAG_STARFLOW"
weapon.ammotype "StarFlowAmmo"
inventory.icon "STAFICON"
States
{
SpawnLoop:
STAF Z -1
loop
Ready:
STAF A 0 ACS_NamedExecuteWithResult("core_weaponcolor",COLOR_STARFLOW)
STAF A 0 A_ClearRefire
STAF A 1 A_WeaponReady
Goto Ready+2
ReadyC: Goto Ready+2
Deselect:
STAF A 0 A_JumpIfInventory("ShieldCheck",1,1)
goto DeselectSwap
STAF A 0 A_TakeInventory("ShieldCheck",1)
goto DeselectSwap
Select:
STAF A 0
goto SelectSwap
Fire:
STAF A 0 A_JumpIfInventory("ShieldCheck",1,"ShieldThrow")
STAF A 0 A_JumpIfNoAmmo("NoAmmo")
STAF A 0 //A_TakeInventory("BasicArmor",9999)
STAF A 0 A_TakeInventory("StarFlowAmmo",1,TIF_NOTAKEINFINITE)
STAF A 0 A_PlaySoundEx("weapon/mbuster","Weapon")
STAF A 1 A_GiveInventory("ShieldCheck",1)
goto ShieldActive
ShieldActive:
STAF F 0 A_SpawnItemEx("StarFlowWarper")
//TNT1 A 0 A_GunFlash
STAF A 0 A_GiveInventory("StarFlowThrust",1)
STAF BC 2
TNT1 A 0 A_SpawnItemEx("StarFlowRadius",0,0,28)
STAF A 0 A_GiveInventory("StarFlowThrust",1)
STAF DE 2 
TNT1 A 0 A_SpawnItemEx("StarFlowRadius",0,0,28)
STAF A 0 A_GiveInventory("StarFlowThrust",1)
STAF FG 2 
TNT1 A 0 A_SpawnItemEx("StarFlowRadius",0,0,28)
STAF A 0 A_GiveInventory("StarFlowThrust",1)
STAF H 2
ShieldLoop:
STAF A 0 A_GiveInventory("StarFlowThrust",1)
STAF IIII 1 A_WeaponReady
TNT1 A 0 A_SpawnItemEx("StarFlowRadius",0,0,28)
STAF A 0 A_GiveInventory("StarFlowThrust",1)
STAF IIII 1 A_WeaponReady
TNT1 A 0 A_SpawnItemEx("StarFlowRadius",0,0,28)
TNT1 A 0 A_TakeInventory("StarFlowAmmo",1,TIF_NOTAKEINFINITE)
TNT1 A 0 A_JumpIfNoAmmo("NoAmmo")
loop
ShieldThrow:
STAF A 0 A_TakeInventory("ShieldCheck",999)
STAF A 0 A_PlaySoundEx("weapon/mbuster","Weapon")
STAF I 1 A_FireCustomMissile("StarFlow",0,0,0,0)
STAF JK 1
STAF K 22
STAF J 2
goto Ready+1
NoAmmo:
STAF A 1 ACS_NamedExecute("core_noammo",0)
STAF A 0 A_TakeInventory("ShieldCheck",999)
STAF A 0 A_Refire
goto Ready+1
AltFire:
STAF A 0 A_JumpIfInventory("ShieldCheck", 1, 3)
STAF A 0 A_JumpIfInventory("Vile_ClassAltfire", 1, "ClassAltfire")
STAF A 0 A_JumpIf(CallACS("Vile_class_altfire"), "ClassAltfire")
STAF A 1 A_JumpIfInventory("MM8BDMPlayer", 1, "Fire")
wait
ClassAltfire:
STAF A 0 
goto Super::Altfire
}
}


actor StarFlowThrust : CustomInventory
{
States
{
Pickup:
TNT1 A 0
TNT1 AAAA 0 A_SpawnItemEx("GigaChargeShotFXSP", random(-64,64), frandom(-64, 64), frandom(8, 48),0,0,0,0,1)
TNT1 A 0 A_JumpIf(z-floorz<5, "End")
TNT1 A 0 A_JumpIfInventory("HasFeetInWater",1,"LG")
TNT1 A 0 A_JumpIfInventory("IsUnderwater",1,"LG")
TNT1 A 0 ThrustThingZ(0, 7, 0, 1)
stop
LG:
TNT1 A 0 ThrustThingZ(0, 2, 0, 1)
stop
End:
TNT1 A 0
stop
}
}

actor StarFlowRadius : BasicExplosion
{
+DONTSPLASH
+NOGRAVITY
+MISSILE
+SKYEXPLODE
+NOINTERACTION
+NOCLIP
+DONTBLAST
Damagetype "StarFlow"
Obituary "$OB_STARFLOW"
Damage 0
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(CallACS("vile_cbm_damage",12),128,0)
stop
}
}

actor StarFlowWarper : BaseShieldWarper
{
	translation "229:229=36:36", "220:220=221:221"
	+BRIGHT
	States
	{
	Shield:
	STAR ABCD 1 A_Warp(AAPTR_TARGET, 0, 0, 16, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
	loop
	}
}

actor StarFlow1 : BasicGraphicEffect
{
translation "229:229=36:36", "220:220=221:221"
scale 2.5
- SOLID
+NOGRAVITY
+DONTSPLASH
+NOTIMEFREEZE
+BRIGHT
States
{
Spawn:
STAR A 1
STAR A 1
stop
}
}

actor StarFlow2 : StarFlow1
{
States
{
Spawn:
STAR B 1
STAR B 1 
stop
}
}

actor StarFlow3 : StarFlow1
{
States
{
Spawn:
STAR C 1
STAR C 1
stop
}
}

actor StarFlow4 : StarFlow1
{
States
{
Spawn:
STAR D 1
STAR D 1
stop
}
}

actor StarFlow : BasicProjectile
{
-NOGRAVITY
+HEXENBOUNCE
-BOUNCEONWALLS
bouncefactor 1.0
gravity 1.5
translation "229:229=36:36", "220:220=221:221"
+DONTSPLASH
+BRIGHT
Damage (CallACS("vile_cbm_damage",35))
damagetype "StarFlow"
Obituary "$OB_STARFLOW"
Speed 35
Radius 12
Height 12
States
{
Spawn:
STAR E 0
STAR E 0 ACS_NamedExecuteWithResult("core_changeClientProperty", APROP_Speed, 3932160, AAPTR_TARGET) // 60 * 65536
TNT1 A 0 ThrustThingZ(0, 10, 0, 1)
SpawnLoop:
STAR EFGH 1
loop
}
}

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