
ACTOR RLHellKnightBase : RLMonster
{
  Health 500
  GibHealth -75
  Radius 24
  Height 64
  Speed 8
  Mass 1000
  Bloodcolor "DarkGreen"
  
  PainChance 50
  
  DamageFactor "Blessed", 3.0 // LegenDoom Damagetype
  
  SeeSound "knight/sight"
  PainSound "hellknight/pain"
  DeathSound "knight/death"
  ActiveSound "knight/active"
  
  +FLOORCLIP
  +BLOODSPLATTER
  
  Obituary "%o was finished off by a Hell Knight."
  HitObituary "%o was opened up like a tin can by a Hell Knight."
  Species "RLHellNoble"
  Tag "Hell Knight"
  
	//Guncaster extras
   
	//Resists & Weaknesses
	DamageFactor Acid, 0.8
 
	//Chance Effects
	PainChance Crow, 2
	PainChance Crow2, 2
	PainChance Lightning, 128
	PainChance LightningBlue, 16
	PainChance Manuel, 50
	PainChance Fire, 50
  States
  {
	// Hell nobles hate cacodemons, any infighting that starts between them will be to the death.
  MissileHatredList:
    "####" "#" 0 A_JumpIf(CheckClass("Cacodemon", AAPTR_TARGET, TRUE), "MissileHatredOn")
    "####" "#" 0 A_JumpIf(CheckClass("RLCacodemonBase", AAPTR_TARGET, TRUE), "MissileHatredOn")
    "####" "#" 0 A_JumpIfInventory ("RLHatredToken", 1, "MissileHatredOff")
    "####" "#" 0 A_JumpIf(1, "MissileFriendlyCheck")
	Goto MissileFriendlyCheck
  MeleeHatredList:
    "####" "#" 0 A_JumpIf(CheckClass("Cacodemon", AAPTR_TARGET, TRUE), "MeleeHatredOn")
    "####" "#" 0 A_JumpIf(CheckClass("RLCacodemonBase", AAPTR_TARGET, TRUE), "MeleeHatredOn")
    "####" "#" 0 A_JumpIfInventory ("RLHatredToken", 1, "MeleeHatredOff")
    "####" "#" 0 A_JumpIf(1, "MeleeFriendlyCheck")
	Goto MeleeFriendlyCheck

//==============================================================================
//					--	GunCaster Compatibility Stuff  --
//==============================================================================	
// Override death states to drop the larger mana items in Guncaster
  Death:
    "####" "#" 0 A_StopSound(5)
    "####" "#" 0 A_StopSound(6)
    "####" "#" 0 A_StopSound(7)
    "####" "#" 0 A_StopSound(CHAN_ITEM)
    "####" "#" 0 A_StopSound(CHAN_WEAPON)
    "####" "#" 0 A_JumpIfInTargetInventory("Mana",0,2)
	"####" "#" 0 A_DropItem("MajorManaPod",-1,224)
    "####" "#" 0 A_JumpIf(1, "DeathMain")
    Goto DeathMain
  XDeath:
    "####" "#" 0 A_StopSound(5)
    "####" "#" 0 A_StopSound(6)
    "####" "#" 0 A_StopSound(7)
    "####" "#" 0 A_StopSound(CHAN_ITEM)
    "####" "#" 0 A_StopSound(CHAN_WEAPON)
    "####" "#" 0 A_JumpIfInTargetInventory("Mana",0,2)
	"####" "#" 0 A_DropItem("MajorManaPod",-1,224)
    "####" "#" 0 A_JumpIf(1, "XDeathMain")
    Goto XDeathMain
	
	GenericFreezeMana:
		"####" "#" 0 A_JumpIfInTargetInventory("Mana",0,2)
		"####" "#" 0 A_DropItem("MajorManaPod",-1,54)
		"####" "#" 0 A_JumpIf(1,"GenericFreezeDeathMain")
		Goto GenericFreezeDeathMain

//------------------------------------------------------------------------------

	Death.MidasCloseCombat:
	Death.MidasShoelaces:
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_JumpIfInTargetInventory("Mana",0,2)
		TNT1 A 0 A_DropItem("MajorManaPod",-1,54)
		TNT1 A 0 A_Pain
		TNT1 A 0 A_PlaySound("Midas/Touched")
		TNT1 A 0 A_JumpIf(1, "MidasFrame1")
		Goto MidasFrame1
		
	//Scourgebreath
	Death.Breath:
		"####" "#" 0 A_StopSound(5)
		"####" "#" 0 A_JumpIfInTargetInventory("Mana",0,2)
		"####" "#" 0 A_DropItem("MajorManaPod",-1,54)
		"####" "#" 0 A_JumpIf(1,"DeathBreathContinue")
		Goto DeathBreathContinue
		
			//Corpseblast
	CorpseBlastA:
		"####" "#" 0 A_SpawnItemEx("HellKnightBlast",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
		Stop
	CorpseBlastB:
		"####" "#" 0 A_SpawnItemEx("HellKnightBlast",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
		"####" "#" 0 A_TakeInventory("CorpseTrigger2",1)
		"####" "#" 0 A_JumpIf(1,"DeathEnd")
		Goto DeathEnd
	CorpseBlastC:
		"####" "#" 0 A_SpawnItemEx("HellKnightBlast",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
		"####" "#" 0 A_TakeInventory("CorpseTrigger2",1)
		"####" "#" 0 A_JumpIf(1,"XDeathEnd")
		Goto XDeathEnd
  }
}
