ACTOR NoMusicEnragedLegendaryAssaultCaptain
{
Health 875 //Nerf Health for Balance
Radius 20
Height 56
Speed 20
PainChance 20
MONSTER
SeeSound "Elasgguy/sight"
PainSound "Elasgguy/pain"
DeathSound "Elasgguy/death"
ActiveSound "Elasgguy/active"
Obituary "%o was shot on sight by an Enraged Legendary Assault Captain"
Tag "\c[m6]Enraged\c- \c[z3]Legendary Assault Captain Summoning\c-"
BloodColor "Red"
DropItem "LegendaryBossLifeEssence" 256
DropItem "LegendaryBossArmorBonusMax" 256
DropItem "LegendaryBossLifeEssence" 128
DropItem "LegendaryBossArmorBonusMax" 128
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
+NOTIMEFREEZE
+NOFEAR
+BOSS
+BOSSDEATH
+FLOORCLIP
+MISSILEMORE
+MISSILEEVENMORE
+QUICKTORETALIATE
+NOICEDEATH
+NODROPOFF
+DONTGIB
+NOTARGET
+NORADIUSDMG
+NOKILLSCRIPTS
+BRIGHT
var int user_protection;
var int user_protected;
var int user_ammo;
States
{
  Spawn:
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG A 10 A_Look
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG "Z" 10 A_Look
	Loop
  See:
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG AA 4 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG BB 4 A_Chase
	TNT1 A 0 A_SpawnItem("FootStep")
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG CC 4 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG DD 4 A_Chase
	TNT1 A 0 A_SpawnItem("FootStep")
	TNT1 A 0 A_Jump(64,"Mine","Rush","DodgeLeft","DodgeRight","Chase")
	Loop
  Chase:
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG AA 1 A_FastChase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_Jump(1,"Heal")
	IASG A 0 A_JumpIfCloser(130,"Dodge")
	IASG AA 1 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG A 0 A_JumpIfCloser(130,"Dodge")
	IASG BB 1 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG A 0 A_JumpIfCloser(130,"Dodge")
	IASG BB 1 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItemEx("FootStep")
	IASG A 0 A_JumpIfCloser(150,"Dodge")
	IASG CC 1 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_Jump(10,"Heal")
	IASG A 0 A_JumpIfCloser(150,"Dodge")
	IASG CC 1 A_FastChase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG A 0 A_JumpIfCloser(130,"Dodge")
	IASG DD 1 A_FastChase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG A 0 A_JumpIfCloser(130,"Dodge")
	IASG DD 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("FootStep")
	TNT1 A 0 A_Jump(95,"Mine")
	IASG A 0 A_Jump(128,"Dodge")
	Loop
  Rush:
	TNT1 A 0 A_SpawnItem("FootStep")
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItemEx("FELegASGZombieGhostA")
	IASG A 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("FELegASGZombieGhostA")
	IASG A 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("FELegASGZombieGhostB")
	IASG B 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("FELegASGZombieGhostB")
	IASG B 1 A_Chase
	TNT1 A 0 A_SpawnItem("FootStep")
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItemEx("FELegASGZombieGhostC")
	IASG C 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("FELegASGZombieGhostC")
	IASG C 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("FELegASGZombieGhostD")
	IASG D 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("FELegASGZombieGhostD")
	IASG D 1 A_Chase
	TNT1 A 0 A_SpawnItem("FootStep")
	TNT1 A 0 A_Jump(85,"See")
	Loop
  GrenadeAttack:
	TNT1 A 0 A_PlaySound("weapons/hgrenadepin",0,1.0,0)
	IASG CE 4 A_FaceTarget
	TNT1 A 0 A_PlaySound("weapons/hgrenadethrow",0,1.0,0)
	IASG CE 4 A_FaceTarget
	IASG E 1 A_CustomMissile("ELACGrenade",32,0,0,2,4)
	IASG CE 4 A_FaceTarget
	TNT1 A 0 A_PlaySound("weapons/hgrenadepin",0,1.0,0)
	IASG CE 4 A_FaceTarget
	TNT1 A 0 A_PlaySound("weapons/hgrenadethrow",0,1.0,0)
	IASG CE 4 A_FaceTarget
	IASG E 1 A_CustomMissile("ELACGrenade",32,0,0,2,4)
	Goto Rail
  Heal:
	TNT1 A 0 A_SpawnItem("GHellionSmokeSpawner")
	IASG A 5 
	TNT1 A 0 A_SpawnItem("GHellionSmokeSpawner")
	TNT1 A 0 HealThing(5)
	TNT1 A 0 A_PlaySound("pickups/flask",0,1.0,0)
	GoTo See
  Heal2:
	TNT1 A 0 A_SpawnItem("GHellionSmokeSpawner")
	IASG A 5 
	TNT1 A 0 A_SpawnItem("GHellionSmokeSpawner")
	TNT1 A 0 HealThing(15)
	TNT1 A 0 A_PlaySound("pickups/pstimpack",0,1.0,0)
	GoTo See
  Heal3:
	TNT1 A 0 A_SpawnItem("GHellionSmokeSpawner")
	IASG A 5 
	TNT1 A 0 A_SpawnItem("GHellionSmokeSpawner")
	TNT1 A 0 HealThing(25)
	TNT1 A 0 A_PlaySound("pickups/pmedkit",0,1.0,0)
	GoTo See
  SeeNoDodge:
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG AABB 2 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItemEx("FootStep")
	IASG CCDD 2 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItemEx("FootStep")
	IASG AABB 2 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItemEx("FootStep")
	IASG CCDD 2 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItemEx("FootStep")
	IASG AABB 2 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItemEx("FootStep")
	IASG CCDD 2 A_Chase
	TNT1 A 0 A_SpawnItemEx("FootStep")
	Goto Chase
  Dodge:
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG A 1 A_FaceTarget
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG E 0 ThrustThingZ(0,20,0,0)
	IASG A 0 A_Jump(256, "DodgeRight", "DodgeLeft")
  DodgeLeft:
	IASG E 0 ThrustThing(angle*256/360+192,15,0,0)
	TNT1 A 0 A_Jump(40,"Heal")
	TNT1 A 0 A_Jump(35,"Heal2")
	TNT1 A 0 A_Jump(30,"Heal3")
	Goto SeeNoDodge
  DodgeRight:
	IASG E 0 ThrustThing(angle*256/360+64,15,0,0)
	TNT1 A 0 A_Jump(40,"Heal")
	TNT1 A 0 A_Jump(35,"Heal2")
	TNT1 A 0 A_Jump(30,"Heal3")
	Goto SeeNoDodge
  Missile:
	TNT1 A 0 A_JumpIfCloser(600,1)
	Goto Rail
	TNT1 A 0 A_SetShootable
	TNT1 A 0 A_UnsetInvulnerable
	TNT1 A 0 A_SetTranslucent(1)
	IASG E 3 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_JumpIf(user_ammo >= 16,"Reload")
	IASG E 4 A_FaceTarget
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SetUserVar(user_ammo,user_ammo+1)
	TNT1 A 0 A_PlaySound("Weapons/LegAutoShotgun",5)
	TNT1 A 0 A_SpawnItemEx("RedShellCasing",-8,7,30,4,0,FRandom(3.0,4.0),Random(-80, -90),128)
	TNT1 AAAA 0 A_CustomMissile("LegendaryRedTracer",Random(28,34),0,Random(6,-6))
	IASG F 2 A_CustomBulletAttack(22.5,18.3,4,Random(5,15)*6,"EnragedBulletPuff")
	IASG E 4 A_FaceTarget
	TNT1 A 0 A_CPosRefire
	TNT1 A 0 A_Jump(12,"Rail")
	TNT1 A 0 A_Jump(6,"Heal")
	TNT1 A 0 A_Jump(5,"Heal2")
	TNT1 A 0 A_Jump(4,"Heal3")
	Goto Missile+4
  Rail:
	TNT1 A 0 A_JumpIf(user_ammo >= 13,"Reload")
	IASG E 0 A_PlaySound("LShotgun/Cock")
	TNT1 A 0 A_FaceTarget
	IASG E 4 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_FaceTarget
	IASG E 4 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_FaceTarget
	IASG E 4 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_FaceTarget
	IASG E 4 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_FaceTarget 
	TNT1 A 0 A_PlaySound("Weapons/LegAutoShotgun",5)
	TNT1 A 0 A_SetUserVar(user_ammo,user_ammo+4)
	IASG F 4 A_CustomMissile("ELegCaptainRail",32)
	TNT1 A 0 A_JumpIf(user_ammo >= 16,"Reload")
	Goto See
  Strafing:
	TNT1 A 0 A_SpawnItem("FootStep")
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
	IASG AA 3 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
	IASG BB 3 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_SpawnItem("FootStep")
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
	IASG CC 3 A_GiveInventory("LegZombieStrafingg",1)	
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
	IASG DD 3 A_GiveInventory("LegZombieStrafingg",1)
	Goto See
  Mine:
	IASG C 11 
	TNT1 AA 0 A_CustomMissile("ELACThrownMine",32,0,Random(-25,25),2,15)
	IASG CCCCEEEEC 3
	Goto See
  Reload:
	TNT1 A 0 A_ChangeFlag("NoPain", 1)
	TNT1 A 0 A_PlaySound("lasgguy/asgout")
	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")
	IASG E 48 A_SetUserVar(user_ammo,0)
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG E 8 A_PlaySound("lasgguy/asgin") 
	IASG E 20 A_PlaySound("LShotgun/Cock")
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_ChangeFlag("NoPain", 0)
	Goto See
  Pain:
	IASG G 3 A_Jump(20,"Protection")
	IASG G 3 A_Pain
	TNT1 A 0 A_Jump(192,"Missile")
	TNT1 A 0 A_Jump(40,"Dodge")
	Goto See
  PainMissile:
	IASG G 3
	IASG G 3 A_Pain
	Goto Missile	
  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
	IASG E 2 ACS_NamedExecuteAlways("EnragedLegendaryProtection")
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	Goto See
  Death:
	TNT1 A 0 A_StopSound(6)
	TNT1 A 0 A_ChangeFlag("BRIGHT",0)
	TNT1 A 0 A_Jump(36,"LegendarySoul")
	IASG H 5
	IASG I 5 A_Scream
	IASG J 5 A_Fall
	IASG J 5 A_SpawnItem("BodyCrash")
	IASG K 5
	IASG L -1
	Stop
  LegendarySoul:
	TNT1 A 0 A_StopSound(6)
	IASG H 5 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG I 5 A_Scream
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG J 5 A_Fall
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG J 5 A_SpawnItem("BodyCrash")
	IASG K 5 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG L 140 A_SpawnItem("EnragedHellionSmokeSpawner")
	IASG L 0 A_PlaySoundEx("brain/spit","Voice",0,2)
	IASG LLLLLLLLLLLLLLLLL 2 Bright A_SpawnItem("ELegSoulEventSmokeSpawner",1)
	IASG LLLLLLLLLLLLLLLLL 2 Bright A_SpawnItem("ELegSoulEventSmokeSpawner",1)
	IASG 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)
	IASG L -1
	Stop
  XDeath:
	TNT1 A 0 A_StopSound(6)
	IASG O 5 A_SpawnItemEx("EnragedGibbedGenerator")
	IASG P 5 A_XScream
	IASG Q 5 A_Fall
	IASG RSTUV 5
	IASG W -1
	Stop
    }
}

