//The Overlord
actor OverLord replaces PainElemental 30134
{
//$Category Monsters
Scale 0.62
Health 4000
Radius 27
Height 56
Mass 1000
Speed 13
PainChance 20
DamageType normal
//DropItem "UnmakerHeart" 256
MONSTER
DamageFactor lightning, 0.0
Obituary "%o was smote by the Overlord."
HitObituary "The Overlord ate %o for lunch."
+DONTHARMSPECIES
+DONTHURTSPECIES
+FLOORCLIP
+NORADIUSDMG
+BOSS
+MISSILEEVENMORE
+FLOAT
+NOGRAVITY
+DONTFALL
MeleeDamage 20
MeleeRange 68
SeeSound "monster/ovlsit"
PainSound "monster/ovlpai"
DeathSound "monster/ovldth"
ActiveSound "monster/ovlact"
MeleeSound "caco/melee"
Species "FlyingBalls"
  states
  {
  Spawn:
    OVER A 10 A_Look
    loop
  See:
    OVER A 0 A_UnSetInvulnerable
    OVER AABBAACC 3 A_Chase
    OVER A 0 A_Jump(32,"Teleport")
    goto See+1
  Missile:
    OVER D 0 A_Jump(256,"Missile1","Missile2","Missile3")
  Missile1:
    OVER DE 8 A_FaceTarget
    OVER FFFFF 4 bright A_PainAttack("HS")
    goto See
  Missile2:
    OVER GH 8 Bright A_FaceTarget
    OVER H 0 Bright A_JumpIfHealthLower(1500,3)
    OVER H 1 Bright A_PlaySound("weapons/shock")
    OVER H 7 Bright A_CustomMissile("StormShot1",43,0,0,0,0)
    goto See
    OVER H 1 Bright A_PlaySound("weapons/shock")
    OVER H 7 Bright A_CustomMissile("StormShot2",43,0,0,0,0)
    goto See
  Missile3:
    OVER JJJJJJJJ 1 A_FaceTarget
    OVER K 0 Bright A_CustomMissile("HadesBall",92*0.62,-40*0.62,random(-3,3),0,random(-3,3))
    OVER K 0 Bright A_CustomMissile("HadesBall",8*0.62,-40*0.62,random(-3,3),0,random(-3,3))
    OVER K 0 Bright A_CustomMissile("HadesBall",92*0.62,40*0.62,random(-3,3),0,random(-3,3))
    OVER K 0 Bright A_CustomMissile("HadesBall",8*0.62,40*0.62,random(-3,3),0,random(-3,3))
    OVER K 0 Bright A_CustomMissile("OverBall",54*0.62,-50*0.62,random(-3,3),0,random(-3,3))
    OVER K 4 Bright A_CustomMissile("OverBall",54*0.62,50*0.62,random(-3,3),0,random(-3,3))
    OVER J 4 A_SpidRefire
    OVER J 0 A_Jump(32,"See")
    goto Missile3+8
  Melee:
    OVER ADF 5 A_FaceTarget
    OVER E 5 A_MeleeAttack
    goto See
  Pain:
    OVER L 6
    OVER F 1 A_SetTranslucent(1.0)
    OVER L 6 A_Pain
    OVER L 0 A_Jump(40,"Teleport")
    goto See
  Teleport:
    OVER F 0 A_SetInvulnerable
    OVER F 1 A_PlaySound("monster/heltel")
    OVER F 1 A_SetTranslucent(0.90)
    OVER F 1 A_SetTranslucent(0.80)
    OVER F 1 A_SetTranslucent(0.70)
    OVER F 1 A_SetTranslucent(0.60)
    OVER F 1 A_SetTranslucent(0.50)
    OVER F 1 A_SetTranslucent(0.40)
    OVER F 1 A_SetTranslucent(0.30)
    OVER F 1 A_SetTranslucent(0.20)
    OVER F 1 A_SetTranslucent(0.10)
    OVER F 0 A_Jump(128,25)
    TNT1 AAAAAAAAAAAAAAAAAAAAAAAA 0 A_ExtChase(0,0,1,1)
    TNT1 A 0 A_Jump(128,25)
    TNT1 AAAAAAAAAAAAAAAAAAAAAAAA 0 A_ExtChase(0,0,1,1)
    OVER F 1 A_PlaySound("monster/heltel")
    OVER F 1 A_SetTranslucent(0.10)
    OVER F 1 A_SetTranslucent(0.20)
    OVER F 1 A_SetTranslucent(0.30)
    OVER F 1 A_SetTranslucent(0.40)
    OVER F 1 A_SetTranslucent(0.50)
    OVER F 1 A_SetTranslucent(0.60)
    OVER F 1 A_SetTranslucent(0.70)
    OVER F 1 A_SetTranslucent(0.80)
    OVER F 1 A_SetTranslucent(0.90)
    OVER F 1 A_SetTranslucent(1.0)
    OVER F 0 A_UnSetInvulnerable
    goto See
  Death:
    OVER M 0 bright A_Facetarget
    OVER M 8 bright A_Scream
    OVER NO 8 bright
    TNT1 A 0 A_SpawnItem("Unmaker")
    OVER PPPPP 0 bright A_CustomMissile("OverFlesh1",random(0,90),random(0,40),random(-180,180),2,random(-15,15))
    OVER PPPPP 0 bright A_CustomMissile("OverFlesh2",random(0,90),random(0,40),random(-180,180),2,random(-15,15))
    OVER PPPPPPPPPP 0 A_CustomMissile("OverFlesh3",random(0,90),random(0,40),random(-180,180),2,random(-15,15))
    OVER PPPPPPPPPP 0 A_CustomMissile("OverFlesh4",random(0,90),random(0,40),random(-180,180),2,random(-15,15))
    OVER PPPPPPPPPP 0 A_CustomMissile("OverFlesh5",random(0,90),random(0,40),random(-180,180),2,random(-15,15))
    OVER PPPPPPPPPP 0 A_CustomMissile("OverFlesh6",random(0,90),random(0,40),random(-180,180),2,random(-15,15))
    OVER P 0 bright A_CustomMissile("OverBigArm1",40,-40,-90,2,random(-1,1))
    OVER P 0 bright A_CustomMissile("OverBigArm2",40,40,90,2,random(-1,1))
    OVER P 0 bright A_CustomMissile("OverSmallArm1",100,-30,-90,2,random(-15,15))
    OVER P 0 bright A_CustomMissile("OverSmallArm1",100,30,90,2,random(-15,15))
    OVER P 0 bright A_CustomMissile("OverSmallArm2",100,-30,-90,2,random(-15,15))
    OVER P 0 bright A_CustomMissile("OverSmallArm2",100,30,90,2,random(-15,15))
    OVER P 0 bright A_CustomMissile("OverHorn1",110,-16,-90,2,random(-15,15))
    OVER P 0 bright A_CustomMissile("OverHorn2",110,16,90,2,random(-15,15))
    OVER PQRSTUV 8 bright
    stop
  }
}

