//-----------------------------------------------------------------------------------------------------------------------
//	EvilDemon
//
//	These guys are really evil... =)
//	Ghosting effect from the Fast Imp from ZDoom Monster Pack
//	Sprites and sounds from Antichrist
//-----------------------------------------------------------------------------------------------------------------------
Actor Satanic_EvilDemon : Demon //Replaces Demon
{
	Speed		14
    PainChance	192
    Mass		400
	Health 		200
	Radius		20
	MeleeDamage 4
	ActiveSound "Satanic/Monsters/EvilDemon/Active"
	SeeSound	"Satanic/Monsters/EvilDemon/Active"
	PainSound 	"Satanic/Monsters/EvilDemon/Active"
	AttackSound "Satanic/Monsters/EvilDemon/Attack"
	DeathSound	"Satanic/Monsters/EvilDemon/Death"
	PainChance "Turn", 255
	DamageFactor NoDamage,	0
	DamageFactor Posession, 0
	MONSTER
	-FRIENDLY
	+LONGMELEERANGE
	+ACTIVATEMCROSS
	HitObituary "%o's last thought was 'These teeth...'"
	States
	{
	Spawn:
		EDEM A 0 Thing_Hate(0,669,3)
		EDEM AB 10 A_Look
		Goto Spawn+1
	See:
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		EDEM AA 1 light ("smallbipedshadow") A_Chase 
		EDEM A 0 A_CustomMissile("Satanic_EvilDemonGhostA", 0, 0, 0) 
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		EDEM BB 1 light ("smallbipedshadow") A_Chase
		EDEM B 0 A_CustomMissile("Satanic_EvilDemonGhostB", 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		EDEM CC 1 light ("smallbipedshadow") A_Chase
		EDEM C 0 A_CustomMissile("Satanic_EvilDemonGhostC", 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		EDEM DD 1 light ("smallbipedshadow") A_Chase
		EDEM D 0 A_CustomMissile("Satanic_EvilDemonGhostD", 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		EDEM AA 1 light ("smallbipedshadow") A_Chase
		EDEM A 0 A_CustomMissile("Satanic_EvilDemonGhostA", 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		EDEM BB 1 light ("smallbipedshadow") A_Chase
		EDEM B 0 A_CustomMissile("Satanic_EvilDemonGhostB", 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		EDEM CC 1 light ("smallbipedshadow") A_Chase
		EDEM C 0 A_CustomMissile("Satanic_EvilDemonGhostC", 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		EDEM DD 1 light ("smallbipedshadow") A_Chase
		EDEM D 0 A_CustomMissile("Satanic_EvilDemonGhostD", 0, 0, 0)
		Goto See
	Wander:
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See
		EDEM AA 1 light ("smallbipedshadow") A_Wander 
		EDEM A 0 A_CustomMissile("Satanic_EvilDemonGhostA", 0, 0, 0) 
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See
		EDEM BB 1 light ("smallbipedshadow") A_Wander
		EDEM B 0 A_CustomMissile("Satanic_EvilDemonGhostB", 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See
		EDEM CC 1 light ("smallbipedshadow") A_Wander
		EDEM C 0 A_CustomMissile("Satanic_EvilDemonGhostC", 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See
		EDEM DD 1 light ("smallbipedshadow") A_Wander
		EDEM D 0 A_CustomMissile("Satanic_EvilDemonGhostD", 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See
		EDEM AA 1 light ("smallbipedshadow") A_Wander
		EDEM A 0 A_CustomMissile("Satanic_EvilDemonGhostA", 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See
		EDEM BB 1 light ("smallbipedshadow") A_Wander
		EDEM B 0 A_CustomMissile("Satanic_EvilDemonGhostB", 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See
		EDEM CC 1 light ("smallbipedshadow") A_Wander
		EDEM C 0 A_CustomMissile("Satanic_EvilDemonGhostC", 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See
		EDEM DD 1 light ("smallbipedshadow") A_Wander
		EDEM D 0 A_CustomMissile("Satanic_EvilDemonGhostD", 0, 0, 0)
		Goto See
	Pain.DrainHealthEver:
		EDEM H 0
		EDEM H 0 ACS_ExecuteAlways(772,0,3,0,0)
		Goto Pain
	Pain.Turn:
		TNT1 A 0 A_PlaySound("Satanic/Weapons/BellRing",CHAN_WEAPON)
		TNT1 A 0 ACS_Execute(824,0,20,0,0)
		EDEM H 4
		TNT1 A 0 A_ChangeFlag("Friendly",1)
		EDEM H 4 A_Pain
		Goto See
	Pain.Bludgeon:	
		EDEM H 0 ThrustThing(45,20,0)
		EDEM H 3
		EDEM H 3 A_Pain
		Goto See
	Pain:
		EDEM H 8
		EDEM H 0 A_SpawnItem("TeleportFog")
		EDEM H 0 A_HideThing
		EDEM A 0 A_GiveInventory("Satanic_EvilDemonHidden",1)
		EDEM AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 2 A_Chase
		EDEM A 0 A_UnHideThing
		EDEM H 0 A_SpawnItem("TeleportFog")
		EDEM A 0 A_TakeInventory("Satanic_EvilDemonHidden",1)
		Goto See
	Melee:
		EDEM H 0 A_JumpIfInventory("Satanic_EvilDemonHidden",1,6)
		EDEM H 8 light ("smallbipedshadow") A_FaceTarget
		EDEM EFGH 2 light ("smallbipedshadow") A_MeleeAttack
		Goto See
		EDEM H 0 A_UnHideThing
		EDEM H 0 A_TakeInventory("Satanic_EvilDemonHidden",1)
		EDEM H 0 A_SpawnItem("TeleportFog")
		Goto Melee+1
	Death:
		EDEM H 0 A_JumpIfInventory("Satanic_EvilDemonHidden",1,1)
		Goto Death+4
		EDEM H 0 A_UnHideThing
		EDEM H 0 A_TakeInventory("Satanic_EvilDemonHidden",1)
		EDEM H 0 A_SpawnItem("TeleportFog")
		EDEM I 0 A_Scream
		EDEM I 0 A_Fall
		EDEM IJKLM 5 light ("smallbipedshadow")
		EDEM N -1 light ("smallbipedshadow")
		Stop
	Death.DrainMana:
		EDEM H 0 light ("smallbipedshadow") A_JumpIfInventory("Satanic_EvilDemonHidden",1,1)
		Goto Death.DrainMana+4
		EDEM H 0 A_UnHideThing
		EDEM H 0 A_TakeInventory("Satanic_EvilDemonHidden",1)
		EDEM H 0 A_SpawnItem("TeleportFog")
		EDEM I 0 A_Scream
		EDEM I 0 A_Fall
		EDEM I 0 ACS_ExecuteAlways(779,0,9,0,0)
		EDEM IJKLM 5 light ("smallbipedshadow")
		EDEM N -1 light ("smallbipedshadow")
		Stop
	Death.DrainHealthEver:		
	Death.DrainHealth:
		EDEM H 0 A_JumpIfInventory("Satanic_EvilDemonHidden",1,1)
		Goto Death.DrainHealth+4
		EDEM H 0 A_UnHideThing
		EDEM H 0 A_TakeInventory("Satanic_EvilDemonHidden",1)
		EDEM H 0 A_SpawnItem("TeleportFog")
		EDEM I 0 A_Scream
		EDEM I 0 A_Fall
		EDEM I 0 ACS_ExecuteAlways(772,0,15,0,0)
		EDEM IJKLM 5 light ("smallbipedshadow")
		EDEM N -1 light ("smallbipedshadow")
		Stop
	Death.DemonFire:
	Burn:
		EDEM H 0 A_JumpIfInventory("Satanic_EvilDemonHidden",1,1)
		Goto Burn+4
		EDEM H 0 A_UnHideThing
		EDEM H 0 A_TakeInventory("Satanic_EvilDemonHidden",1)
		EDEM H 0 A_SpawnItem("TeleportFog")
		EDEM I 0 A_Scream
		EDEM I 0 A_Fall
		EDEM I 0 A_CustomMissile("Satanic_HellfireDeviceBoltSecondary",Random(0,64),0,Random(-360,360),0,0)
		EDEM I 0 A_CustomMissile("Satanic_HellfireDeviceBoltSecondary",Random(0,64),0,Random(-360,360),0,0)
		EDEM I 0 A_CustomMissile("Satanic_HellfireDeviceBoltSecondary",Random(0,64),0,Random(-360,360),0,0)
		EDEM I 0 A_CustomMissile("Satanic_HellfireDeviceBoltSecondary",Random(0,64),0,Random(-360,360),0,0)
		EDEM I 0 A_CustomMissile("Satanic_HellfireDeviceBoltSecondary",Random(0,64),0,Random(-360,360),0,0)
		EDEM I 0 A_CustomMissile("Satanic_FireStarter",6,Random(-20,20),Random(-360,360),0)         
		EDEM I 0 A_CustomMissile("Satanic_FireStarter",6,Random(-20,20),Random(-360,360),0)   
		EDEM IJKLM 5 light ("smallbipedshadow")
		SARB NNNNNNNNN 4 light ("smallbipedshadow") A_SpawnItem("Satanic_SmokeSpawner")
		SARB N 0 A_SpawnItem("Satanic_EvilDemonBurnedCorpse")
		Stop
	Raise:
		EDEM M 1 light ("smallbipedshadow")
		EDEM M 1 light ("smallbipedshadow") A_SetInvulnerable
		EDEM M 1 light ("smallbipedshadow") A_UnsetSolid
		EDEM M 1 light ("smallbipedshadow") A_UnsetShootable
		EDEM M 1 light ("smallbipedshadow") ACS_ExecuteAlways(788,0,0,0,0)
		EDEM M 1 light ("smallbipedshadow")
		Stop
	Raise_Spirit:
		EDEM MLKJ 6 light ("smallbipedshadow")
		EDEM J 0 light ("smallbipedshadow") A_SpawnItem("Satanic_RaisedImp")
		Stop
	Raise_ManaRitual:
		EDEM MLKJ 4 light ("smallbipedshadow")
		EDEM I 4 light ("smallbipedshadow") A_SpawnItem("Satanic_HealthSpirit")
		EVLB A 4 light ("smallbipedshadow") ACS_ExecuteAlways(779,0,9,0,0)
		EVLB B 4 light ("smallbipedshadow") A_SpawnItem("Satanic_HealthSpiritExplosion")
		EVLB C 4 light ("smallbipedshadow")
		EVLB DEFGH 4 light ("smallbipedshadow") 
		EVLB H 0 A_SpawnItem("Satanic_EvilDemonBurnedCorpse")
		Stop
	}
}

Actor Satanic_EvilDemonBurnedCorpse
{
	Radius 20
	Height 4
	States
	{
	Spawn:
		EVLB H -1
		Stop
	}
}

Actor Satanic_EvilDemonHidden : Inventory
{
	Inventory.Amount 	1
	Inventory.MaxAmount 1
}

Actor Satanic_EvilDemonGhostA
{
	Radius 	4
	Height 	8
	Speed 	0
	Damage	0
	RenderStyle Translucent
	Alpha 0.3
	PROJECTILE
	+NOCLIP
	-SOLID
	States
	{
	Spawn:
		EDEM A 15
		Stop
	}
}

Actor Satanic_EvilDemonGhostB : Satanic_EvilDemonGhostA
{
	States
	{
	Spawn:
		EDEM B 15
		Stop
	}
}

Actor Satanic_EvilDemonGhostC : Satanic_EvilDemonGhostA
{
	States
	{
	Spawn:
		EDEM C 15
		Stop
	}
}

Actor Satanic_EvilDemonGhostD : Satanic_EvilDemonGhostA
{
	States
	{
	Spawn:
		EDEM B 15
		Stop
	}
}

ACTOR Runner_EvilDemon : Satanic_EvilDemon
{
	DropItem "HeartHealth" 16
}