actor StarCrashWep : BaseMM8BDMWep 10073
{
//$Category MM8BDM-Weapons
//$Title Star Crash
//$Sprite WEA2X0
Weapon.AmmoUse 1
Weapon.AmmoGive 28
Weapon.SlotNumber 7
Inventory.Pickupmessage "$PU_STARCRASH"
Obituary "$OB_STARCRASH"
Tag "$TAG_STARCRASH"
weapon.ammotype "StarCrashAmmo"
inventory.icon "STARSI"

States
{
SpawnLoop:
WEA2 X -1
loop
Ready:
STAA A 0 ACS_ExecuteAlways(998,0,43)
STAA A 0 A_ClearRefire
STAA A 1 A_WeaponReady
Goto Ready+2
Deselect:
STAA A 0 A_JumpIfInventory("ShieldCheck",1,24)
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
STAA A 1 A_Lower
Goto Deselect+1
STAA A 0
STAA A 0 A_TakeInventory("ShieldCheck",1)
STAA A 0 //A_FireCustomMissile("StarCrash",0,0,0,0)
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
Goto Deselect+1
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
STAA A 1 A_Raise
Loop
Fire:
STAA A 0 A_JumpIfInventory("ShieldCheck",1,"ShieldThrow")
STAA A 0 A_JumpIfNoAmmo("NoAmmo")
STAA A 0 //A_TakeInventory("BasicArmor",9999)
STAA A 0 A_TakeInventory("StarCrashAmmo",1,TIF_NOTAKEINFINITE)
STAA A 0 A_PlaySoundEx("weapon/mbuster","Weapon")
STAA A 1 A_GiveInventory("ShieldCheck",1)
goto ShieldActive
ShieldActive:
STAA F 0 A_SpawnItemEx("StarCrashWarper")
//TNT1 A 0 A_GunFlash
STAA A 0 A_GiveInventory("StarCrashThrust",1)
STAA BC 2
TNT1 A 0 A_SpawnItemEx("StarRadius",0,0,28)
STAA A 0 A_GiveInventory("StarCrashThrust",1)
STAA DE 2 
TNT1 A 0 A_SpawnItemEx("StarRadius",0,0,28)
STAA A 0 A_GiveInventory("StarCrashThrust",1)
STAA FG 2 
TNT1 A 0 A_SpawnItemEx("StarRadius",0,0,28)
STAA A 0 A_GiveInventory("StarCrashThrust",1)
STAA H 2
ShieldLoop:
STAA A 0 A_GiveInventory("StarCrashThrust",1)
STAA IIII 1 A_WeaponReady
TNT1 A 0 A_SpawnItemEx("StarRadius",0,0,28)
STAA A 0 A_GiveInventory("StarCrashThrust",1)
STAA IIII 1 A_WeaponReady
TNT1 A 0 A_SpawnItemEx("StarRadius",0,0,28)
TNT1 A 0 A_TakeInventory("StarCrashAmmo",1,TIF_NOTAKEINFINITE)
TNT1 A 0 A_JumpIfNoAmmo("NoAmmo")
loop
ShieldThrow:
STAA A 0 A_TakeInventory("ShieldCheck",999)
STAA A 0 A_PlaySoundEx("weapon/mbuster","Weapon")
STAA I 1 A_FireCustomMissile("StarCrash",0,0,0,0)
STAA JK 1
STAA K 22
STAA J 2
goto Ready+1

//ALTFIRE -- NO GRAVITY THRUST
AltFire:
STAA A 0 A_JumpIfInventory("ShieldCheck",1,"ShieldThrow")
STAA A 0 A_JumpIfNoAmmo("NoAmmo")
STAA A 0 //A_TakeInventory("BasicArmor",9999)
STAA A 0 A_TakeInventory("StarCrashAmmo",1,TIF_NOTAKEINFINITE)
STAA A 0 A_PlaySoundEx("weapon/mbuster","Weapon")
STAA A 1 A_GiveInventory("ShieldCheck",1)
goto AShieldActive
AShieldActive:
STAA F 0 A_SpawnItemEx("StarCrashWarper")
//TNT1 A 0 A_GunFlash
STAA BC 2
TNT1 A 0 A_SpawnItemEx("StarRadius",0,0,28)
STAA DE 2 
TNT1 A 0 A_SpawnItemEx("StarRadius",0,0,28)
STAA FG 2 
TNT1 A 0 A_SpawnItemEx("StarRadius",0,0,28)
STAA H 2
AShieldLoop:
STAA IIII 1 A_WeaponReady
TNT1 A 0 A_SpawnItemEx("StarRadius",0,0,28)
STAA IIII 1 A_WeaponReady
TNT1 A 0 A_SpawnItemEx("StarRadius",0,0,28)
TNT1 A 0 A_TakeInventory("StarCrashAmmo",1,TIF_NOTAKEINFINITE)
TNT1 A 0 A_JumpIfNoAmmo("NoAmmo")
loop

NoAmmo:
STAA A 1 ACS_Execute(979,0)
STAA A 0 A_TakeInventory("ShieldCheck",999)
STAA A 0 A_Refire
goto Ready+1
}
}


actor StarCrashThrust : CustomInventory
{
States
{
Pickup:
TNT1 A 0
TNT1 AAAA 0 A_SpawnItemEx("ProtoMarksmanShotFX", 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, 8, 0, 1)
stop
LG:
TNT1 A 0 ThrustThingZ(0, 2, 0, 1)
stop
End:
TNT1 A 0
stop
}
}

actor StarRadius
{
+DONTSPLASH
+NOGRAVITY
+MISSILE
+SKYEXPLODE
+NOINTERACTION
+NOCLIP
+DONTBLAST
Damagetype "Starcrash"
Obituary "$OB_STARCRASH"
Damage 0
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(17,128,0)
stop
}
}

actor StarCrashWarper : BaseShieldWarper
{
	+BRIGHT
	States
	{
	Shield:
	STAR AABBCCDD 1 A_Warp(AAPTR_TARGET, 0, 0, 16, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
	loop
	}
}

actor StarCrash1
{
scale 2.5
- SOLID
+NOGRAVITY
+DONTSPLASH
+NOTIMEFREEZE
+BRIGHT
States
{
Spawn:
STAR A 1
STAR A 1
stop
}
}

actor StarCrash2 : StarCrash1
{
States
{
Spawn:
STAR B 1
STAR B 1 
stop
}
}

actor StarCrash3 : StarCrash1
{
States
{
Spawn:
STAR C 1
STAR C 1
stop
}
}

actor StarCrash4 : StarCrash1
{
States
{
Spawn:
STAR D 1
STAR D 1
stop
}
}

actor StarCrash
{
scale 2.5
PROJECTILE
+DONTSPLASH
+BRIGHT
Damage (40)
damagetype "StarCrash"
Obituary "$OB_STARCRASH"
Speed 30
Radius 12
Height 12
States
{
Spawn:
STAR EFGH 2
loop
}
}

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