ACTOR EnragedLegendaryGhoul
{
//Creator: Eshkere_Jason
//Origin: Divine Infinity
//Sprite: ELGH
//Title: "EnragedLegendaryGhoul"
Health 2250
Radius 16
Height 56
Mass 100
Speed 22
PainChance 50
Monster
MeleeDamage 25
DamageFactor "Legendary1", 0.0
DamageFactor 0.6
DamageFactor "PlasmaBall", 20
DamageFactor "Legendary", 0.0
DamageFactor "LegendaryPlayer", 0.0
DamageFactor "PDTBFG", 0.25
DamageFactor "PDTBFGTracer", 0.25
DamageFactor "PlayerDevBall", 0.125
DamageFactor "PlayerDevBall2", 0.125
DamageFactor "PlayerDTBFGRailgunSlug", 0.75
DamageFactor "PlayerDevTracer", 0.125
DamageFactor "DBFG10K2", 0.1
DamageFactor "PlayerDBFG10K2", 0.1
DamageFactor "DBFG2", 0.1
DamageFactor "PlayerDBFG2", 0.1
DropItem "EnragedLegendarySphere" 70
DropItem "LegendaryPowerSphere" 85 1
DropItem "EnrLegGreaterDemonicEnergy" 200
DropItem "EnrLegDemonicEnergy" 250
DropItem "LegendaryBossLifeEssence" 256
DropItem "LegendaryBossArmorBonusMax" 256
DropItem "LegendaryBossLifeEssence" 128
DropItem "LegendaryBossArmorBonusMax" 128
DropItem "Enraged Legendary Plasmatic Rifle" 76
Species "Imps"
SeeSound "monster/vulsit"
PainSound "monster/vulpai"
DeathSound "monster/vulhit"
ActiveSound "monster/vulact"
BloodColor "Red"
MeleeSound "imp/melee"
HitObituary "%o was made into a feast for a Enraged Legendary Ghoul."
Obituary "%o was deep impaled by a Enraged Legendary Ghoul."
Tag "\c[m6]Enraged\c- \c[z3]Legendary Ghoul\c-"
+NOTIMEFREEZE
+NOFEAR
+BOSS
+BOSSDEATH
+FLOORCLIP
+MISSILEMORE
+MISSILEEVENMORE
+QUICKTORETALIATE
+NOICEDEATH
+NODROPOFF
+DONTGIB
+NOTARGET
+BRIGHT
var int user_music;
var int user_protection;
var int user_protected;
var int user_missile;
States
{
  Spawn:
    TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
    ELGH A 10 A_Look
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	ELGH A 10 A_Look
    Loop
  See:
	TNT1 A 0 A_JumpIf(user_music == 1,3)
	TNT1 A 0 ACS_NamedExecuteAlways("StartMonsterMusic",0,6725)
	TNT1 A 0 A_SetUserVar("user_music",1)
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
    ELGH A 0 A_JumpIfTargetInLOS("Strafing")
    ELGH AA 3 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	ELGH BB 3 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItem("FootStep")
	ELGH A 0 A_JumpIfTargetInLOS("Strafing")
	ELGH CC 3 A_Chase
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	ELGH DD 3 A_Chase
	ELGH A 0 A_Jump(80,"Rush")
    TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItem("FootStep")
    Loop
  Rush:
    ELGH A 0 A_JumpIfTargetInLOS("Strafing")
	TNT1 A 0 A_SpawnItem("FootStep")
	TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItemEx("LegZombieGhostAA")
	ELGH A 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("LegZombieGhostAA")
	ELGH A 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("LegendaryZombieGhostBB")
	ELGH B 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("LegendaryZombieGhostBB")
	ELGH B 1 A_Chase
	TNT1 A 0 A_SpawnItem("FootStep")
    TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItemEx("LegZombieGhostCC")
	ELGH C 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("LegZombieGhostCC")
	ELGH C 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("LegendaryZombieGhostDD")
	ELGH D 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("LegendaryZombieGhostDD")
	ELGH D 1 A_Chase
	TNT1 A 0 A_SpawnItem("FootStep")
	TNT1 A 0 A_Jump(84,"See")
	Loop
  Strafing:
	TNT1 A 0 A_SpawnItem("FootStep")
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
	ELGH AA 3 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
	ELGH BB 3 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_SpawnItem("FootStep")
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
    ELGH CC 3 A_GiveInventory("LegZombieStrafingg",1)	
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
	ELGH DD 3 A_GiveInventory("LegZombieStrafingg",1)
	Goto See
  Pause:
	TNT1 A 0 A_SetUserVar(user_missile,0)
	ELGH E 0 A_PlaySound("legimp/fiyabetch")
	ELGH EEEEE 3 A_GiveInventory("LegZombieStrafingg",1)
	Goto See
  Melee:
    ELGH EF 6 A_FaceTarget
    ELGH F 5 A_MeleeAttack
	Goto See
  Missile:
	ELGH EEEE 3 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_Jump(20,"Rapid","Super","Seeker","Normal" )
	ELGH E 3 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 AA 0 A_CustomMissile("ILegendaryBall",32,0,Frandom(-1,1),0)
	ELGH F 3 A_PlaySoundEx("weapons/DemonTechRifle","Weapon")
	TNT1 A 0 A_Jump(24,"Pause")
	TNT1 A 0 A_SpidRefire
    TNT1 A 0 A_PlayWeaponSound("BlueDTRFire")
	Goto Missile+4	
  Rapid:
	TNT1 A 0 A_PlaySound("monster/vulpai",0,1,0,ATTN_NONE)
    ELGH EEEEEEEE 3 A_GiveInventory("LegZombieStrafingg",1)
  RapidLoop:
    TNT1 A 0 A_JumpIf(user_missile == 20,"Pause")
    ELGH E 1 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 AA 0 A_CustomMissile("ILegendaryBall",32,0,Frandom(-1,1),0)
	ELGH F 3 A_PlaySoundEx("legimp/chargingsound","Weapon")
	TNT1 A 0 A_PlayWeaponSound("legimp/fiyabetch")
	TNT1 A 0 A_SetUserVar("user_missile",user_missile+1)
	Loop
   Normal:
    ELGH EF 8 A_FaceTarget
	ELGH F 1 A_FaceTarget
	TNT1 A 0 A_PlaySound("imp/attack")
	TNT1 A 0 A_CustomMissile("ILegendaryBall", 28, 0, 0)
	TNT1 A 0 A_CustomMissile("ILegendaryBall", 28, 0, -5)
	TNT1 A 0 A_CustomMissile("ILegendaryBall", 28, 0, 5)
	TNT1 A 0 A_CustomMissile("ILegendaryBall", 28, 0, -10)
	TNT1 A 0 A_CustomMissile("ILegendaryBall", 28, 0, 10)
	TNT1 A 0 A_CustomMissile("ILegendaryBall", 28, 0, -15)
	TNT1 A 0 A_CustomMissile("ILegendaryBall", 28, 0, 15)
	TNT1 A 0 A_CustomMissile("ILegendaryBall", 28, 0, -20)
	TNT1 A 0 A_CustomMissile("ILegendaryBall", 28, 0, 20)
	TNT1 A 0 A_Jump(88,"Seeker")
	Goto See
  Seeker:
	ELGH EF 10 A_FaceTarget
  SeekerLoop:
    TNT1 A 0 A_JumpIf(user_missile >= 6,"Detox")
	TNT1 A 0 A_PlaySound("imp/attack")
	ELGH F 6 A_CustomMissile("ILegImpSeekBall",32,20,0)
    ELGH F 2 A_FaceTarget
	TNT1 A 0 A_SetUserVar(user_missile,user_missile+1)
	Loop
  Super:
	TNT1 A 0 A_JumpIfCloser(200,"Normal")
	TNT1 A 0 A_PlaySound ("legimp/chargingsound")
	TNT1 A 0 A_SetInvulnerable
  SuperLoop1:
    TNT1 A 0 A_JumpIf(user_missile >= 5,"SuperLoop2")
	ELGH E 0 A_FaceTarget
	ELGH EEEEE 2 A_SpawnItem("ILegImpLineSpawner")
    TNT1 A 0 A_SetUserVar(user_missile,user_missile+1)
	Loop
  SuperLoop2:
	TNT1 A 0 A_JumpIf(user_missile >= 10,"SuperFire")
	ELGH E 0 A_FaceTarget
	ELGH FFFFF 2 A_SpawnItem("ILegImpLineSpawner")
    TNT1 A 0 A_SetUserVar(user_missile,user_missile+1)
	Loop
  SuperFire:
    TNT1 A 0 A_SetUserVar(user_missile,0)
    TNT1 A 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	ELGH F 0 A_CustomMissile ("LegendaryImpRedBall",28,0,-5)
	ELGH F 0 A_CustomMissile ("LegendaryImpRedBall",28,0,5)
	TNT1 A 0 A_playSound ("legimp/fiyabetch")
	TNT1 A 0 A_UnsetInvulnerable
	Goto See
  Teleport:
    ELGH A 1 A_UnSetShootable
	ELGH AAAA 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	ELGH AAAAAAAAAA 1  A_FadeOut(0.1,0)
	ELGH A 2 
	ELGH AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_Wander
	ELGH AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_Wander
    ELGH A 1 A_PlayWeaponSound("boss/teleport")
	ELGH AAAA 0 A_SpawnItem("EnragedHellionSmokeSpawner")
	ELGH AAAAAAAAAA 1 A_FadeIn(0.1)
    ELGH A 1 A_SetShootable
    Goto See		
  Detox:
    TNT1 A 0 A_SetUserVar(user_missile,0)
	Goto See
  Pain:
	TNT1 A 0 A_Jump(10,"Protection")
  Pain2:
	TNT1 A 0 A_Jump(192,"PainMissile")
    ELGH G 3 A_GiveInventory("LegZombieStrafingg",1)
    TNT1 A 0 A_Pain
	ELGH G 3 A_GiveInventory("LegZombieStrafingg",1)
    Goto See
  PainMissile: 
	ELGH G 3 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_Pain
	ELGH G 3 A_GiveInventory("LegZombieStrafingg",1)
	Goto Missile	
  Protection:
	TNT1 A 0 A_JumpIf(user_protection >= 3,"Pain2")
	TNT1 A 0 A_JumpIf(user_protected == 1,"Pain2")
	TNT1 A 0 A_PlaySound("legendary/defense")
	TNT1 A 0 A_FaceTarget
	ELGH 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)
	ELGH I 8
    ELGH J 8 A_Scream
    ELGH K 6
    ELGH L 6 A_NoBlocking
    ELGH M 1
    ELGH N -1
	Stop
	}
}
	
