actor Astroman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_8B"
dropitem "CopyVisionWep"
Weapon.AmmoUse 28
Weapon.AmmoGive 28
Weapon.AmmoUse2 56
Weapon.AmmoGive2 0
Obituary "$OB_ASTROCRUSH"
Inventory.Pickupmessage "AAAAAAASTRO CRUSH"
weapon.ammotype "OvercomingShynessAmmo"
weapon.ammotype2 "TellahRecallsMeteoAmmo"
States
{
Spawn:
C_08 B 1
loop

Deselect:
AHUG A 0
goto DeselectSwap
Select:
AHUG A 0
goto SelectSwap

Ready:
AHUG A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_ASTROMAN)
AHUG A 0 A_GunFlash("Flash",1)
AHUG A 0 A_JumpIfInventory("TellahRecallsMeteoAmmo",56,"Ready2")
AHUG A 4 A_WeaponReady(WRF_NOSECONDARY)
AHUG A 0 A_GiveInventory("OvercomingShynessAmmo",1)
AHUG A 0 A_GiveInventory("TellahRecallsMeteoAmmo",1)
Goto Ready+2
Ready2:
AHUG A 4 A_WeaponReady
AHUG A 0 A_GiveInventory("OvercomingShynessAmmo",1)
loop

Fire:
AHUG B 2 A_GiveInventory("Astroman_Fire_P")
AHUG B 2 A_GiveInventory("CBM_TargetMarker",1)
AHUG CC 4
AHUG A 0
goto Ready+2
Altfire:
AHUG B 0 A_JumpIfNoAmmo("NoAmmo")
Meteors:
AHUG B 0 A_TakeInventory("TellahRecallsMeteoAmmo",28)
AHUG B 0 A_TakeInventory("TellahRecallsMeteoAmmo",28,1)
AHUG B 0 A_GiveInventory("VivifyFlag1",1)
AHUG BCDEF 3
TNT1 A 0 A_FireCustomMissile("AstroCrushSpawnerB",0,0,0,0)
TNT1 A 30
AHUG F 0 A_TakeInventory("VivifyFlag1")
AHUG FEDC 3
AHUG B 2
AHUG A 2 Offset(-40,62)
AHUG A 2 Offset(-20,47)
AHUG A 2 Offset(-10,39)
Goto Ready+2
NoAmmo:
AHUG A 0
Goto Ready+2

Flash:
TNT1 AA 1 A_RailWait
TNT1 A 1 A_GiveInventory("AstroM_FlashState_P")
wait
}
}

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

actor TellahRecallsMeteoAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 56
+INVENTORY.IGNORESKILL
}

actor AstroM_StaminaFlag : Inventory
{
inventory.amount 1
inventory.maxamount 500
}

actor AstroFlight : OnceC{}

actor AstroFlightItem : BasicClassItem
{
inventory.pickupmessage "Oh, how did you find me? I feel so embarrassed!"
inventory.icon "AstIcon"
Tag "Astro Hover Toggle"
states
{
Spawn:
AHUG Z 1
loop
UseCBM:
TNT1 A 0 A_PlaySoundEx("item/ItemUseMM9","SoundSlot7")
TNT1 A 0 A_JumpIfInventory("AstroFlight",1,"Take")
TNT1 A 0 A_GiveInventory("AstroFlight",1)
fail
Take:
TNT1 A 0 A_TakeInventory("AstroFlight",999)
fail
}
}

actor Astroman_Fire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/mbuster","Weapon")
TNT1 A 0 A_FireCustomMissile("CopyShot_Astro",0,0,0,0)
TNT1 A 0 A_GiveInventory("TellahRecallsMeteoAmmo",2)
TNT1 A 0 A_JumpIfInventory("OvercomingShynessAmmo",28,2)
TNT1 A 0 A_GiveInventory("OvercomingShynessAmmo",2)
stop
TNT1 A 0 A_TakeInventory("OvercomingShynessAmmo",14,1)
TNT1 A 0 A_TakeInventory("OvercomingShynessAmmo",14)
TNT1 A 0 A_SpawnItemEx("CopyVision_Astro_H")
stop
}
}

actor AstroM_FlashState_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("VivifyFlag1",1,"YesFlightStop")
TNT1 A 0 A_JumpIfInventory("AstroFlight",1,"FlightCheck")
goto NoFlight
YesFlightStop://Astro using Altfire
TNT1 A 0 A_Stop
goto MaybeFlightYes
FlightCheck:
TNT1 A 0 A_JumpIf(CallACS("cbm_checkDamagingPit"),"MaybeFlight")//core_checkPit
TNT1 A 0 A_JumpIf(z-floorz>=160,"NoFlight")
YesFlight:
TNT1 A 1 A_GiveInventory("CBM_AviationOn_P")
goto RechargeCheck

