Actor Satanic_ImpDefault : DoomImp 5005
{  
	Health 72
	Height 42
	SpawnID 5 
	-FRIENDLY
	+MISSILEMORE
	+MISSILEEVENMORE
	Mass 300
	DamageFactor NoDamage,	 		0
	PainChance "Turn", 255
	PainChance "Fire", 				0
	PainChance "Posession", 		255
	States
	{
	Spawn:
		TROO A 0 Thing_Hate(0,669,3)
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget10",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO A 10 A_Look
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget10",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO B 10 A_Look
		Goto Spawn+1
	See:
		TROO I 0 A_JumpIfInventory("Satanic_IsPosessed",1,1)
		Goto StandardSee
		TROO A 0
		Goto PosessedMove
	PosessedMove:
		TROO A 0 A_JumpIfInventory("Satanic_PosessedFire",1,1)
		Goto PosessedStandardMove
		TROO A 0
		Goto PosessedFire
	Melee:
	Missile:
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget10",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO E 8 A_FaceTarget
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget10",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO F 8 A_FaceTarget
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget10",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO G 6 A_TroopAttack 
		Goto See
	PosessedFire:
		TROO E 0 ACS_ExecuteAlways(805,0,0,0,0)
		TROO E 2 
		TROO E 0 ACS_ExecuteAlways(805,0,1,0,0)
		TROO F 2 
		TROO E 0 ACS_ExecuteAlways(805,0,2,0,0)
		TROO G 3 A_CustomMissile("Satanic_DoomImpBall",32.0,12,0.0,2,-pitch)
		TROO E 0 ACS_ExecuteAlways(805,0,3,0,0)
		TROO E 2 
		TROO E 0 ACS_ExecuteAlways(805,0,0,0,0)
		TROO E 0 A_TakeInventory("Satanic_PosessedFire",1)
		Goto See
	PosessedStandardMove:
		TROO AAAAAABBBBBBCCCCCCDDDDDD 1 ACS_Execute(803,0,48,30,1)
		TROO A 0 A_JumpIfInventory("Satanic_IsPosessed",1,1)
		Goto Spawn+1
		TROO A 0
		Goto See
	StandardSee:
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO A 3 A_Chase
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO A 3 A_Chase
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO B 3 A_Chase
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO B 3 A_Chase
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO C 3 A_Chase
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO C 3 A_Chase
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO D 3 A_Chase
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO D 3 A_Chase
		Goto See 
	Wander:
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO A 3 A_Wander
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO A 3 A_Wander
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO B 3 A_Wander
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO B 3 A_Wander
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO C 3 A_Wander
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO C 3 A_Wander
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO D 3 A_Wander
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO D 3 A_Wander
		Goto See 
	Pain.Bludgeon:
		TROO H 0 ThrustThing(45,15,0)
		TROO H 3
		TROO H 3 A_Pain
		Goto See
	Pain:
		TROO H 0 A_JumpIfInventory("Satanic_IsPosessed",1,1)
		Goto NonPosessedPain
		TROO H 0
		Goto See
	NonPosessedPain:	
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO H 2
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO H 2 A_Pain
		Goto See
	Pain.Turn:
		TNT1 A 0 A_PlaySound("Satanic/Weapons/BellRing",CHAN_WEAPON)
		TNT1 A 0 ACS_Execute(824,0,20,0,0)
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO H 2
		TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TNT1 A 0 A_ChangeFlag("Friendly",1)
		TROO H 2 A_Pain
		Goto See
	Pain.Posession:
		TROO H 0
		TROO H 0 ACS_ExecuteAlways(791,0,5,0,0)
		TROO H 0 A_GiveInventory("Satanic_IsPosessed",1)
		TROO H 0 Thing_ChangeTID(0,669)
		TROO H 0 ACS_ExecuteAlways(802,0,48,0,0)
		Goto See
	Pain.DrainHealthEver:
		TROO H 0
		TROO H 0 ACS_ExecuteAlways(772,0,1,0,0)
    	TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO H 2
    	TNT1 A 0 A_SpawnItemEx("ImpHeadTarget",0,0,42,velx,vely,velz,0,SXF_SETMASTER)
		TROO H 2 A_Pain
    	Goto See
	Death:
		TROO I 0 A_JumpIfInventory("Satanic_IsPosessed",1,1)
		Goto ActualDeath
		TROO I 0 ACS_ExecuteAlways(801,0,0,0,0)
		TROO I 0 ChangeCamera(0, 0, 0) 
		Goto ActualXDeath
	XDeath:
		TROO I 0 A_JumpIfInventory("Satanic_IsPosessed",1,1)
		Goto ActualXDeath
		TROO I 0 ACS_ExecuteAlways(801,0,0,0,0)
		TROO I 0 ChangeCamera(0, 0, 0) 
		Goto ActualXDeath
	Death.DrainMana:
		TROO I 0 A_JumpIfInventory("Satanic_IsPosessed",1,1)
		Goto ActualDeathDrainMana
		TROO I 0 ACS_ExecuteAlways(801,0,0,0,0)
		TROO I 0 ChangeCamera(0, 0, 0) 
		Goto ActualDeathDrainMana
	Death.DrainHealthEver:
	Death.DrainHealth:
		TROO I 0 A_JumpIfInventory("Satanic_IsPosessed",1,1)
		Goto ActualDeathDrainHealth
		TROO I 0 ACS_ExecuteAlways(801,0,0,0,0)
		TROO I 0 ChangeCamera(0, 0, 0) 
		Goto ActualDeathDrainHealth
	Death.DemonFire:
	Burn:
		TROO I 0 A_JumpIfInventory("Satanic_IsPosessed",1,1)
		Goto ActualBurn
		TROO I 0 ACS_ExecuteAlways(801,0,0,0,0)
		TROO I 0 ChangeCamera(0, 0, 0) 
		Goto ActualBurn
	Death.BoomHeadshot:
		TNT1 AA 0 A_GiveToTarget("DrainedHealth",1)
		TNT1 A 0 A_XScream
		IMPH A 12 A_SpawnItemEx("SRBloodFountain",0,0,42,velx,vely,velz,0)
		IMPH A 12 A_SpawnItemEx("SRBloodFountain",0,0,42,velx,vely,velz,0)
		IMPH A 12 A_SpawnItemEx("SRBloodFountain",0,0,42,velx,vely,velz,0)
		IMPH B 8 
		IMPH C 6
		IMPH D 6 A_NoBlocking
		TROO M -1
	ActualDeath:
		TROO I 8
		TROO J 8 A_Scream
		TROO K 6
		TROO L 6 A_NoBlocking
		TROO M -1
		Stop
	ActualXdeath:
		TNT1 A 0 A_SpawnItem("SRBloodFountain", 0, 0, 0, 0)
		TROO M 0 A_XScream
		TROO M 0 A_Fall
		TROO M 0 A_CustomMissile("Satanic_Blood",10,0,25,0)     
		TROO M 0 A_CustomMissile("Satanic_Blood",15,0,50,0)     
		TROO M 0 A_CustomMissile("Satanic_Blood",5,0,75,0)     
		TROO M 0 A_CustomMissile("Satanic_Blood",2,0,100,0)     
		TROO M 0 A_CustomMissile("Satanic_Blood",6,0,125,0)     
		TROO N 5
		TNT1 A 0 A_SpawnItem("SRGibGenerator", 0, 0, 0, 0)
		TROO OPQRST 5
		TROO U -1
		Stop
	ActualDeathDrainMana:
		TROO M 0 A_XScream
		TROO M 0 A_Fall
		TROO M 0 A_CustomMissile("Satanic_Blood",10,0,25,0)     
		TROO M 0 A_CustomMissile("Satanic_Blood",15,0,50,0)     
		TROO M 0 A_CustomMissile("Satanic_Blood",5,0,75,0)     
		TROO M 0 A_CustomMissile("Satanic_Blood",2,0,100,0)     
		TROO M 0 ACS_ExecuteAlways(779,0,3,0,0)
		TROO NOPQRST 5 
		TROO U -1
		Stop    
	ActualDeathDrainHealth:
		TROO M 0 A_XScream
		TROO M 0 A_Fall
		TROO M 0 A_CustomMissile("Satanic_Blood",10,0,25,0)     
		TROO M 0 A_CustomMissile("Satanic_Blood",15,0,50,0)     
		TROO M 0 A_CustomMissile("Satanic_Blood",5,0,75,0)     
		TROO M 0 A_CustomMissile("Satanic_Blood",2,0,100,0)     
		TROO M 0 ACS_ExecuteAlways(772,0,5,0,0)
		TROO NOPQRST 5 
		TROO U -1
		Stop    
	ActualBurn:
		TROB M 0 A_XScream
		TROB M 0 A_Fall
		TROB M 0 A_CustomMissile("Satanic_HellfireDeviceBoltSecondary",Random(0,64),0,Random(-360,360),0,0)
		TROB M 0 A_CustomMissile("Satanic_HellfireDeviceBoltSecondary",Random(0,64),0,Random(-360,360),0,0)
		TROB M 0 A_CustomMissile("Satanic_HellfireDeviceBoltSecondary",Random(0,64),0,Random(-360,360),0,0)
		TROB M 0 A_CustomMissile("Satanic_HellfireDeviceBoltSecondary",Random(0,64),0,Random(-360,360),0,0)
		TROB M 0 A_CustomMissile("Satanic_HellfireDeviceBoltSecondary",Random(0,64),0,Random(-360,360),0,0)
		TROB M 0 A_CustomMissile("Satanic_FireStarter",5,0,75,0)     
		TROB M 0 A_CustomMissile("Satanic_FireStarter",5,0,75,0)    
		TROB NOPQRST 5 
		TROB UUUUUU 4 A_SpawnItem("Satanic_SmokeSpawner")
		TROB U 0 A_SpawnItem("Satanic_ImpBurnedCorpse")
		Stop       
	Raise:
		TROO M 1
		TROO M 1 A_SetInvulnerable
		TROO M 1 A_UnsetSolid
		TROO M 1 A_UnsetShootable
		TROO M 1 ACS_ExecuteAlways(788,0,0,0,0)
		TROO M 1
		Stop
	Raise_Spirit:
		TROO MLKJ 6
		TROO J 0 A_SpawnItem("Satanic_RaisedImp")
		Stop
	Raise_ManaRitual:
		TROO MLK 4
		TROO J 4 A_SpawnItem("Satanic_HealthSpirit")
		IMPB A 4 ACS_ExecuteAlways(779,0,3,0,0)
		IMPB B 4 A_SpawnItem("Satanic_HealthSpiritExplosion")
		IMPB CDEFGHI 4
		IMPB J 0 A_SpawnItem("Satanic_ImpBurnedCorpse")
		Stop
	}
}

Actor Satanic_DoomImpBall : DoomImpBall Replaces DoomImpBall
{
	Speed 24
	DamageType DemonFire
	Decal Scorch
}

Actor Satanic_ImpBurnedCorpse
{
	Radius 20
	Height 4
	States
	{
	Spawn:
		IMPB J -1
		Stop
	}
}