ACTOR LegZombieGhostAA : LegZombieGhostA
{
States
{
  Spawn:
    TNT1 A 0
    TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
  Fade:
    TNT1 A 1
    ELGH A 2 A_FadeOut(0.10)
    Goto Fade+1
  Toaster:
    TNT1 A 0
    Stop
    }
}

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

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

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

ACTOR LegendaryZombieGhostEE : LegZombieGhostAA
{   
States
{
  Spawn:
    TNT1 A 0
    TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
  Fade:
    TNT1 A 1
    ELGH E 2 A_FadeOut(0.10)
    Goto Fade+1
    }
}

ACTOR LegendaryZombieGhostFF : LegZombieGhostAA
{   
States
{
  Spawn:
    TNT1 A 0
    TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
  Fade:
    TNT1 A 1
    ELGH F 2 A_FadeOut(0.10)
    Goto Fade+1
    }
}

Actor LegZombieStrafingg : LegZombieStrafing
{
  States
  {
  Pickup:
    NULL A 1 
	NULL A 1 A_SpawnItem("EnragedHellionSmokeSpawner")
	NULL A 1 A_Jump(188,2)
	NULL A 1 A_GiveInventory("LegZombieJumping",1)
	NULL A 1 A_JumpIf(velx != 0 || vely != 0,2)
	NULL A 1 A_Jump(256,2)
	NULL A 1 A_Jump(235,5)
	NULL A 1 A_JumpIfInventory("LegZombieStrafeSens",1,3)
	NULL A 1 A_GiveInventory("LegZombieStrafeSens",1)
	NULL A 1 A_Jump(256,2)	
	NULL A 1 A_TakeInventory("LegZombieStrafeSens",1)
	NULL A 1 A_JumpIfInventory("LegZombieStrafeSens",1,3)
	NULL A 1 ThrustThing(angle*256/360+38.7,3,0,0)
	NULL A 1 A_Jump(256,2)	
	NULL A 1 ThrustThing(angle*256/360+38.7,-3,0,0)
    NULL A 1 A_FaceTarget
	NULL A 1 A_Jump(24,2)
	NULL A 1 A_JumpIfCloser(300,2)
	NULL A 1 A_Recoil(-1)
    Stop
	NULL A 1 A_Recoil(1)
    Stop	
  }
}

