ACTOR NoMusicEnragedLegendaryStealthTrooper
{ 
Health 650 //Nerf Health For Balance
Radius 20
Height 56
Speed 12
Mass 100
PainChance 25
PainChance "ZombieDemonTech", 0
BloodColor "Red"
DropItem "LegendaryBossLifeEssence" 256
DropItem "LegendaryBossArmorBonusMax" 256
DropItem "LegendaryBossLifeEssence" 128
DropItem "LegendaryBossArmorBonusMax" 128
DropItem "EnragedLegendaryArmor" 80 1
DamageType "Legendary"
DamageFactor "PDTBFG", 0.20
DamageFactor "PDTBFGTracer", 0.20
DamageFactor "PlayerDevBall", 0.120
DamageFactor "PlayerDevBall2", 0.120
DamageFactor "PlayerDTBFGRailgunSlug", 0.120
DamageFactor "PlayerDevTracer", 0.120
DamageFactor "Legendary", 0.0
DamageFactor "LegendaryPlayer", 0.3
DamageFactor "LegendaryGuru", 0.0
DamageFactor "LegendaryGuruPlayer", 0.3
DamageFactor "LACGrenade", 0.0
DamageFactor "LegendaryZombie", 0.0
DamageFactor "GeneralTracer", 0.0
DamageFactor "DBFG10K2", 0.65
DamageFactor "PlayerDBFG10K2", 0.65
DamageFactor "DBFG2", 0.65
DamageFactor "PlayerDBFG2", 0.65
DamageFactor "PlayerDTRG", 0.5
DamageFactor "CerChainguns", 0.0
DamageFactor 0.65
DamageFactor "Legendary", 0.0
DamageFactor "LegendaryPlayer", 0.0
DamageFactor "LACGrenade", 0.0
MONSTER
SeeSound "ELEGCommando/See"
PainSound "ELEGCommando/pain"
DeathSound "ELEGCommando/death"
ActiveSound "ELEGCommando/active"
Obituary "%o didn't see the hail of bullets coming from an Enraged Legendary Stealth Trooper."
Tag "\c[m6]Enraged\c- \c[z3]Legendary Stealth Trooper Summoning\c-"
+NOTIMEFREEZE
+BOSS
+BOSSDEATH
+FLOORCLIP
+MISSILEMORE
+MISSILEEVENMORE
+QUICKTORETALIATE
+NOICEDEATH
+NODROPOFF
+DONTGIB
+NOTARGET
+NORADIUSDMG
+NOFEAR
+NOKILLSCRIPTS
+BRIGHT
var int user_protection;
var int user_protected;
var int user_TurretUse;
var int user_SniperLoopStart;
var int user_SniperLoop;
var int user_SniperAttack;
States 
{
  Spawn:
    TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
    ECMD A 10 A_Look
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	ECMD "Z" 10 A_Look
    Loop
  See:
    TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
    ECMD A 0 A_JumpIfTargetInLOS("Strafing")
    ECMD AA 3 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	ECMD BB 3 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItem("LegendaryFootStep")
	ECMD A 0 A_JumpIfTargetInLOS("Strafing")
	ECMD CC 3 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	ECMD DD 3 A_Chase
	TNT1 A 0 A_Jump(80,"Phase")
	ECMD A 0 A_Jump(80,"Rush")
    TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItem("LegendaryFootStep")
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")	
    Loop
  Rush:
    ECMD A 0 A_JumpIfTargetInLOS("Strafing")
	TNT1 A 0 A_SpawnItem("LegendaryFootStep")
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItemEx("EnragedLegStealthGhostA")
	ECMD A 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("EnragedLegStealthGhostA")
	ECMD A 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("EnragedLegStealthGhostB")
	ECMD B 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("EnragedLegStealthGhostB")
	ECMD B 1 A_Chase
	TNT1 A 0 A_Jump(80,"Phase")
	TNT1 A 0 A_SpawnItem("LegendaryFootStep")
    TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItemEx("EnragedLegStealthGhostC")
	ECMD C 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("EnragedLegStealthGhostC")
	ECMD C 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("EnragedLegStealthGhostD")
	ECMD D 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("EnragedLegStealthGhostD")
	ECMD D 1 A_Chase
	TNT1 A 0 A_SpawnItem("LegendaryFootStep")
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_Jump(84,"See")
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	Loop
  Strafing:
	TNT1 A 0 A_SpawnItem("LegendaryFootStep")
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
	ECMD AA 3 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
	ECMD BB 3 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_SpawnItem("LegendaryFootStep")
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
    ECMD CC 3 A_GiveInventory("LegZombieStrafingg",1)	
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
	ECMD DD 3 A_GiveInventory("LegZombieStrafingg",1)
	Goto See
  Phase:
	TNT1 A 0 A_PlaySound("phaseimp/teleport")
	ECMD E 2 A_FaceTarget
	ECMD E 1 A_SetTranslucent(0.75)
	ECMD E 1 A_SetTranslucent(0.55)
	ECMD E 1 A_SetTranslucent(0.35)
	ECMD E 1 A_SetTranslucent(0.20)
	Goto Phased
  UnPhase:
	TNT1 A 0 A_PlaySound("phaseimp/teleport")
	ECMD E 1 A_SetTranslucent(0.15)
	ECMD E 1 A_SetTranslucent(0.35)
	ECMD E 1 A_SetTranslucent(0.55)
	ECMD E 1 A_SetTranslucent(0.75)
	TNT1 A 0 A_SetTranslucent(1)
	ECMD E 2 A_FaceTarget
    Goto See	
  Phased:
	ECMP AABBCCDDAABBCCDDAABBCCDDAABBCCDD 1 A_ExtChase(0,0)
	ECMP AABBCCDDAABBCCDD 1 A_Chase
	TNT1 A 0 A_Jump(24,"UnPhase")
	Goto Phased+32	
  Pause:
	ECMD EEEEE 3 A_GiveInventory("LegZombieStrafingg",1)
	Goto See	
  Missile:
    TNT1 A 0 A_SetUserVar(user_SniperLoop,0)
	TNT1 A 0 A_SetUserVar(user_SniperAttack,0)
    ECMD E 10 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("ELegAK47Ammo", 92, "Reload")
	TNT1 A 0 A_CustomMissile("LegendaryRedTracer",Random(28,34),0,Random(6,-6),0)
	TNT1 A 0 A_GiveInventory ("ELegAK47Ammo", 1)
	TNT1 A 0 A_SpawnItemEx("ELegRifleCasing", 12, -6, 36, Random(2, 6), 0, Random(1, 3), Random(-80, -90), 128)
	TNT1 A 0 A_CustomBulletAttack(42.5,14,1,Random(10,20)*3,"EnragedBulletPuff")
	ECMD F 0 A_PlaySoundEx("weapons/LMGFire","Weapon")
	ECMD F 3 A_GiveInventory("LegZombieStrafingg",1)	
	TNT1 A 0 A_CustomMissile("LegendaryRedTracer",Random(28,34),0,Random(6,-6),0)
	TNT1 A 0 A_GiveInventory ("ELegAK47Ammo", 1)
	TNT1 A 0 A_SpawnItemEx("ELegRifleCasing", 12, -6, 36, Random(2, 6), 0, Random(1, 3), Random(-80, -90), 128)
	TNT1 A 0 A_CustomBulletAttack(32.1,12,1,Random(16,30)*3,"EnragedBulletPuff")
	ECMD F 0 A_PlaySoundEx("weapons/LMGFire","Weapon")
	ECMD F 3 A_GiveInventory("LegZombieStrafingg",1)	
    TNT1 A 0 A_CPosRefire
	TNT1 A 0 A_Jump(12,"Turrets")
	TNT1 A 0 A_Jump(2,"Pause")
	TNT1 A 0 A_Jump(8,"Nade")
	TNT1 A 0 A_Jump(18,"Sniper")
    Goto Missile+3
  Nade:
    ECMD E 1 A_JumpIfCloser(1000,1)
	Goto Missile
	ECMD E 0 A_JumpIfCloser(280,"Missile")
    ECMD E 6 A_GiveInventory("LegZombieStrafingg",1)
    ECMD EEE 4 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_GiveInventory("LegZombieStrafingg",1)
    ECMD E 6 A_CustomMissile("ELegStealthTrooperNade",32,0,0,2,10)
	ECMD E 1
	Goto See
  Turrets:
    TNT1 A 0 A_JumpIf(user_TurretUse == 1,"Sniper")
	TNT1 A 0 A_PlaySound("ELegCommando/Star",0,1,0,ATTN_NONE)
	ECMD C 8 A_SpawnItem("EnragedHellionSmokeSpawner")
	ECMD E 3 A_CustomMissile("ELTurretSpawner",32,0,25,0,15)
	ECMD C 3 A_CustomMissile("ELTurretSpawner",32,0,-25,0,15)
	ECMD E 3 A_CustomMissile("ELTurretSpawner",32,0,0,0,15)
	ECMD EEE 8 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SetUserVar(user_TurretUse,1)
	Goto See
  Sniper:
	TNT1 A 0 A_PlaySound("superzombie/sight")
	TNT1 A 0 A_GiveInventory("LegZombieStrafingg",1)	
	ECMD E 5 A_FaceTarget
	TNT1 A 0 A_GiveInventory("LegZombieStrafingg",1)	
	ECMD E 5 A_FaceTarget
  SniperLoopStart:
	TNT1 A 0 A_JumpIf(user_SniperLoopStart == 35,"SniperLoop")	
	ECMD E 1 A_CustomRailgun(-1,7,NONE,NONE,RGF_SILENT|RGF_NOPIERCING,1,0,RailTargetPuff,0,0,0,0,2,0,"EnragedLaserSight")
	TNT1 A 0 A_SetUserVar(user_SniperLoopStart,user_SniperLoopStart+1)
	Loop
  SniperLoop:
	TNT1 A 0 A_JumpIf(user_SniperLoop == 100, "See")
	TNT1 A 0 A_FaceTarget
	TNT1 A 0 A_JumpifTargetinLOS("SniperAttack")
	ECMD E 1 A_CustomRailgun(-1,7,NONE,NONE,RGF_SILENT|RGF_NOPIERCING,1,0,RailTargetPuff,0,0,0,0,2,0,"EnragedLaserSight")
	TNT1 A 0 A_SetUserVar(user_SniperLoop,user_SniperLoop+1)
	Loop
  SniperAttack:
	TNT1 A 0 A_SetUserVar(user_SniperLoopStart,0)
	TNT1 A 0 A_JumpIf(user_SniperAttack == 8, "See")
	TNT1 A 0 A_FaceTarget
	TNT1 A 0 A_CustomMissile("LegendaryRedTracer",Random(28,34),0,Random(2,-2),0)
	TNT1 A 0 A_PlaySoundEx("weapons/LMGFire","Weapon")
	TNT1 A 0 A_JumpIfInventory ("ELegAK47Ammo", 92, "Reload")
	TNT1 A 0 A_CustomRailgun(-1,7,NONE,NONE,RGF_SILENT|RGF_NOPIERCING,1,0,RailTargetPuff,0,0,0,0,2,0,"EnragedLaserSight")
	TNT1 A 0 A_GiveInventory ("ELegAK47Ammo", 1)
	TNT1 A 0 A_SpawnItemEx("ELegRifleCasing", 12, -6, 36, Random(2, 6), 0, Random(1, 3), Random(-80, -90), 128)
	TNT1 A 0 A_CustomBulletAttack(6,10,1,Random(10,20)*5,"EnragedBulletPuff",0,CBAF_NORANDOM)
	ECMD FF 1
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	ECMD EE 1 A_CustomRailgun(-1,7,NONE,NONE,RGF_SILENT|RGF_NOPIERCING,1,0,RailTargetPuff,0,0,0,0,2,0,"EnragedLaserSight")
	TNT1 A 0 A_SetUserVar(user_SniperAttack,user_SniperAttack+1)
	Loop
  Pain:
   	TNT1 A 0 A_SetTranslucent(1)
	TNT1 A 0 A_Jump(15,"Protection")
	TNT1 A 0 A_Jump(90,"Phase")
    ECMD G 3 A_GiveInventory("LegZombieStrafingg",1)
    ECMD G 0 A_Pain
	ECMD G 3 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_Jump(25,"Turrets")
    Goto See
  Protection:
	TNT1 A 0 A_JumpIf(user_protection >= 3,"Pain")
	TNT1 A 0 A_JumpIf(user_protected == 1,"Pain")
	TNT1 A 0 A_PlaySound("legendary/defense")
	TNT1 A 0 A_FaceTarget
	ECMD E 2 ACS_NamedExecuteAlways("EnragedLegendaryProtection")
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	Goto See	
  Reload:
    TNT1 A 0 A_ChangeFlag("NoPain", 1)
    TNT1 A 0 A_PlaySound("weapons/LMGReload2")
	TNT1 A 0 A_SpawnItemEx("LegendaryEmptyDrumSpawner", -8, 7, 30, 4, 0, (0.1)*Random(30, 40), Random(-80, -90), 128)
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
    ECMD EE 25 A_TakeInventory ("ELegAK47Ammo", 92)
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
    ECMD E 20 A_PlaySound("weapons/LMGReload1") 
	ECMD E 40 A_PlaySound("weapons/LMGReload3")
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
    TNT1 A 0 A_ChangeFlag("NOPAIN",0)
    Goto See
  Death:
    TNT1 A 0 A_ChangeFlag("BRIGHT",0)
    TNT1 A 0 A_Jump(36,"LegendarySoul") 
	TNT1 A 0 A_SetTranslucent(1)
    TNT1 A 0 A_StopSound(6)
	ECMD H 5 A_Scream
    ECMD I 5 A_Fall
    ECMD J 5 A_SpawnItem("BodyCrash")
    ECMD K 5 
    ECMD L -1 
	Stop
  LegendarySoul:
	TNT1 A 0 A_SetTranslucent(1)
    TNT1 A 0 A_StopSound(6)
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	ECMD H 5 A_Scream
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
    ECMD I 5 A_Fall
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
    ECMD J 5 A_SpawnItem("BodyCrash")
    ECMD K 5 A_SpawnItem("EnragedHellionSmokeSpawner")
	ECMD L 140
	ECMD L 0 A_PlaySoundEx("brain/spit","Voice",0,2)
	ECMD LLLLLLLLLLLLLLLLL 2 Bright A_SpawnItem("ELegSoulEventSmokeSpawner",1)
	ECMD LLLLLLLLLLLLLLLLL 2 Bright A_SpawnItem("ELegSoulEventSmokeSpawner",1)
	ECMD LLLLLLLLLLLLLLLLL 2 Bright A_SpawnItem("ELegSoulEventSmokeSpawner",1)
	TNT1 A 0 A_SpawnItemEx("EnragedLegendarySoul",0,0,16,0,0,0,0,32)
	TNT1 A 0 A_SpawnItemEx("TeleportFog",0,0,16,0,0,0,0,32)
	ECMD L -1
	Stop
  XDeath:
    TNT1 A 0 A_StopSound(6)
	ECMD O 3 A_SpawnItemEx("EnragedGibbedGenerator")
    ECMD P 3 A_XScream
    ECMD R 3 A_Fall
    ECMD STUV 3 
    ECMD W -1 
    Stop
    }
}