ACTOR FELegASGZombieGhostA : LegASGZombieGhostA
{
States
{
  Spawn:
    TNT1 A 0
    TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
  Fade:
    TNT1 A 1
    IASG A 2 A_FadeOut(0.10)
    Goto Fade+1
    }
}

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

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

ACTOR FELegASGZombieGhostD : ELegASGZombieGhostA
{   
States
{
  Spawn:
    TNT1 A 0
    TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
  Fade:
    TNT1 A 1
    IASG D 2 A_FadeOut(0.10)
    Goto Fade+1
    }
}

Actor FELACGrenade : LACGrenade
{
Obituary "%o tried to dodge a Grenade thrown by an Enraged Legendary Assault Captain"
States
{
  Spawn:
	TNT1 A 0
	HGN1 A 3 A_StopSound
	HGN1 BCDEFGHABCDEFGHABCDEFGH 3
	Goto Death      
   Death:
	TNT1 A 0 A_ChangeFlag("MISSILE",0)
	TNT1 A 0 A_PlaySound("weapons/hgrenadeex")
	TNT1 A 0 A_SpawnItemEx ("ELegBarrelKaboom")
	TNT1 A 0 A_Explode(280,350)
	TNT1 A 0 A_SpawnItemEx("EnragedParticleSpawner") 
	TNT1 AAA 0 A_CustomMissile("EKaboomLN2", 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)
	MISL B 4 Bright
	MISL CD 4 Bright A_SetTranslucent(0.75,1)
	Stop
   }
}

