
ACTOR RLPainElementalBase : RLMonster
{
  Health 400
  GibHealth -80
  Radius 31
  Height 56
  Speed 8
  Mass 400
  
  PainChance 128
  
  DamageFactor "Maser", 1.2 // Final Doomer Damagetype
  DamageFactor "Antiair", 3.0 // LegenDoom Damagetype
  
  SeeSound "pain/sight"
  PainSound "pain/pain"
  DeathSound "pain/death"
  ActiveSound "pain/active"
  
  +FLOAT
  +NOGRAVITY
  +BLOODSPLATTER
  -FLOORCLIP
  
  Obituary "%o was overwhelmed by a Pain Elemental."
  HitObituary "%o forgot the Pain Elemental has teeth too."
  Species "RLPainElemental"
  Tag "Pain Elemental"
  
	//Guncaster extras
   
	//Resists & Weaknesses
	DamageFactor Meteorfist, 0.8
	DamageFactor CloseCombat, 1.25
	DamageFactor Shoelaces, 1.25
	DamageFactor SuperCloseCombat, 1.25
	DamageFactor SuperShoelaces, 1.25
	DamageFactor SuperMidasCloseCombat, 1.25
	DamageFactor SuperMidasShoelaces, 1.25
	DamageFactor Manuel, 1.25
	DamageFactor Crow, 1.25
	DamageFactor Crow2, 1.25
 
	//Chance Effects
	PainChance Crow, 2
	PainChance Crow2, 2
	PainChance Lightning, 128
	PainChance LightningBlue, 24
	PainChance Manuel, 192
	PainChance Fire, 20
  States
  {
//==============================================================================
//					--	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("PainElementalBlast",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
		Stop
	CorpseBlastB:
		"####" "#" 0 A_SpawnItemEx("PainElementalBlast",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("PainElementalBlast",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
		"####" "#" 0 A_TakeInventory("CorpseTrigger2",1)
		"####" "#" 0 A_JumpIf(1,"XDeathEnd")
		Goto XDeathEnd
  }
}