ACTOR EnragedLegStealthGhostA : LegCommandoGhostA
{
States 
{
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
  Fade:
	TNT1 A 1
	ECMD A 2 A_FadeOut(0.10)
	Goto Fade+1
  Toaster:
	TNT1 A 0
	Stop
    }
}

ACTOR EnragedLegStealthGhostB : EnragedLegStealthGhostA
{   
States 
{
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
  Fade:
	TNT1 A 1
	ECMD B 2 A_FadeOut(0.10)
	Goto Fade+1
    }
}

ACTOR EnragedLegStealthGhostC : EnragedLegStealthGhostA
{   
States 
{
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
  Fade:
	TNT1 A 1
	ECMD C 2 A_FadeOut(0.10)
	Goto Fade+1
    }
}

ACTOR EnragedLegStealthGhostD : EnragedLegStealthGhostA
{   
States 
{
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
  Fade:
	TNT1 A 1
	ECMD D 2 A_FadeOut(0.10)
	Goto Fade+1
    }
}
	
ACTOR ELegAK47Ammo: Ammo { Inventory.MaxAmount 92 }

Actor ELegStealthTrooperNade : ELACGrenade { Obituary "%o was caught by an Enraged Legendary Stealth Trooper's grenade." }

Actor ELTurretSpawner : ELACThrownMine
{
Species "Zombie"
Obituary ""
+NOTIMEFREEZE
States
{
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_StopSound
    Goto Thrown
  Thrown:
	LSTS ABCDEF 5 Bright
	Loop
  Death:
	LSTS ABCDEF 1 A_SpawnItem("EnragedHellionSmokeSpawner")
	LSTS A 1 A_SpawnItem("FEnragedLegendaryTurret")
	Stop
	}
}