ACTOR OverFlesh1
{
   Speed 8
   Mass 100
   Radius 1
   Height 1
   PROJECTILE
   +THRUGHOST
   +LOWGRAVITY
   -NOGRAVITY
   States
   {
   Spawn:
      OVF1 ACEGIKM 5
      loop
   Death:
      OVF1 O 3
      OVF1 Q -1
      stop
   }
}

ACTOR OverFlesh2 : OverFlesh1
{
   States
   {
   Spawn:
      OVF1 BDFHJLN 5
      loop
   Death:
      OVF1 P 3
      OVF1 R -1
      stop
   }
}

ACTOR OverFlesh3 : OverFlesh1
{
   States
   {
   Spawn:
      OVF2 ACEG 5
      loop
   Death:
      OVF2 I -1
      loop
   }
}

ACTOR OverFlesh4 : OverFlesh1
{
   States
   {
   Spawn:
      OVF2 BDFH 5
      loop
   Death:
      OVF2 J -1
      loop
   }
}

ACTOR OverFlesh5 : OverFlesh1
{
   States
   {
   Spawn:
      OVF3 ACEGI 5
      loop
   Death:
      OVF3 K -1
      loop
   }
}

ACTOR OverFlesh6 : OverFlesh1
{
   States
   {
   Spawn:
      OVF3 BDFHJ 5
      loop
   Death:
      OVF3 L -1
      loop
   }
}