MaybeFlight:
TNT1 A 0 A_JumpIf(z-floorz>=160,4)
TNT1 A 0 A_GiveInventory("PowerStaminaFlagDeplete")
TNT1 A 0 A_TakeInventory("AstroM_StaminaFlag",10)//20
TNT1 A 0 A_JumpIfInventory("AstroM_StaminaFlag",1,"MaybeFlightYes")
TNT1 A 1 A_GiveInventory("CBM_AviationOff_P")
stop
MaybeFlightYes:
TNT1 A 1 A_GiveInventory("CBM_AviationOn_P")
stop

NoFlight:
//TNT1 A 0 A_JumpIfInventory("PlayerPropertyFlight",1,"RechargeCheck")
TNT1 A 1 A_GiveInventory("CBM_AviationOff_P")
goto RechargeCheck
RechargeCheck:
TNT1 A 0 A_JumpIfInventory("AstroM_StaminaFlag",0,"No")
TNT1 A 0 A_JumpIf(z-floorz==0,"Recharge")
TNT1 A 0 A_GiveInventory("AstroM_StaminaFlag",1)
stop
Recharge:
TNT1 A 0 A_GiveInventory("AstroM_StaminaFlag",4)
stop
No:
TNT1 A 0
stop
}
}



actor CopyVision_Astro_H : BasicExplosion
{
RenderStyle None
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_JumpIfInTargetInventory("PlayerPropertySpread",1,2)
TNT1 A 0 A_SpawnItemEx("CopyVision_Astro")
stop
TNT1 A 0 A_SpawnItemEx("CopyVision_Astro_Spread")
stop
}
}

actor CopyVision_Astro : ProjSpawnFuncActor
{
PROJECTILE
obituary "$OB_COPYVISION"
DamageType "AstroM_Shot"
+DONTBLAST
+RIPPER
+NOGRAVITY
+THRUGHOST
+DONTREFLECT
+BRIGHT
/*
-NOBLOCKMAP
-SHOOTABLE
+DONTRIP
health 99990
mass 0x7ffffffff
painchance 256
*/
reactiontime 18
damage(0)
Radius 12
Height 42
speed 0.01
scale 2.5
States
{
Spawn:
TNT1 A 0
AHUG Y 0 A_PlaySoundEx("weapon/copyvision","weapon")
AHUG Y 0 ACS_NamedExecuteWithResult("core_copytranslation")
AHUG Y 0 ACS_NamedExecuteWithResult("core_aimattargetcursor",CallACS("core_gettarget")+PLN_TARGETPOINT_OFFSET,32)
Shooting:
AHUG Y 1 A_JumpIfInTargetInventory("PlayerPropertyRage",1,4)
TNT1 A 1
AHUG Y 1
TNT1 A 1
AHUG Y 1
TNT1 A 1
AHUG Y 1 A_JumpIfInTargetInventory("PlayerPropertyRage",1,2)
TNT1 A 1
AHUG Y 1
TNT1 A 1
AHUG Y 1 ACS_NamedExecuteWithResult("core_aimattargetcursor",CallACS("core_gettarget")+PLN_TARGETPOINT_OFFSET,32)
TNT1 A 1
AHUG Y 0 A_PlaySoundEx("weapon/mbuster","Weapon")
AHUG Y 0 A_SpawnItemEx("CopyShotClone",cos(-pitch)*8,0,32+(sin(-pitch)*8),cos(-pitch)*26,0,sin(-pitch)*26,0,1)
AHUG Y 0 A_Countdown
AHUG Y 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
loop

Death:
TNT1 A 6
Stop
}
}

