Actor LegendaryGhoul
{
//Creator: Eshkere_Jason
//Origin: Divine Infinity
//Sprite: LEGH
//Title: "LegendaryGhoul"
Health 1500
Radius 16
Height 56
Mass 100
Speed 20
PainChance 60
Monster
MeleeDamage 25
DamageFactor "Legendary1", 0.0
DamageFactor 0.6
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 "legendaryRune" 80 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
Species "Imps"
SeeSound "monster/vulsit"
PainSound "monster/vuLEGH"
DeathSound "monster/vulhit"
ActiveSound "monster/vulact"
BloodColor "Blue"
MeleeSound "imp/melee"
HitObituary "%o was made into a feast for a Legendary Ghoul."
Obituary "%o was deep impaled by a Legendary Ghoul."
Tag "\c[z3]Legendary Ghoul\c-"
+NOTIMEFREEZE
+NOFEAR
+BOSS
+BOSSDEATH
+FLOORCLIP
+MISSILEMORE
+MISSILEEVENMORE
+QUICKTORETALIATE
+NOICEDEATH
+NODROPOFF
+DONTGIB
+NOTARGET
+BRIGHT
var int user_delay;
var int user_music;
var int user_protection;
var int user_protected;
var int user_missile;
States
{
  Spawn:
    TNT1 A 0 A_SpawnItem("LHellionSmokeSpawner")
    LEGH A 10 A_Look
	TNT1 A 0 A_SpawnItem("LHellionSmokeSpawner")
	LEGH A 10 A_Look
    Loop
  See:
	TNT1 A 0 A_JumpIf(user_music == 1,3)
	TNT1 A 0 ACS_NamedExecuteAlways("StartMonsterMusic",0,6737)
	TNT1 A 0 A_SetUserVar("user_music",1)
	TNT1 A 0 A_SpawnItem("LHellionSmokeSpawner")
    LEGH A 0 A_JumpIfTargetInLOS("Strafing")
    LEGH AA 3 A_Chase
	TNT1 A 0 A_SpawnItem("LHellionSmokeSpawner")
	LEGH BB 3 A_Chase
	TNT1 A 0 A_SpawnItem("LHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItem("FootStep")
	LEGH A 0 A_JumpIfTargetInLOS("Strafing")
	LEGH CC 3 A_Chase
	TNT1 A 0 A_SpawnItem("LHellionSmokeSpawner")
	LEGH DD 3 A_Chase
	LEGH A 0 A_Jump(80,"Rush")
    TNT1 A 0 A_SpawnItem("LHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItem("FootStep")
    Loop
  Rush:
    LEGH A 0 A_JumpIfTargetInLOS("Strafing")
	TNT1 A 0 A_SpawnItem("FootStep")
	TNT1 A 0 A_SpawnItem("LHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItemEx("LegendaryGhoulGhostA")
	LEGH A 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("LegendaryGhoulGhostA")
	LEGH A 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("LegendaryGhoulGhostB")
	LEGH B 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("LegendaryGhoulGhostB")
	LEGH B 1 A_Chase
	TNT1 A 0 A_SpawnItem("FootStep")
    TNT1 A 0 A_SpawnItem("LHellionSmokeSpawner")
	TNT1 A 0 A_SpawnItemEx("LegendaryGhoulGhostC")
	LEGH C 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("LegendaryGhoulGhostC")
	LEGH C 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("LegendaryGhoulGhostD")
	LEGH D 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("LegendaryGhoulGhostD")
	LEGH 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)
	LEGH AA 3 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
	LEGH BB 3 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_SpawnItem("FootStep")
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
    LEGH CC 3 A_GiveInventory("LegZombieStrafingg",1)	
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
	LEGH DD 3 A_GiveInventory("LegZombieStrafingg",1)
	Goto See
  Pause:
	TNT1 A 0 A_SetUserVar(user_missile,0)
	LEGH E 0 A_PlaySound("legimp/fiyabetch")
	LEGH EEEEE 3 A_GiveInventory("LegZombieStrafingg",1)
	Goto See
  Melee:
    LEGH EF 6 A_FaceTarget
    LEGH F 5 A_MeleeAttack
	Goto See
  Missile:
	LEGH EEEE 3 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_Jump(20,"Rapid","Super","Seeker","Normal","Laser")
	LEGH E 3 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 AA 0 A_CustomMissile("LegendaryBall",32,0,Frandom(-1,1),0)
	LEGH 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/vuLEGH",0,1,0,ATTN_NONE)
    LEGH EEEEEEEE 3 A_GiveInventory("LegGhoulGhost",1)
  RapidLoop:
    TNT1 A 0 A_JumpIf(user_missile == 20,"Pause")
    LEGH E 1 A_GiveInventory("LegGhoulGhost",1)
	TNT1 AA 0 A_CustomMissile("LegendaryBall",32,0,Frandom(-1,1),0)
	LEGH 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:
    LEGH EF 8 A_FaceTarget
	LEGH F 1 A_FaceTarget
	TNT1 A 0 A_PlaySound("imp/attack")
	TNT1 A 0 A_CustomMissile("LegendaryBall", 32, 0, 0)
	TNT1 A 0 A_CustomMissile("LegendaryBall", 32, 0, -5)
	TNT1 A 0 A_CustomMissile("LegendaryBall", 32, 0, 5)
	TNT1 A 0 A_CustomMissile("LegendaryBall", 32, 0, -10)
	TNT1 A 0 A_CustomMissile("LegendaryBall", 32, 0, 10)
	TNT1 A 0 A_CustomMissile("LegendaryBall", 32, 0, -15)
	TNT1 A 0 A_CustomMissile("LegendaryBall", 32, 0, 15)
	TNT1 A 0 A_CustomMissile("LegendaryBall", 32, 0, -20)
	TNT1 A 0 A_CustomMissile("LegendaryBall", 28, 0, 20)
	TNT1 A 0 A_Jump(88,"Seeker")
	Goto See
  Seeker:
	LEGH EF 10 A_FaceTarget
  SeekerLoop:
    TNT1 A 0 A_JumpIf(user_missile >= 6,"Detox")
	TNT1 A 0 A_PlaySound("imp/attack")
	LEGH F 6 A_CustomMissile("LegImpSeekBall",32,20,0)
    LEGH 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")
	LEGH E 0 A_FaceTarget
	LEGH EEEEE 2 A_SpawnItem("LegImpLineSpawner")
    TNT1 A 0 A_SetUserVar(user_missile,user_missile+1)
	Loop
  SuperLoop2:
	TNT1 A 0 A_JumpIf(user_missile >= 10,"SuperFire")
	LEGH E 0 A_FaceTarget
	LEGH FFFFF 2 A_SpawnItem("LegImpLineSpawner")
    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("LHellionSmokeSpawner")
	LEGH F 0 A_CustomMissile ("LegendaryImpBlueBall",28,0,-5)
	LEGH F 0 A_CustomMissile ("LegendaryImpBlueBall",28,0,5)
	TNT1 A 0 A_playSound ("legimp/fiyabetch")
	TNT1 A 0 A_UnsetInvulnerable
	Goto See
   Laser:
    LEGH G 0 A_SetInvulnerable
	LEGH G 0 A_FaceTarget
	TNT1 A 0 Radius_Quake(8,51,0,20,0)
	TNT1 A 0 A_PlaySound("monster/vuLEGH",CHAN_AUTO,1.0,False,ATTN_NONE)
  LaserReadyLoop:
    TNT1 A 0 A_JumpIf(user_delay >= 4,"LaserChargeLoop")
	LEGH AAA 0 A_SpawnItem("ELRedeBSmokeSpawner")
    LEGH G 3 A_FaceTarget
	TNT1 A 0 A_SetUserVar(user_delay,user_delay+1)
	Loop
  LaserChargeLoop:
    TNT1 A 0 A_JumpIf(user_delay >= 21,"LaserFire")
    LEGH H 3 A_FaceTarget
	LEGH AAA 0 A_SpawnItem("ELRedeBSmokeSpawner")
    TNT1 A 0 A_SetUserVar(user_delay,user_delay+1)
	Loop
  LaserFire:
    TNT1 A 0 A_SetUserVar(user_delay,0)
	LEGH F 0 A_UnSetInvulnerable
	TNT1 A 0 A_PlaySound("legbanished/see",CHAN_AUTO,1.0,False,ATTN_NONE)
	LEGH G 0 A_FaceTarget
	LEGH GGGG 4 A_CustomMissile("",43)
	LEGH G 0 A_FaceTarget
	LEGH GGGG 4 A_CustomMissile("LegBanishedLaserBeam",43)
	LEGH G 0 A_FaceTarget
	LEGH GGGG 4 A_CustomMissile("LegBanishedLaserBeam",43)
	LEGH G 0 A_FaceTarget
	LEGH GGGG 4 A_CustomMissile("LegBanishedLaserBeam",43)
	LEGH G 0 A_FaceTarget
	LEGH GGGG 4 A_CustomMissile("LegBanishedLaserBeam",43)
	LEGH G 0 A_FaceTarget
	LEGH GGGG 4 A_CustomMissile("LegBanishedLaserBeam",43)
	LEGH G 0 A_FaceTarget
	LEGH GGGG 4 A_CustomMissile("LegBanishedLaserBeam",43)
	LEGH G 0 A_FaceTarget
	LEGH GGGG 4 A_CustomMissile("LegBanishedLaserBeam",43)
	LEGH G 0 A_FaceTarget
	LEGH GGGG 4 A_CustomMissile("LegBanishedLaserBeam",43)
	LEGH G 0 A_FaceTarget
	LEGH GGGG 4 A_CustomMissile("LegBanishedLaserBeam",43)
	LEGH G 0 A_FaceTarget
	LEGH GGGG 4 A_CustomMissile("LegBanishedLaserBeam",43)
	LEGH G 0 A_FaceTarget
	LEGH GGGG 4 A_CustomMissile("LegBanishedLaserBeam",43)
	TNT1 A 0 A_Jump(148,"Teleport")
	Goto See
  Teleport:
    LEGH A 1 A_UnSetShootable
	LEGH AAAA 0 A_SpawnItem("LHellionSmokeSpawner")
	LEGH AAAAAAAAAA 1  A_FadeOut(0.1,0)
	LEGH A 2 
	LEGH AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_Wander
	LEGH AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_Wander
    LEGH A 1 A_PlayWeaponSound("boss/teleport")
	LEGH AAAA 0 A_SpawnItem("LHellionSmokeSpawner")
	LEGH AAAAAAAAAA 1 A_FadeIn(0.1)
    LEGH A 1 A_SetShootable
    Goto See		
  Detox:
    TNT1 A 0 A_SetUserVar(user_missile,0)
	Goto See
  Pain:
	
  Pain2:
	TNT1 A 0 A_Jump(192,"PainMissile")
    LEGH G 3 A_GiveInventory("LegZombieStrafingg",1)
    TNT1 A 0 A_Pain
	LEGH G 3 A_GiveInventory("LegZombieStrafingg",1)
    Goto See
  PainMissile: 
	LEGH G 3 A_GiveInventory("LegZombieStrafingg",1)
	TNT1 A 0 A_Pain
	LEGH 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
	LEGH E 2 ACS_NamedExecuteAlways("EnragedLegendaryProtection")
	TNT1 A 0 A_SpawnItem("LHellionSmokeSpawner")
	Goto See
   Death:
    TNT1 A 0 A_StopSound(6)
	TNT1 A 0 A_ChangeFlag("BRIGHT",0)
	LEGH I 8
    LEGH J 8 A_Scream
    LEGH K 6
    LEGH L 6 A_NoBlocking
    LEGH M 1
    LEGH N -1
	Stop
	}
}

ACTOR LegendaryGhoulGhostA
{
Scale 1.1
Radius 20
Height 56
Speed 0
Alpha 0.7
PROJECTILE
RENDERSTYLE Translucent
+NOTIMEFREEZE
+NOINTERACTION
+CLIENTSIDEONLY
+NONETID
States
{
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
	TNT1 A 1
	Goto Fade
  Fade:
	LEGH A 2 A_FadeOut(0.1,1)
	Loop
  Toaster:
	TNT1 A 1
	Stop
	}
}

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

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

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




Actor LegZombieGhost : LegZombieStrafing
{
  States
  {
  Pickup:
    NULL A 1 
	NULL A 1 A_SpawnItem("LHellionSmokeSpawner")
	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
  }
}

