actor Alien_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_2J"
dropitem "BoobeamBarrierWep"
Weapon.AmmoUse 0
Weapon.AmmoGive 28
Obituary "$OB_ALIENBUSTER"
Inventory.Pickupmessage "I'm not saying its Aliens, but its probably Aliens."
weapon.ammotype "AlienTrapAmmo"
States
{
Spawn:
C_02 J 1
loop

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

Ready:
ALIF A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_ALIEN)
ALIF A 0 A_GunFlash("Flash",1)
goto Ready2
Ready2:
ALIF A 0 A_JumpIfInventory("AlienTrapAmmo",14,"Ready3")
ALIF A 12 A_WeaponReady(WRF_NOSECONDARY)
ALIF A 0 A_GiveInventory("AlienTrapAmmo",2)
loop
Ready3:
ALIF A 12 A_WeaponReady
ALIF A 0 A_GiveInventory("AlienTrapAmmo",2)
loop

Fire:
ALIF B 1 A_GiveInventory("Alien_Fire_P")
ALIF B 2 A_GiveInventory("AlienFiredFlag",1)
ALIF B 3 A_TakeInventory("AlienFiredFlag",1)
ALIF A 6
ALIF A 0 A_GiveInventory("AlienTrapAmmo",1)
Goto Ready2
AltFire:
ALIF B 0 A_PlaySound("weapon/BombThrow",1)
ALIF C 0 A_TakeInventory("AlienTrapAmmo",7)
ALIF B 0 A_TakeInventory("AlienTrapAmmo",7,1)
ALIF C 0 A_FireCustomMissile("AlienBoobeamTrapSpawner",0,0,0,0)
ALIF BCBCB 2
ALIF A 6
Goto Ready2

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

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

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

actor Alien_TrapActive_F : Inventory
{
inventory.amount 1
inventory.maxamount 9999
}

actor AlienFlightFlag : OnceC {}

actor AlienFiredFlag : Powerup
{
Powerup.Duration 8
}

actor AlienFlightItem : BasicClassItem
{
inventory.pickupmessage "Is such a thing even possible? Yes it is."
inventory.icon "ALIFZ"
Tag "Alien Hover Toggle"
states
{
Spawn:
ALIF Z 1
loop
UseCBM:
TNT1 A 0 A_PlaySound("item/ItemUseMM9",7)
TNT1 A 0 A_JumpIfInventory("AlienFlightFlag",1,"Take")
TNT1 A 0 A_GiveInventory("AlienFlightFlag",1)
fail
Take:
TNT1 A 0 A_TakeInventory("AlienFlightFlag",999)
fail
}
}


actor Alien_Fire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySound("weapon/AlienFire",1)
TNT1 A 0 A_FireCustomMissile("AlienShot",0,1,0,0)
TNT1 A 0 A_JumpIfInventory("Alien_TrapActive_F",1,1)
stop
TNT1 A 0 A_GiveInventory("CBM_TargetMarker",1)
stop
}
}
actor Alien_FlashState_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("AlienFlightFlag",1,"FlightCheck")
goto NoFlight

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("Alien_StaminaFlag",10)//20
TNT1 A 0 A_JumpIfInventory("Alien_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("Alien_StaminaFlag",0,"No")
TNT1 A 0 A_JumpIf(z-floorz==0,"Recharge")
TNT1 A 0 A_GiveInventory("Alien_StaminaFlag",1)
stop
Recharge:
TNT1 A 0 A_GiveInventory("Alien_StaminaFlag",4)
stop
No:
TNT1 A 0
stop
}
}


actor AlienShot : ProjSpawnFuncActor
{
PROJECTILE
damagetype "Alien_Shot"
Obituary "$OB_ALIENBUSTER"
+FORCEXYBILLBOARD
+BRIGHT
Damage (90)
radius 12
height 12
Speed 52
scale 2.5
States
{
Spawn:
Q_0D E 1
wait
}
}