Actor FEnragedLegendaryTurret
{
Obituary "%o was surrounded by an Enraged Legendary Stealth Trooper's turrets."
Health 150 //Nerf Health 
Radius 16
Height 56
Mass 100000
Speed 0
Monster
Decal "ELegBulletChip"
DamageType "Legendary"
DamageFactor "Legendary", 0
DropItem "EnragedLegendaryBulletBox" 100
DropItem "EnragedLegendaryLMGBulletMag" 230 20
DamageFactor 0.8
+FLOORCLIP
+FRIENDLY
+MISSILEMORE
+MISSILEEVENMORE
+NOTARGET
+QUICKTORETALIATE
+NOBLOOD
+LOOKALLAROUND
+DROPOFF
+STANDSTILL
+NOTIMEFREEZE
var int user_TurretLoop;
States
{
  Spawn:
  See:
	TNT1 A 0 A_SetUserVar(user_TurretLoop,0)
    SENT AAAAAAAAAAAAAAA 1 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
    TNT1 A 0 A_PlaySound("sentry/beep")
	TNT1 A 0 A_ClearTarget
    Loop
  Missile:
  TurretLoopStart:
	TNT1 A 0 A_JumpIf(user_TurretLoop == 15,"TurretLoop")	
	TNT1 A 0 A_FaceTarget
	SENT A 1 A_CustomRailgun(-1,0,NONE,NONE,RGF_SILENT|RGF_NOPIERCING,1,0,RailTargetPuff,0,0,0,0,2,0,"EnragedLaserSight",5)  
	TNT1 A 0 A_SetUserVar(user_TurretLoop,user_TurretLoop+1)
	Loop
  TurretLoop:
    SENT A 1 A_CustomRailgun(-1,0,NONE,NONE,RGF_SILENT|RGF_NOPIERCING,1,0,RailTargetPuff,0,0,0,0,2,0,"EnragedLaserSight",5)  
	TNT1 A 0 A_FaceTarget
	SENT A 1 A_CustomRailgun(-1,0,NONE,NONE,RGF_SILENT|RGF_NOPIERCING,1,0,RailTargetPuff,0,0,0,0,2,0,"EnragedLaserSight",5)  
	TNT1 A 0 A_FaceTarget
	SENT A 1 A_CustomRailgun(-1,0,NONE,NONE,RGF_SILENT|RGF_NOPIERCING,1,0,RailTargetPuff,0,0,0,0,2,0,"EnragedLaserSight",5)  
	TNT1 A 0 A_FaceTarget
	SENT A 1 A_CustomRailgun(-1,0,NONE,NONE,RGF_SILENT|RGF_NOPIERCING,1,0,RailTargetPuff,0,0,0,0,2,0,"EnragedLaserSight",5)  
	TNT1 A 0 A_FaceTarget
	TNT1 A 0 A_CustomMissile("LegendaryRedTracer",Random(38,42),0,Random(5,-5),0)
	TNT1 A 0 A_PlaySound("weapons/LMGFire")
    TNT1 A 0 A_SpawnItemEx("ELegRifleCasing", 12, 6, 30, Random(2, 6), 0, Random(1, 3), Random(-80, -90), 128)
    TNT1 A 0  A_CustomBulletAttack(32,5,1,random(10,15)*3,"EnragedBulletPuff")
    SENT B 1 Bright A_CustomRailgun(-1,0,NONE,NONE,RGF_SILENT|RGF_NOPIERCING,1,0,RailTargetPuff,0,0,0,0,2,0,"EnragedLaserSight",5)
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
    TNT1 A 0 A_CPosRefire 
    Loop
  Death:
	TNT1 A 0 A_SpawnItemEx("EnragedParticleSpawner") 
    TNT1 AAA 0 A_CustomMissile("EKaboomLN", 0, 0, random(0,360), 2, random(0,360))
	TNT1 AAA 0 A_CustomMissile("LegendarySmokeFX2", 0, 0, random(0,360), 2, random(0,360))
    TNT1 AAAA 0 A_SpawnItemEx("LegendaryDebris",0,0,0,Random(4,-4),Random(4,-4),Random(4,8),0,128)
    TNT1 A 0 A_PlaySound("weapons/rocklx")
    TNT1 A 1 A_SpawnItem("RocketEx",0,32)
    Stop
  }
}