actor CopyVision_Astro_Spread : CopyVision_Astro
{
States
{
Spawn:
TNT1 A 0
AHUG Y 0 A_PlaySoundEx("weapon/copyvision","weapon")
AHUG Y 0 ACS_NamedExecuteWithResult("core_copytranslation")
AHUG Y 0 ACS_NamedExecuteWithResult("core_aimattargetcursor",CallACS("core_gettarget")+PLN_TARGETPOINT_OFFSET,32)
Shooting:
AHUG Y 1 A_JumpIfInTargetInventory("PlayerPropertyRage",1,4)
TNT1 A 1
AHUG Y 1
TNT1 A 1
AHUG Y 1
TNT1 A 1
AHUG Y 1 A_JumpIfInTargetInventory("PlayerPropertyRage",1,2)
TNT1 A 1
AHUG Y 1
TNT1 A 1
AHUG Y 1 ACS_NamedExecuteWithResult("core_aimattargetcursor",CallACS("core_gettarget")+PLN_TARGETPOINT_OFFSET,32)
TNT1 A 1
AHUG Y 0 A_PlaySoundEx("weapon/mbuster","Weapon")
AHUG Y 0 A_SpawnItemEx("CopyShotClone",cos(-pitch)*8,0,32+(sin(-pitch)*8),cos(-pitch)*26,0,sin(-pitch)*26,0,1)
AHUG Y 0 A_SpawnItemEx("CopyShotClone",cos(-pitch)*8,0,32+(sin(-pitch)*8),cos(-pitch)*26,0,sin(-pitch)*26,15,1)
AHUG Y 0 A_SpawnItemEx("CopyShotClone",cos(-pitch)*8,0,32+(sin(-pitch)*8),cos(-pitch)*26,0,sin(-pitch)*26,-15,1)
AHUG Y 0 A_Countdown
AHUG Y 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
loop
}
}

actor CopyVision_Astro2 : CopyVision_Astro
{
reactiontime 1
States
{
Spawn:
AHUG Y 0
goto CopyVision_Astro2::Spawn+2
}
}

actor CopyShot_Astro : ProjSpawnFuncActor
{
PROJECTILE
Obituary "$OB_ASTROSHOT"
DamageType "AstroM_Shot"
+FORCEXYBILLBOARD
+BRIGHT
Damage (100)
radius 10
height 10
Speed 26
scale 2.5
States
{
Spawn:
AHUG GHI 2 A_SpawnItemEx("CopyShot_AstroFX",0,0,0,0,0,0,0,1)
loop
Death:
TNT1 A 0 
stop
}
}

actor CopyShot_AstroFX : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
States
{
SpawnFrame:
TNT1 A 1
AHUG JKLM 2
stop
}
}

actor CopyShotClone : CopyShot_Astro
{
obituary "$OB_COPYVISION"
DamageType "AstroM_CloneShot"
Damage (80)
States
{
Spawn:
TNT1 A 1
Spawn2:
AHUG GHI 2 A_SpawnItemEx("CopyShot_AstroFX",0,0,0,0,0,0,0,1)
loop
}
}

actor AstroCrushSpawnerB : BasicHelper
{
Translation "198:198=128:128"
ReactionTime 10
States
{
Spawn:
TNT1 A 0
TNT1 AA 1 A_SpawnItemEx("AstroCrushB",random(300,-300),random(256,-256),320,0,0,random(-20,-22),0)
TNT1 A 1 A_CountDown
loop
}
}

actor AstroCrushB : ProjSpawnFuncActor
{
PROJECTILE
Damagetype "AstroM_Meteor"
Obituary "$OB_ASTROCRUSH"//Astro Crash
+RIPPER
+NOINTERACTION
+DONTBLAST
+DONTREFLECT
+BRIGHT
Reactiontime 40
Damage (60)
Radius 24
Height 12
Speed 1
Scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0
AHUG NNNOOOPPP 1 A_JumpIf(ceilingz-z>13,"Spawn2")
AHUG N 0 A_JumpIf(momz==0,"Death")
AHUG N 0 A_CountDown
Goto Spawn+2
Spawn2:
AHUG N 0 A_ChangeFlag("RIPPER",0)
AHUG N 0 A_ChangeFlag("NOINTERACTION",0)
AHUG NOP 3
AHUG N 0 A_JumpIf(momz==0,"Death")
AHUG N 0 A_CountDown
Goto Spawn2+2
Death:
TNT1 A 0 A_PlaySoundEx("weapon/AstroM_ACrush","Weapon")//weapon/AstroACrush
TNT1 A 0 A_Explode(320,160,0)//240 128//
TNT1 A 0 A_SpawnItemEx("AstroM_CrusherFX",0,0,0,0,0,0,0,1+32)
TNT1 A 2
stop
}
}
actor AstroM_CrusherFX : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
Scale 3.0
States
{
SpawnFrame:
AHUG QRSTUV 2
stop
}
}



actor Astroman_W_NormalBar : NormalBar {Args 201,110}
actor Astroman_W_SecondBar : SecondBar {Args 229,128}
actor Astroman_W_ScriptBar : ScriptBar {}