ACTOR ELACThrownMine : LACThrownMine
{
Obituary "%o set off one of the Enraged Legendary Assualt Captain's Mines."
States
{
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_StopSound
    Goto Thrown
  Thrown:
	ILIN A 30
	ILIN B 10 Bright
	Loop
  Death:
	ILIN A 1
	ILIN A 1 A_SpawnItem("ELACLiveMine")
	Stop
	}
}

ACTOR ELACLiveMine : LACLiveMine
{
Obituary "%o set off one of the Enraged Legendary Assualt Captain's Mines."
var int user_missile;
States
{
  Spawn:
    TNT1 A 0 A_JumpIf(user_missile >= 20,"Death")
	ILIN A 30 A_ChangeFlag(NOBLOCKMAP,0)
	ILIN B 10 Bright A_ChangeFlag(NOBLOCKMAP,1)
    TNT1 A 0 A_SetUserVar(user_missile,user_missile+1)
	Loop
  Death:
	TNT1 A 0 A_Die
  Explode:
	ILIN B 15 Bright A_PlaySound("weapons/minebeep")
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_Explode(300,230)
	TNT1 A 0 A_PlaySound("weapons/mineexplode")
	TNT1 A 0 A_SpawnItemEx ("ELegBarrelKaboom")
	TNT1 A 0 A_SpawnItemEx("EnragedParticleSpawner") 
    TNT1 AAAA 0 A_CustomMissile("EKaboomLN2",0,0,random(0,360),2,random(20,160))
	TNT1 AAAA 0 A_CustomMissile("LegendarySmokeFX2",0,0,random(0,360),2,random(20,160))
	TNT1 AAAA 0 A_SpawnItemEx("LegendaryDebris",0,0,0,Random(4,-4),Random(4,-4),Random(4,8),0,128)
    Stop
    }
}