ACTOR OverBigArm1 : OverFlesh1
{
   States
   {
   Spawn:
      OVF4 ACEGI 5
      loop
   Death:
      OVF4 K 3
      OVF4 M -1
      stop
   }
}

ACTOR OverBigArm2 : OverFlesh1
{
   States
   {
   Spawn:
      OVF4 BDFHJ 5
      loop
   Death:
      OVF4 L 3
      OVF4 N -1
      stop
   }
}

ACTOR OverSmallArm1 : OverFlesh1
{
   States
   {
   Spawn:
      OVF5 ACEG 5
      loop
   Death:
      OVF5 I -1
      stop
   }
}

ACTOR OverSmallArm2 : OverFlesh1
{
   States
   {
   Spawn:
      OVF5 BDFH 5
      loop
   Death:
      OVF5 J -1
      stop
   }
}

ACTOR OverHorn1 : OverFlesh1
{
   States
   {
   Spawn:
      OVF6 ACEGI 5
      loop
   Death:
      OVF6 K -1
      stop
   }
}

ACTOR OverHorn2 : OverFlesh1
{
   States
   {
   Spawn:
      OVF6 BDFHJ 5
      loop
   Death:
      OVF6 L -1
      stop
   }
}

// [MagicWazard] This projectile is shared with the Hades Elemental
ACTOR HadesBall : CacodemonBall
{
Damage 8
Speed 15
Alpha 0.80
DamageType lightning
+THRUGHOST
+FORCEXYBILLBOARD
SeeSound "Monster/hadtel"
DeathSound "Monster/hadsit"
Decal "CacoScorch"
 states
  {
  Spawn:
    HEFX AB 4 bright
    loop
  Death:
    HEFX CDEEFGH 3 bright
    stop
  }
}

// [MagicWazard] Exploding projectile similar to the HadesBall
ACTOR OverBall
{
   Radius 10
   Height 20
   Speed 15
   Damage 8
   DamageType lightning
   ExplosionDamage 32
   ExplosionRadius 32
   PROJECTILE
   RENDERSTYLE ADD
   ALPHA 0.75
   Translation "192:207=168:191"
   +THRUGHOST
   +FORCEXYBILLBOARD
   DeathSound "weapons/devzap"
   Decal "CacoScorch"
   States
   {
   Spawn:
      AFX1 ABC 1 Bright
      loop
   Death:
      AFX1 DE 4 Bright A_Explode
      AFX1 FGHI 4 bright
      stop
   }
}

// [MagicWazard] Giant ball that spawns smaller projectiles ("StormLite1") from sides
ACTOR StormShot1
{
   Radius 12
   Height 6
   Speed 30
   Damage 8
   PROJECTILE
   RENDERSTYLE ADD
   Alpha 0.80
   Damagetype plasma
   +THRUGHOST
   +NODAMAGETHRUST
   +FORCEXYBILLBOARD
   DeathSound "weapons/devexp"
   States
   {
   Spawn:
      LFX1 STUVW 1 Bright
      LFX1 W 0 Bright A_CustomMissile("StormLite1",0,0,90,6)
      LFX1 W 0 Bright A_CustomMissile("StormLite1",0,0,270,6)
      loop
   Death:
		TNT1 A 0 A_Explode(55,90,0)
		TNT1 AAAAAAAAAAAAAA 0 A_SpawnItemEx("ObeliskTrailSpark", random(19,-19), random(19,-19), random(19,-19), 0, 0, 0, 0, 128, 0)
		TNT1 A 0 A_SpawnItemEx("ObeliskExplode",0,0,0,0,0,0,0,128,0)
		//LFX1 STUVWSTUVWSTUVWSTUVWSTUVWSTUVWSTUVWSTUVWSTUVWSTUVWSTUVWSTUVW 1 Bright //A_Explode(12,32,0)
		 stop
   }
}