Actor LegZombieJumpingg : LegZombieStrafingg
{
  +NOTIMEFREEZE
  States
  {
  Pickup:
    NULL A 1 
    NULL A 1 A_CheckFloor(1)
    Stop
	NULL A 1 A_Jump(242,2)
	NULL A 1 ThrustThingZ(0,25,0,1)
    Stop
	NULL A 1
    Stop
  }
}

Actor LegendaryImpRedBall : LegendaryImpBlueBall
{
  Speed 30
  FastSpeed 30
  Damage 80
  Decal "BFG9500LightningRed"
  States
  {
  Spawn:
	TNT1 A 0 NoDelay A_PlaySound("legball/fly",6,1.0,1)
	Goto Fly
  Fly:
	IIBB A 3 Bright A_CustomMissile("EnragedLegBallAttack",random(-1,1),random(-2,2),0,CMF_AIMDIRECTION|CMF_TRACKOWNER)
	TNT1 A 0 A_SpawnItemEx("RedBallTrailA")
	TNT1 A 0 A_SpawnItemEx("RedBallTrailB")
	TNT1 A 0 A_SpawnItemEx("RedBallTrailC")
	IIBB B 3 Bright A_CustomMissile("EnragedLegBallAttack",random(-1,1),random(-2,2),0,CMF_AIMDIRECTION|CMF_TRACKOWNER)
	TNT1 A 0 A_SpawnItemEx("RedBallTrailA")
	TNT1 A 0 A_SpawnItemEx("RedBallTrailB")
	TNT1 A 0 A_SpawnItemEx("RedBallTrailC")
	IIBB C 3 Bright A_CustomMissile("EnragedLegBallAttack",random(-1,1),random(-2,2),0,CMF_AIMDIRECTION|CMF_TRACKOWNER)
	TNT1 A 0 A_SpawnItemEx("RedBallTrailA")
	TNT1 A 0 A_SpawnItemEx("RedBallTrailB")
	TNT1 A 0 A_SpawnItemEx("RedBallTrailC")
	Loop
  Death:
	TNT1 A 0 A_StopSound(6)
	TNT1 A 0 A_Explode(158,138,0)
	TNT1 A 0 Radius_Quake(20,12,0,12,0)
	IIBE ABCDEFG 4
	Stop
	}
}