Actor ELegBarrelKaboom : BarrelKaboom
{
+NOTIMEFREEZE
States
{
  Spawn:
	TNT1 A 1
	TNT1 AAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("ELegSpawnedExplosionSmall",Random(-8,8),Random(-8,8),Random(0,12),Random(-8,8),Random(-8,8),Random(0,3))
	Stop
	}
}

ACTOR ELegSmallExplosionFlames : SmallExplosionFlames
{
Scale 0.6
Speed 3
+NOTIMEFREEZE
States
{
  Spawn:
	EXPO AA 2 BRIGHT 
	EXPO BCDFGHII 1 BRIGHT
	Stop
	}
}

Actor ELegSpawnedExplosionSmall : SpawnedExplosionSmall
{
+NOTIMEFREEZE
States
{
  Spawn:
	TNT1 A 4
	FXPO AA 0 A_CustomMissile("LegendarySmokeFX2",0,0,random(0,360),2,random(0,360))
	TNT1 AAAA 0 A_CustomMissile("ELegSmallExplosionFlames",0,0,random(0,360),2,random(0,360))
	Stop
	}
}


Actor ELegCaptainRail : DarkCyberRail
{
Damage (Random(20,28))
Species "Zombies"
MissileType "ELegRevRailgunTrail"
+NOTIMEFREEZE
States
{
  Spawn:
    TNT1 A 1
    Loop
  Death:
	TNT1 A 1 A_SpawnItem("EnragedRailgunImpactEffect")
	Stop
	}
}