// [MagicWazard] More powerful version of StormShot
ACTOR StormShot2 : StormShot1
{
   Damage 100
   States
   {
   Spawn:
      TNT1 A 2
      LFX2 KLMNO 1 Bright
      LFX2 O 0 Bright A_CustomMissile("StormLite2",0,0,90,6)
      LFX2 O 0 Bright A_CustomMissile("StormLite2",0,0,270,6)
      Goto Spawn+1
   Death:
      LFX2 KLMNO 1 Bright A_Explode(32,64,0)
      LFX2 KKKKKK 0 Bright A_SpawnItemEx("StormBolt",0,0,0,4,0,0,random(0,359),0,0)
      LFX2 LMNO 1 Bright A_Explode(32,64,0)
      stop
   }
}

// [MagicWazard] Note: this actor is unused, though it acts as a parent for the
// "StormBolt" vertical lightning column its sprites do not appear to be used
// anywhere else in the actor...
ACTOR StormStrike1
{
   Radius 16
   Height 1
   Speed 90
   Damage 2
   PROJECTILE
   Damagetype lightning
   RENDERSTYLE ADD
   Alpha 0.75
   +THRUGHOST
   +RIPPER
   +NODAMAGETHRUST
   +STRIFEDAMAGE
   DeathSound "weapons/devzap"
   States
   {
   Spawn:
      LFX1 IJKLM 1 Bright A_Explode(64,64,0)
      loop
   Death:
      LFX1 NOPQR 2 Bright
      stop
   }
}

// [MagicWazard] Vertical lightning column spawned by StormShot2
ACTOR StormBolt : StormStrike1
{
   Speed 4
   Radius 8
   Height 16
   Damage 1
   Damagetype lightning
   SeeSound "weapons/none"
   DeathSound "weapons/gntidl"
   YScale 4.0
   XScale 2.0
   ReactionTime 35
   +FLOORHUGGER
   +HEXENBOUNCE
   -NOGRAVITY
   States
   {
   Spawn:
      LFX2 F 1 Bright A_Explode(16,64,0)
      LFX2 F 0 Bright A_CustomMissile("StormBolt2",16,0,0,6,90)
      LFX2 F 0 ThrustThing(random(0,255),1,0,0)
      LFX2 G 1 Bright A_Explode(16,64,0)
      LFX2 G 0 Bright A_CustomMissile("StormBolt2",16,0,0,6,90)
      LFX2 H 1 Bright A_Explode(16,64,0)
      LFX2 H 0 Bright A_CustomMissile("StormBolt2",16,0,0,6,90)
      LFX2 I 1 Bright A_Explode(16,64,0)
      LFX2 I 0 Bright A_CustomMissile("StormBolt2",16,0,0,6,90)
      LFX2 J 1 Bright A_Explode(16,64,0)
      LFX2 J 0 Bright A_CustomMissile("StormBolt2",16,0,0,6,90)
      LFX2 J 0 Bright A_CountDown
      loop
   Death:
      LFX2 FGHIJ 2 Bright A_Explode(16,64,0)
      stop
   }
}

// [MagicWazard] Invisible sub-projectiles spawned by the lightning column in
// a vertical upwards path
ACTOR StormBolt2 : StormStrike1
{
   Speed 184
   Damage 1
   Height 15
   Radius 8
   Damagetype lightning
   SeeSound "Monster/hadtel"
   DeathSound "Monster/hadsit"
   +RIPPER
   +NOGRAVITY
   States
   {
   Spawn:
      TNT1 A 1 Bright A_Explode(16,64,0)
      loop
   Death:
      TNT1 A 1 Bright
      stop
   }
}

// [MagicWazard] Projectiles spawned from the sides of the large StormShot projectile
ACTOR StormLite1
{
   Radius 6
   Height 12
   Speed 32
   Damage 5
   PROJECTILE
   RENDERSTYLE ADD
   Alpha 0.80
   Damagetype lightning
   DeathSound "weapons/devzap"
   +THRUGHOST
   +RIPPER
   +FORCEXYBILLBOARD
   States
   {
   Spawn:
      DLIT ABC 1 Bright
      Loop
   Death:
      DLIT DEFGHIJKLMNO 1 Bright
      Stop
   }
}

// [MagicWazard] More powerful version of StormLite1
ACTOR StormLite2 : StormLite1
{
   Speed 64
   Damage 10
   States
   {
   Spawn:
      LFX1 XYZ 1 Bright
      Loop
   Death:
      LFX1 STUVW 3 Bright
      Stop
   }
}
//End of Overlord