actor AlienBoobeamShot : ProjSpawnFuncActor
{
PROJECTILE
damagetype "Alien_BooShot"
Obituary "$OB_ALIENBOOBEAM"
+SKYEXPLODE
+EXPLODEONWATER
+FORCEXYBILLBOARD
+BRIGHT
Damage (90)
radius 12
height 12
Speed 52
scale 2.5
States
{
Spawn:
X_2N G 1
wait

XDeath:
X_2N G 0
stop
Death:
X_2N G 0 A_JumpIf(z-floorz==0,"Floor")
X_2N G 0
stop
Floor:
X_2N G 0 A_SpawnItemEx("AlienBoobeamShotF",0,0,1,50)//,0,0,0,1)
stop
}
}

actor AlienBoobeamShotF : AlienBoobeamShot
{
Damage (70)
States
{
Death:
goto XDeath
}
}

actor AlienBoobeamShotX : AlienBoobeamShot
{
Obituary "$OB_ALIENBOOBEAMX"
+DONTSEEKINVISIBLE//
+SEEKERMISSILE
+SCREENSEEKER
ReactionTime 85
Damage (80)
radius 6
height 6
Speed 35
States
{
Spawn:
X_2N G 0 A_SpawnItemEx("AlienBoobeamShotXFX",0,0,0,0,0,0,0,1)
X_2N GG 1 A_SeekerMissile(0,1,1,88,7)
X_2N G 0 A_CountDown
loop
}
}

actor AlienBoobeamShotXFX : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
States
{
SpawnFrame:
X_2N G 1 A_FadeOut(0.15)
wait
}
}

actor AlienBoobeamTrapSpawner : ProjSpawnFuncActor
{
PROJECTILE
damagetype "Alien_Boobeam"
Obituary "$OB_ALIENBOOBEAMX"
+DONTSPLASH
+DONTREFLECT
+BRIGHT
Damage(150)
Height 10
Radius 10
speed 25
Scale 2.5
States
{
Spawn:
X_2N G 0
X_2N G 4 A_ChangeVelocity(0,0,2)
X_2N G 0 A_ChangeFlag("NOGRAVITY",0)
X_2N G 0 A_GiveInventory("ReSyncPickup")
X_2N G 1
wait
Death:
TNT1 A 0 A_PlaySound("weapon/crashland")
TNT1 A 0 A_JumpIf(z-floorz<5,"Floor")
TNT1 A 0 A_JumpIf(z-ceilingz==0-10,"Ceiling")
TNT1 A 0 A_SpawnItemEx("AlienBoobeamTrap")
XDeath:
TNT1 A 2
stop
Floor:
TNT1 A 0 A_SpawnItemEx("AlienBoobeamTrapF")
goto XDeath
Ceiling:
TNT1 A 0 A_SpawnItemEx("AlienBoobeamTrapC")
goto XDeath
}
}

actor AlienBoobeamTrap : ProjSpawnFuncActor
{
PROJECTILE
damagetype "Alien_Boobeam"
Obituary "$OB_ALIENBOOBEAM"
+NOCLIP
+THRUACTORS
+DONTBLAST
+DONTREFLECT
reactiontime 350
Damage (0)
Radius 9
Height 9
scale 2.5
States
{
Spawn:
X_2N A 3
X_2N A 3 A_GiveToTarget("Alien_TrapActive_F",1)
X_2N FAFAFAFA 3 A_PlaySound("weapon/BoobeamBeep",4)
Goto Waiting
Waiting:
X_2N B 1 A_CountDown
X_2N B 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N B 1 A_CountDown
X_2N B 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N B 1 A_CountDown
X_2N C 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N C 1 A_CountDown
X_2N C 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N C 1 A_CountDown
X_2N C 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N C 1 A_CountDown
X_2N D 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N D 1 A_CountDown
X_2N D 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N D 1 A_CountDown
X_2N D 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N D 1 A_CountDown
X_2N E 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N E 1 A_CountDown
X_2N E 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N E 1 A_CountDown
X_2N E 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N E 1 A_CountDown
X_2N B 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N B 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
loop

Delay1:
X_2N F 1 A_SpawnItemEx("AlienBoobeamTrapX1")
goto FireTime+2
Delay2:
X_2N F 0 A_PlaySound("weapon/BoobeamFlash",1)
X_2N F 2 A_SpawnItemEx("AlienBoobeamTrapX2")
goto FireTime+2
Delay3:
X_2N F 1 A_SpawnItemEx("AlienBoobeamTrapX3")
X_2N F 2 A_PlaySound("weapon/BoobeamFlash",1)
goto FireTime+2
Delay4:
X_2N F 0 A_SpawnItemEx("AlienBoobeamTrapX4")
X_2N FA 2 A_PlaySound("weapon/BoobeamFlash",1)
goto FireTime+2

FireTime:
X_2N F 0 A_Jump(256,1,"Delay1","Delay2","Delay3","Delay4")
X_2N F 0 A_SpawnItemEx("AlienBoobeamTrapX")
X_2N FA 2 A_PlaySound("weapon/BoobeamFlash",1)
X_2N F 1
X_2N F 0
X_2N F 1
X_2N FFFFFFFF 0 A_CountDown
X_2N F 0 A_JumpIfInTargetInventory("PlayerPropertyRage",1,7)
X_2N FFAAAAAA 1 A_CountDown
Goto Waiting

Death:
MMFX B 0 A_TakeFromTarget("Alien_TrapActive_F",1)
MMFX BCDE 2
stop
}
}