ACTOR ILegBallAttack : LegBallAttack
{
Obituary "%o was ravaged by an Enraged Legendary Imp."
States
{
  Spawn:
    TNT1 A 0
	TNT1 AAAAA 1 A_Look
	Stop
  See:
    TNT1 A 0
	TNT1 A 1 A_JumpIfCloser(1250,"Attack")
	Stop
  Attack:
    TNT1 A 0
	TNT1 A 0 A_FaceTarget
	TNT1 A 0 A_MissileAttack
	TNT1 A 1 A_CustomRailgun(10,0,NONE,"Red",1,1,2)
	Goto Death	
  Death:
	TNT1 A 1
	Stop
	}
}

ACTOR ILegendaryBallTrail : LegendaryBallTrail
{
States
{
  Spawn:
    TNT1 A 0
	TNT1 A 1 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
    IKBT GHIJKL 1 A_FadeOut(0.1)
	Stop
}
}

ACTOR ILegendaryBall : LegendaryBall
{
Speed 23
Damage 23
FastSpeed 30
States
{
  Spawn:
    IIM1 AB 1 Bright A_SpawnItemEx("ILegendaryBallTrail",0,0,2,0,0,0,0,128,0)
    Loop
  Death:
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEx("EnragedParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128) 
    TNT1 AAA 0 A_CustomMissile("EnragedHellionSmokeSpawner", 0, 0, random(0,360), 2, random(0,360))		
    IIM1 CDE 3 Bright
    Stop
}   
}


ACTOR ILegImpSeekBall : LegImpSeekBall
{
Speed 39
FastSpeed 42
Damage (Random(12,18))
States
{
  Spawn:
    TNT1 A 0
	TNT1 A 0 A_SeekerMissile(12,0)
	TNT1 A 0 A_BishopMissileWeave
    IIM1 A 1 Bright A_SpawnItemEx("ILegImpSeekBallTrail",0,0,0,0,0,0,0,128,0)
	TNT1 A 0 A_BishopMissileWeave
    IIM1 B 1 Bright A_SpawnItemEx("ILegImpSeekBallTrail",0,0,0,0,0,0,0,128,0)
    Loop
  Death:
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEx("EnragedParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128) 
	TNT1 AAA 0 A_CustomMissile("EnragedHellionSmokeSpawner", 0, 0, random(0,360), 2, random(0,360))	
    IIM1 CDE 3 Bright
    Stop
}
}

ACTOR ILegImpSeekBallTrail : LegImpSeekBallTrail
{
States
{
  Spawn:
    TNT1 A 0
	TNT1 A 1 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
    IIM1 GHIJKL 1 A_FadeOut(0.1)
	Stop
}
}

ACTOR ILegImpLineSpawner : LegImpLineSpawner
{
States
{
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
	TNT1 AAA 0 A_CustomMissile("EnragedSparkleSpawner",0,0,random(0,-360),2,random(0,360))
	TNT1 AAAAAAA 0 A_SpawnItemEx("LegendaryRedPowerLine",random(32,-32),random(32,-32),random(8,48),0,0,random(1,4),0,128,0) 	
	TNT1 A 1 A_SpawnItemEx("LegendaryRedPowerLine",random(32,-32),random(32,-32),random(8,48),0,0,random(1,4),0,128,0) 
    Stop  
}
}