// [MagicWazard] Notes: some sprites don't appear to be used by any actors. These
// include:
//   LFX1 A - H
//   LFX1 I - R (although they are assigned to an unused actor)
// It looks like you can delete these if you wish and it won't hurt anything.


//Hades Sphere
ACTOR HS 30116
{
  //$Title "Hades Sphere"
  //$Category Monsters
  Health 35
  Radius 24
  Height 48
  Mass 3000
  Speed 10
  Obituary "%o was blown away by a Hades Sphere."
  Monster
  SeeSound "monster/hadsit"
  DeathSound "monster/hadexp"
  +LOOKALLAROUND
  +DONTGIB
  +NOTARGET
  +NOGRAVITY
  +FLOAT
  +DONTFALL
  //+DONTHARMCLASS // [MagicWazard] See "notes" below
  States
  {
  Spawn:
    TNT1 A 1 Bright A_Look
    Loop
  See:
    HADE EFGH 4 Bright
  SeeLoop:
    HADE A 2 Bright A_Playsound("monster/hadwlk")
    HADE ABBCCDD 2 Bright A_GiveInventory("HS_SpecialChase", 1) // [Blue Shadow] Conditional A_Chase
    TNT1 A 0 A_CheckFlag("SKULLFLY", "SeeLoop") // [Blue Shadow] Don't bother trying to teleport out while "skull-flying"
    TNT1 A 0 A_Jump(32, "TeleportOut")
    Loop
  TeleportOut:
    TNT1 A 0 A_UnSetSolid
    TNT1 A 0 A_UnSetShootable
    HADE H 5 Bright A_Playsound("monster/hadtel")
    HADE GFEIJKL 4 Bright
  SeeTeleport:
    TNT1 AAAAAAAA 2 A_Chase(0)
    TNT1 A 0 A_Jump(96, "TeleportIn")
    Loop
  TeleportIn:
    HADE L 3 Bright A_Playsound("monster/hadtel")
    HADE KJIEFG 4 Bright
    TNT1 A 0 A_SetShootable
    TNT1 A 0 A_SetSolid
    Goto SeeLoop
  Melee:
    TNT1 A 0 A_SetInvulnerable
    HADE HGFE 4 Bright
    TNT1 A 0 A_UnSetInvulnerable
    TNT1 A 0 A_SetShootable
    TNT1 A 0 A_Die
    Stop
  Death:
    TNT1 A 0 A_NoBlocking
	TNT1 A 0 A_SetTranslucent(0.9, 1)
	TNT1 A 0 A_Scream
	HADE M 4 Bright A_Explode(112, 112, XF_NOTMISSILE)
    HADE NOPQ 5 Bright
    Stop
  XDeath:
    TNT1 A 0 A_Noblocking
    HADE H 5 Bright A_PlaySound("monster/haddth")
    HADE GFE 4 Bright
    HADE RSTUVWX 4 Bright
    Stop
  Death.Ice:
    "####" "#" 0 A_ChangeFlag("NOGRAVITY", FALSE)
    Goto GenericFreezeDeath
  }
}

// [MagicWazard] NOTES: +DONTHARMCLASS was originally enabled, but HS were still
// able to damage each other with self-destructs due to way the self-destruct
// was coded. Now that the self-destruct code has been changed, they are
// invulnerable to each others' explosions if that flag is enabled. Keep
// +DONTHARMCLASS disabled if you want the HS to be vunlerable to each others'
// explosions! Remove the comments and enable the flag if you want the HS to be
// immune to other HS' self-destruct damage.


// [Blue Shadow] Depending on whether or not the Hades Sphere is currently flying
// (due to A_SkullAttack), choose the appropriate "chase mode".
ACTOR HS_SpecialChase : CustomInventory
{
  States
  {
  Pickup:
    TNT1 A 0 A_CheckFlag("SKULLFLY", "ThrustChase")
    TNT1 A 0 A_Chase
    Stop
  ThrustChase:
    TNT1 A 0 A_Chase("", "")
    Stop
  }
}
//End of Hades Sphere