actor AlienBoobeamTrapX : BasicImplosion
{
damagetype "Alien_Boobeam"
Obituary "$OB_ALIENBOOBEAM"
Args 0
States
{
Spawn:
TNT1 A 0
TNT1 A 0 ACS_NamedExecuteWithResult("core_aimattargetcursor",CallACS("core_gettarget")+PLN_TARGETPOINT_OFFSET,0)
TNT1 A 0 A_SetTics(Args[0])
TNT1 A 4
TNT1 A 1 ACS_NamedExecuteWithResult("core_aimattargetcursor",CallACS("core_gettarget")+PLN_TARGETPOINT_OFFSET,0)
TNT1 A 0 A_PlaySound("weapon/BoobeamPew",4)
TNT1 A 0 //A_Jump(16,"SpawnX")
TNT1 A 5 A_SpawnItemEx("AlienBoobeamShot",0,0,0,cos(-pitch)*52,0,sin(-pitch)*52,random(-2,2))
stop
SpawnX:
TNT1 A 5 A_SpawnItemEx("AlienBoobeamShotX",0,0,0,cos(-pitch)*52,0,sin(-pitch)*52,random(-2,2))
stop

}
}

actor AlienBoobeamTrapX1 : AlienBoobeamTrapX{Args 1}
actor AlienBoobeamTrapX2 : AlienBoobeamTrapX{Args 2}
actor AlienBoobeamTrapX3 : AlienBoobeamTrapX{Args 3}
actor AlienBoobeamTrapX4 : AlienBoobeamTrapX{Args 4}

actor AlienBoobeamTrapF : AlienBoobeamTrap
{
States
{
Spawn:
X_2N H 3
X_2N H 3 A_GiveToTarget("Alien_TrapActive_F",1)
X_2N LHLHLHLH 3 A_PlaySound("weapon/BoobeamBeep",4)
Goto Waiting
Waiting:
X_2N I 1 A_CountDown
X_2N I 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N I 1 A_CountDown
X_2N I 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N I 1 A_CountDown
X_2N J 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N J 1 A_CountDown
X_2N J 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N J 1 A_CountDown
X_2N J 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N J 1 A_CountDown
X_2N K 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N K 1 A_CountDown
X_2N K 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N K 1 A_CountDown
X_2N K 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N K 1 A_CountDown
X_2N H 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N H 1 A_CountDown
X_2N H 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N H 1 A_CountDown
X_2N H 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N H 1 A_CountDown
X_2N I 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N I 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
loop
Delay1:
X_2N L 1
goto FireTime+2
Delay2:
X_2N L 2 A_PlaySound("weapon/BoobeamFlash",1)
goto FireTime+2
Delay3:
X_2N L 1
X_2N L 2 A_PlaySound("weapon/BoobeamFlash",1)
goto FireTime+2
Delay4:
X_2N LH 2 A_PlaySound("weapon/BoobeamFlash",1)
goto FireTime+2
FireTime:
X_2N L 0 ACS_NamedExecuteWithResult("core_aimattargetcursor",CallACS("core_gettarget")+PLN_TARGETPOINT_OFFSET,10)
X_2N L 0 A_Jump(256,1,"Delay1","Delay2","Delay3","Delay4")
X_2N LH 2 A_PlaySound("weapon/BoobeamFlash",1)
X_2N L 1 ACS_NamedExecuteWithResult("core_aimattargetcursor",CallACS("core_gettarget")+PLN_TARGETPOINT_OFFSET,10)
X_2N L 0 A_PlaySound("weapon/BoobeamPew",4)
X_2N L 0 //A_Jump(16,"FireTimeX")
X_2N L 1 A_SpawnItemEx("AlienBoobeamShot",0,0,10,cos(-pitch)*52,0,sin(-pitch)*52,random(-2,2))
X_2N LLLLLLLL 0 A_CountDown
X_2N L 0 A_JumpIfInTargetInventory("PlayerPropertyRage",1,7)
X_2N LLHHHHHH 1 A_CountDown
goto Waiting
FireTimeX:
X_2N L 1 A_SpawnItemEx("AlienBoobeamShotX",0,0,10,cos(-pitch)*52,0,sin(-pitch)*52,random(-2,2))
goto FireTime+8
}
}

