
// TECHNO-LORD
//
ACTOR RLCyberneticBaronOfHell : RLBaronOfHellBase 16544
{
  Health 1500
  GibHealth -125
  Mass 2500
  BloodType "RLNashGore_CyberBlood", "RLMNullActor", "RLNashGore_SlashBlood"
  Bloodcolor "DarkGreen"
  
  PainChance 40
  
  SeeSound "technolord/sight"
  PainSound "mechdemon/pain"
  DeathSound "technolord/death"
  ActiveSound "mechdemon/active"
  
  Obituary "%o was unable to dodge a Techno-Lord's salvo."
  HitObituary "%o decided that the Techno-Lord's fist was less dangerous than his gun."
  Tag "Techno-Lord"
    //$category "MP Technophobia"
  
	// Guncaster compatibility
	DropItem "Emerald"
	DropItem "Emerald"
  States
  {
  Spawn:
    CBAR BD Random(9,10) A_Look
    Goto Spawn
	
  See:
    CBAR AABB 3 A_Chase
    TNT1 A 0 A_Playsound("cybruiser/walk", 7, 1, 0, 1.25)
    CBAR CCDD 3 A_Chase
    Loop
	
  MissileHatredOnUniqueEffect: // [incoherent tantrum sounds]
    "####" "#" 0 A_PlaySound ("technolord/sight", CHAN_VOICE)
    "####" "#" 0 A_Jump (256, "MissileHatredOnUniqueDone")
	Goto MissileHatredOnUniqueDone
  MeleeHatredOnUniqueEffect: // [incoherent tantrum sounds]
    "####" "#" 0 A_PlaySound ("technolord/sight", CHAN_VOICE)
    "####" "#" 0 A_Jump (256, "MeleeHatredOnUniqueDone")
	Goto MeleeHatredOnUniqueDone
	
  MissileProper:
    TNT1 A 0 A_Jump(128, "Melee")
    CBAR EE 10 A_FaceTarget
    TNT1 A 0 A_CheckFlag ("FRIENDLY", "SummonMissile") // Friendly monsters do not harm you
    CBAR F 4 Bright A_CustomMissile("RLTechnoLordMiniMissile", 27, 16, frandom(-5,5))
    CBAR E 4 A_FaceTarget
    CBAR F 4 Bright A_CustomMissile("RLTechnoLordMiniMissile", 27, 16, frandom(-5,5))
    CBAR E 4 A_FaceTarget
    CBAR F 4 Bright A_CustomMissile("RLTechnoLordMiniMissile", 27, 16, frandom(-5,5))
    CBAR E 4 A_FaceTarget
    CBAR F 4 Bright A_CustomMissile("RLTechnoLordMiniMissile", 27, 16, frandom(-5,5))
    CBAR E 4 A_FaceTarget
    CBAR F 4 Bright A_CustomMissile("RLTechnoLordMiniMissile", 27, 16, frandom(-5,5))
    CBAR E 10 A_FaceTarget
    Goto See
	
	
  MeleeProper:
    CBAR PQ 8 A_FaceTarget
    TNT1 A 0 A_CheckFlag ("FRIENDLY", "SummonMelee") // Friendly monsters do not harm you
    CBAR R 8 A_CustomComboAttack("RLBaronOfHellPlasmaBall", 32, 10 * random(1, 8), "baron/melee")
    Goto See
	
  SummonMissile:
    CBAR F 4 Bright A_CustomMissile("RLSummonTechnoLordMiniMissile", 27, 16)
    CBAR E 4 A_FaceTarget
    CBAR F 4 Bright A_CustomMissile("RLSummonTechnoLordMiniMissile", 27, 16)
    CBAR E 4 A_FaceTarget
    CBAR F 4 Bright A_CustomMissile("RLSummonTechnoLordMiniMissile", 27, 16)
    CBAR E 4 A_FaceTarget
    CBAR F 4 Bright A_CustomMissile("RLSummonTechnoLordMiniMissile", 27, 16)
    CBAR E 4 A_FaceTarget
    CBAR F 4 Bright A_CustomMissile("RLSummonTechnoLordMiniMissile", 27, 16)
    CBAR E 10 A_FaceTarget
    Goto See
  SummonMelee:
    CBAR R 8 A_CustomComboAttack("RLSummonBaronOfHellPlasmaBall", 32, 10 * random(1, 8), "baron/melee")
    Goto See
	
  PainMain:
    CBAR H 2
    CBAR H 2 A_Pain
    Goto See
	
  XDeathMain:
  DeathMain:
    TNT1 A 0 A_BossDeath
    TNT1 A 0 A_GiveInventory ("RLCyberneticBaronOfHellKillIncrementer", 1, AAPTR_PLAYER1) // Used for tallying total kills and bestiary info
    CBAR I 8
    CBAR J 8 A_Scream
	TNT1 A 0 A_JumpIf(CallACS("DRLA_MonsterQuake") == 0, 3)
    TNT1 A 0 A_Quake(1, 18, 0, 512, "")
    TNT1 A 0 A_Quake(5, 12, 0, 256, "")
    TNT1 A 0 A_SpawnItemEx ("RLReducedGibber", 0,0,0, VelX,VelY,VelZ, 0, SXF_ABSOLUTEMOMENTUM | SXF_USEBLOODCOLOR | SXF_NOCHECKPOSITION)
    TNT1 A 0 A_Playsound("rlmonsters/fireblast", 6)
    CBAR K 8
    CBAR L 8 A_NoBlocking
    TNT1 A 0 A_SpawnItem ("RLBodyThud", 0, 0, 0, 0)
    CBAR MN 8
    CBAR O 0
    "####" "#" 0 A_Jump(256, "DeathEnd")
    Goto DeathEnd
  SimpleXDeathMain:
    TNT1 A 0 A_BossDeath
    TNT1 A 0 A_GiveInventory ("RLCyberneticBaronOfHellKillIncrementer", 1, AAPTR_PLAYER1) // Used for tallying total kills and bestiary info
    CBAR I 8
    CBAR J 8 A_Scream
    CBAR K 8
    CBAR L 8 A_NoBlocking
    CBAR MN 8
    CBAR O 0
    "####" "#" 0 A_Jump(256, "DeathEnd")
    Goto DeathEnd
  DeathFrame:
    CBAR O 0 A_BossDeath
    "####" "#" 0 A_Jump(256, "DeathEnd")
    Goto DeathEnd
	
	//Ice
  GenericFreezeDeath:
	"####" "#" 0 A_GiveInventory ("RLCyberneticBaronOfHellKillIncrementer", 1, AAPTR_PLAYER1) // Used for tallying total kills and bestiary info
    "####" "#" 0 A_Jump(256, "GenericFreezeMana")
    Goto GenericFreezeMana
	
  Raise:
	TNT1 A 0 ACS_NamedExecuteAlways("DRLA_Normalization") // Removes any palette abnormalities
	TNT1 A 0 A_SetScale(1) // resets altered enemies to default, make sure to match the scale factor in properties here!
    TNT1 A 0 A_ChangeFlag ("NOBLOCKMAP", 0)
    TNT1 A 0 A_ChangeFlag ("NOPAIN", 1)
    CBAR O 2
    TNT1 A 0 A_JumpIfInventory ("RLNightmareResurrectionToken", 1, "NightmareRaise")
    TNT1 A 0 A_JumpIfInventory ("RLCyberneticResurrectionToken", 1, "CyberneticRaise")
    TNT1 A 0 A_SpawnItemEx ("RLResurrectionFire", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
  RaiseContinue:
    TNT1 A 0 A_ChangeFlag ("NOPAIN", 0)
    CBAR ONMLKJI 8
    Goto See
  NightmareRaise:
    TNT1 A 0 A_SpawnItemEx ("RLNightmareResurrectionFire", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION) 
    Goto RaiseContinue
  CyberneticRaise:
    TNT1 A 0 A_SpawnItemEx ("RLCyberneticResurrectionSparks", 0, 0, 20, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
    Goto RaiseContinue
	
  CrushDRLA:
    TNT1 A 30 A_SpawnItemEx("RLCrushedMediumGreen",0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION)
    "####" "#" 0 A_BossDeath
    "####" "#" 0 A_Jump(256, "CrushEnd")
    Goto CrushEnd
//==============================================================================
//					--	DOOMRL ARSENAL STUFF  --
//==============================================================================
  Pain.RigelBlast:
    TNT1 A 0 A_PlaySound("weapons/dn2gunhit", CHAN_BODY)
    D2F2 L 2 Bright
    Goto See
  Pain.NeuralStun:
    D2F2 L 2 Bright
    Goto See
  Pain.CyberDisruptor:
    TNT1 A 0
    Goto Pain.LightningBlue
	
  Death.NeuralStun:
    TNT1 A 0
    Goto Death
  Death.RigelBlast:
    TNT1 A 0 A_BossDeath
    TNT1 A 0 A_GiveInventory ("RLDuke2Score", 2000, AAPTR_TARGET)
    TNT1 A 0 A_GiveInventory ("RLCyberneticBaronOfHellKillIncrementer", 1, AAPTR_PLAYER1) // Used for tallying total kills and bestiary info
    TNT1 A 0 A_PlaySound("weapons/dn2gunexplosion", CHAN_BODY)
    TNT1 A 0 A_NoBlocking
    TNT1 A 0 A_SpawnItemEx ("RLDuke2BasicEnemyExplosions", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION)
    TNT1 A 35
    Stop
  XDeath.RigelBlast:
	TNT1 A 0 A_JumpIf(CallACS("DRLA_Gibs"), 1)
	Goto Death.RigelBlast
    TNT1 A 0 A_BossDeath
    TNT1 A 0 A_GiveInventory ("RLDuke2Score", 2000, AAPTR_TARGET)
    TNT1 A 0 A_GiveInventory ("RLCyberneticBaronOfHellKillIncrementer", 1, AAPTR_PLAYER1) // Used for tallying total kills and bestiary info
    TNT1 A 0 A_PlaySound("weapons/dn2gungib", CHAN_BODY)
    TNT1 A 0 A_NoBlocking
    TNT1 A 0 A_SpawnItemEx ("RLDuke2BasicEnemyExplosions", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION)
    TNT1 A 0 A_SpawnItemEx ("RLDuke2Gibber", 0,0,0, VelX,VelY,VelZ, 0, SXF_ABSOLUTEMOMENTUM | SXF_NOCHECKPOSITION)
    TNT1 A 35
    Stop
	
//==============================================================================
//					--	Special Monster Attacks  --
//==============================================================================
  ShadowAuraMissileAttack:
    TNT1 A 0 A_Jump(128, "Melee")
    CBAR EE 10 A_FaceTarget
    CBAR F 4 Bright A_CustomMissile("RLTechnoLordMissile", 27, 16, frandom(-1,1))
    CBAR E 4 A_FaceTarget
    CBAR F 4 Bright A_CustomMissile("RLTechnoLordMissile", 27, 16, frandom(-1,1))
    CBAR E 4 A_FaceTarget
    CBAR F 4 Bright A_CustomMissile("RLTechnoLordMissile", 27, 16, frandom(-1,1))
    CBAR E 4 A_FaceTarget
    CBAR F 4 Bright A_CustomMissile("RLTechnoLordMissile", 27, 16, frandom(-1,1))
    CBAR E 4 A_FaceTarget
    CBAR F 4 Bright A_CustomMissile("RLTechnoLordMissile", 27, 16, frandom(-1,1))
    CBAR E 10 A_FaceTarget
    Goto See

//==============================================================================
//					--	Final Doomer Compatibility Stuff  --
//==============================================================================
  DeathXSparkFrame:
    "####" "#" 0 A_JumpIfInTargetInventory("Mana",0,2)
    "####" "#" 0 A_DropItem("MajorManaPod",-1,54)
    CBAR H 0 A_BossDeath
    "####" "#" 0 A_Jump(256, "DeathXSpark")
	Goto DeathXSpark
	
//==============================================================================
//					--	Guncaster Compatibility Stuff  --
//==============================================================================
	MidasFrame1:
		CBAR H 0 A_SpawnItemEx("Midas_Statue_BaronOfHell", 0,0,0, 0,0,0, 0,SXF_TRANSFERPOINTERS|SXF_TRANSFERSPRITEFRAME)
		TNT1 A 0 A_JumpIf(1, "DestroyedEnd")
		Goto DestroyedEnd
	MidasFrame2:
		CBAR H 0 A_SpawnItemEx("Midas_Statue_BaronOfHell", 0,0,0, frandom(-10.0,-12.0),0,frandom(1.0,3.0), 0,SXF_TRANSFERPOINTERS|SXF_SETMASTER|SXF_TRANSFERSPRITEFRAME)
		TNT1 A 10 A_KillChildren
		TNT1 A 0 A_JumpIf(1, "DestroyedEnd")
		Goto DestroyedEnd
	MidasFrame3:
		CBAR H 0 A_SpawnItemEx("Midas_Statue_BaronOfHell", 0,0,0, frandom(-15.0,-20.0),0,frandom(10.0,15.0), 0,SXF_TRANSFERPOINTERS|SXF_SETMASTER|SXF_TRANSFERSPRITEFRAME)
		TNT1 A 10 A_KillChildren
		TNT1 A 0 A_JumpIf(1, "DestroyedEnd")
		Goto DestroyedEnd
		
	//Gumpop
	Death.Acid:
		CBAR H 1 A_ChangeFlag("SOLID",0)
		"####" "#" 1 A_Playsound("Gumpop/Expand",5)
		"####" "###################################" 1 A_SetScale(ScaleX+frandom(0.01,0.025))
		"####" "#" 1 A_Playsound("Gumpop/Pop",5)
		"####" "#" 0 A_Jump(256,"XDeathMain")
		Goto XDeathMain
		
	//Thunderstruck
	Pain.Lightning:
		"####" "#" 0 A_Jump(164,1)
		Goto Pain
		CBAR H 0 A_ChangeFlag("NOPAIN",1)
		"####" "#" 0 A_SetUserVar("User_LightningLock", User_LightningLock + 10)
		"####" "#" 0 A_Jump(256,"LightningLock")
		Goto LightningLock
		
	//Cauterizer
	Pain.LightningBlue:
		"####" "#" 0 A_Jump(48,1)
		Goto Pain
		CBAR H 0 A_ChangeFlag("NOPAIN",1)
		"####" "#" 0 A_SetUserVar("User_LightningLock", User_LightningLock + 10)
		"####" "#" 0 A_Jump(256,"BlueLightningLock")
		Goto BlueLightningLock
  }
}

ACTOR RLTechnoLordMiniMissile : Rocket
{
  Radius 5
  Height 3
  Scale 0.7
  Speed 20
  Decal "RevenantScorch"
  Damage 6
  Damagetype "Fire"
  PainType "Explosion"
  DeathType "Explosion"
  SeeSound "rlmonsters/minimissile"
  DeathSound "rlmonsters/smallexp"
  -DEHEXPLOSION
  -ROCKETTRAIL
  +THRUGHOST
  +NOTIMEFREEZE
  +BLOODSPLATTER
  States
  {
  Spawn:
    FROX A 1 Bright
    Goto Spawn
  Death:
    FREX A 6 Bright A_Explode (16,32)
    FREX B 4 Bright
    FREX C 2 Bright
    Stop
  }
}

ACTOR RLSummonTechnoLordMiniMissile : RLTechnoLordMiniMissile
{
  +MTHRUSPECIES
}

ACTOR RLCyberneticBaronOfHellReborn : RLCyberneticBaronOfHell
{
  +LOOKALLAROUND
  +NOPAIN
  States
  {
  Spawn:
    TNT1 A 0 NoDelay A_JumpIfInventory("RLResurrectionComplete", 1, "SpawnNormal")
    CBAR ONMLKJI 8
    TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
    TNT1 A 0 A_GiveInventory("RLResurrectionComplete", 1)
  SpawnNormal:
    CBAR BD 10 A_Look
    Loop
  }
}

ACTOR RLDRPGSummonedCyberneticBaronOfHell : RLCyberneticBaronOfHell
{
  -COUNTKILL
  +NOBLOCKMONST
  +NOTELESTOMP
  +NOFEAR
  +SEEINVISIBLE
  +DONTDRAIN
  +ALWAYSFAST
  +QUICKTORETALIATE
  +MISSILEMORE
  +THRUSPECIES
  Species "Player"
  States
  {
  Spawn:
	TNT1 A 0 NoDelay ACS_NamedExecuteAlways("MonsterInit", 0)
    TNT1 A 0 A_GiveInventory ("RLMonsterInitializerToken", 1)
    TNT1 A 0 A_GiveInventory ("DRPGDRLASummonedMonsterToken", 1)
	Goto Super::Spawn
	See:
	TNT1 A 0 ACS_NamedExecuteAlways("MonsterInit", 0)
    TNT1 A 0 A_GiveInventory ("RLMonsterInitializerToken", 1)
    TNT1 A 0 A_GiveInventory ("DRPGDRLASummonedMonsterToken", 1)
	Goto Super::See
  Raise:
    Stop
  }
}

ACTOR RLCCCyberneticBaronOfHell : RLCyberneticBaronOfHell
{
  +TOUCHY
  States
  {
  Spawn:
    CBAR BD 10 A_Look
    Loop
  See:
    CBAR AABBCCDD 3
    Loop
  Missile:
    CBAR E 20
    CBAR F 4 Bright
    CBAR E 4
    CBAR F 4 Bright
    CBAR E 4
    CBAR F 4 Bright
    CBAR E 4
    CBAR F 4 Bright
    CBAR E 4
    CBAR F 4 Bright
    CBAR E 10
    Goto See
  Melee:
    CBAR PQ 8
    CBAR R 8
    Goto See
  Death:
    CBAR I 8
    CBAR J 8 A_Scream
    CBAR K 8
    CBAR L 8 A_NoBlocking
    CBAR MN 8
    CBAR O -1 A_BossDeath
    Stop
  }
}
