
ACTOR RLArchvileBase : RLMonster
{
  Health 700
  GibHealth -80
  Radius 20
  Height 56
  Speed 15
  Mass 500
  
  PainChance 10
  MaxTargetRange 896
  
  DamageFactor "Holy", 2
  DamageFactor "Unholy", 0.25
  DamageFactor "Maser", 0.75 // Final Doomer Damagetype
  DamageFactor "Extinguishing", 3.0 // LegenDoom Damagetype
  
  SeeSound "vile/sight"
  MeleeSound "vile/stop"
  PainSound "vile/pain"
  DeathSound "vile/death"
  ActiveSound "vile/active"
  
  +QUICKTORETALIATE
  +FLOORCLIP
  +NOTARGET
  +SEEINVISIBLE
  
  Obituary "%o couldn't hide from the Arch-Vile."
  Species "RLArchvile"
  Tag "Arch-Vile"
  
  // Guncaster extras
   
  // Resists & Weaknesses
	DamageFactor Meteorfist, 0.7
	DamageFactor Flesh, 0.7
	DamageFactor Lightning, 0.8
	DamageFactor LightningBlue, 0.8
	DamageFactor Crow, 1.3
	DamageFactor Crow2, 1.3
	DamageFactor Manuel, 1.3
	
	// Chance Effects
	PainChance Crow, 2
	PainChance Crow2, 2
	PainChance Lightning, 164
	PainChance LightningBlue, 32
	PainChance Manuel, 96
	PainChance Fire, 10
  States
  {
  MissileFriendlyCheck:
    "####" "#" 0 A_CheckFlag ("FRIENDLY", "MissileSpecialAttackCheck")
    "####" "#" 0 A_CheckFlag ("FRIENDLY", "MissileSpecialAttackCheck", AAPTR_TARGET)
    "####" "#" 0 A_JumpIf(CheckClass("Arachnotron", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("SpiderMastermind", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("Archvile", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("RLArachnotronBase", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("RLSpiderMastermindBase", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("RLArchvileBase", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(1, "MissileSpecialAttackCheck")
	Goto MissileSpecialAttackCheck
//==============================================================================
//					--	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("ArchvileBlast",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
		Stop
	CorpseBlastB:
		"####" "#" 0 A_SpawnItemEx("ArchvileBlast",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("ArchvileBlast",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
		"####" "#" 0 A_TakeInventory("CorpseTrigger2",1)
		"####" "#" 0 A_JumpIf(1,"XDeathEnd")
		Goto XDeathEnd
  }
}