actor AlienBoobeamTrapC : AlienBoobeamTrap
{
States
{
Spawn:
X_2N M 3
X_2N M 3 A_GiveToTarget("Alien_TrapActive_F",1)
X_2N QMQMQMQM 3 A_PlaySound("weapon/BoobeamBeep",4)
Goto Waiting
Waiting:
X_2N N 1 A_CountDown
X_2N N 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N N 1 A_CountDown
X_2N N 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N N 1 A_CountDown
X_2N O 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N O 1 A_CountDown
X_2N O 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N O 1 A_CountDown
X_2N O 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N O 1 A_CountDown
X_2N P 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N P 1 A_CountDown
X_2N P 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N P 1 A_CountDown
X_2N P 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N P 1 A_CountDown
X_2N M 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N M 1 A_CountDown
X_2N M 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N M 1 A_CountDown
X_2N M 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N M 1 A_CountDown
X_2N N 0 A_JumpIfInTargetInventory("AlienFiredFlag",1,"FireTime")
X_2N N 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
loop
Delay1:
X_2N Q 1
goto FireTime+2
Delay2:
X_2N Q 2 A_PlaySound("weapon/BoobeamFlash",1)
goto FireTime+2
Delay3:
X_2N Q 1
X_2N Q 2 A_PlaySound("weapon/BoobeamFlash",1)
goto FireTime+2
Delay4:
X_2N QM 2 A_PlaySound("weapon/BoobeamFlash",1)
goto FireTime+2
FireTime:
X_2N Q 0 ACS_NamedExecuteWithResult("core_aimattargetcursor",CallACS("core_gettarget")+PLN_TARGETPOINT_OFFSET,-8)
X_2N Q 0 A_Jump(256,1,"Delay1","Delay2","Delay3","Delay4")
X_2N QM 2 A_PlaySound("weapon/BoobeamFlash",1)
X_2N Q 1 ACS_NamedExecuteWithResult("core_aimattargetcursor",CallACS("core_gettarget")+PLN_TARGETPOINT_OFFSET,-8)
X_2N Q 0 A_PlaySound("weapon/BoobeamPew",4)
X_2N Q 0 //A_Jump(16,"FireTimeX")
X_2N Q 0 A_SpawnItemEx("AlienBoobeamShot",0,0,-8,cos(-pitch)*52,0,sin(-pitch)*52,random(-2,2))
X_2N QQQQQQQQ 0 A_CountDown
X_2N Q 0 A_JumpIfInTargetInventory("PlayerPropertyRage",1,7)
X_2N QQMMMMMM 1 A_CountDown
goto Waiting
FireTimeX:
X_2N Q 1 A_SpawnItemEx("AlienBoobeamShotX",0,0,-8,cos(-pitch)*52,0,sin(-pitch)*52,random(-2,2))
goto FireTime+8
}
}


actor Alien_W_NormalBar : NormalBar {Args 104,110}
actor Alien_W_ScriptBar : ScriptBar {}