//------------------------------------------------------------------------------------------------------------------------
//	TorturedSoul
//
//
//	Taken from ZDoom Monster Pack
//	Created by Xaser
//	Original Sprites by Assmaster
//	Modified by M@@@H!aK (death types etc.)
//------------------------------------------------------------------------------------------------------------------------
Actor Satanic_TorturedSoul : Cacodemon 5012
{ 
	Health			700 
	Speed			8 
	Radius			31 
	Height			56 
	PainChance		64 
	Mass			400 
	ReactionTime 	8 
    ExplosionDamage 40
	ExplosionRadius 80
	MissileType Satanic_TorturedSoulBall 
	DamageFactor NoDamage,	 		0
	PainChance "Turn", 255
	PainChance "Fire", 				0
	PainChance "Posession", 		255
	SeeSound 	"Satanic/Monsters/TorturedSoul/Sight" 
	PainSound 	"Satanic/Monsters/TorturedSoul/Pain" 
	DeathSound 	"Satanic/Monsters/TorturedSoul/Death" 
	ActiveSound	"Satanic/Monsters/TorturedSoul/Active" 
	Obituary "%o was tormented by the Tortured Soul." 
	MONSTER 
	-FRIENDLY
	+NOGRAVITY 
	+FLOAT
	+MISSILEMORE
	+MISSILEEVENMORE
    States 
	{ 
	Spawn: 
		TORT A 0 Thing_Hate(0,669,3)
		TORT AB 10 A_Look 
		Goto Spawn+1
	See:
		TORT I 0 A_JumpIfInventory("Satanic_IsPosessed",1,1)
		Goto StandardSee
		TORT A 0
		Goto PosessedMove
	PosessedMove:
		TORT A 0 A_JumpIfInventory("Satanic_PosessedFire",1,1)
		Goto PosessedCheckAltFire
		TORT A 0
		Goto PosessedFire
	PosessedCheckAltFire:
		TORT A 0 A_JumpIfInventory("Satanic_PosessedAltFire",1,1)
		Goto PosessedStandardMove
		TORT A 0
		Goto PosessedAltFire
	PosessedFire:
		TORT E 4
		TORT F 4 A_CustomMissile("Satanic_TorturedSoulBall",32.0,0,0.0,2,-pitch)
		TORT A 2
		TORT A 0 A_TakeInventory("Satanic_PosessedFire",1)
		Goto See
	PosessedAltFire:
		TORT E 9
		TORT F 9 A_CustomMissile("Satanic_TorturedSoulPoison",32.0,0,0.0,2,-pitch)
		TORT A 9
		TORT A 0 A_TakeInventory("Satanic_PosessedAltFire",1)
		Goto See
	PosessedStandardMove:
		TORT AAAAAABBBBBBCCCCCCDDDDDD 1 ACS_Execute(803,0,48,45,5)
		TORT A 0 A_JumpIfInventory("Satanic_IsPosessed",1,1)
		Goto Spawn+1
		TORT A 0
		Goto See
	StandardSee: 
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		TORT A 3 A_Chase 
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		TORT A 3 A_Chase 
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		TORT B 3 A_Chase 
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		TORT B 3 A_Chase 
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		TORT C 3 A_Chase 
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,"Wander",AAPTR_PLAYER1)
		TORT C 3 A_Chase 
		Goto See 
	Wander:
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See 
		TORT A 3 A_Wander 
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See 
		TORT A 3 A_Wander 
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See 
		TORT B 3 A_Wander 
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See 
		TORT B 3 A_Wander 
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See 
		TORT C 3 A_Wander 
		TNT1 A 0 A_JumpIfInventory("PowerNecShroud",1,1,AAPTR_PLAYER1)
		Goto See 
		TORT C 3 A_Wander 
		Goto See 
	Melee:
	Missile: 
		TORT D 10 A_FaceTarget 
		TORT D 0 A_Jump(128,4) 
		TORT E 4 A_FaceTarget 
		TORT E 0 A_PlaySound("Satanic/Monsters/TorturedSoul/Attack") 
		TORT F 4 A_CustomMissile(Satanic_TorturedSoulBall, 40, 0, 0) 
		Goto See 
		TORT D 0 A_PlaySound("Satanic/Monsters/TorturedSoul/Poison") 
		TORT D 4 A_CustomMissile(Satanic_TorturedSoulPoison, 16, 0, 0) 
		Goto See
	Pain.Posession:
		TORT G 0
		TORT G 0 ACS_ExecuteAlways(791,0,40,0,0)
		TORT G 0 A_GiveInventory("Satanic_IsPosessed",1)
		TORT G 0 Thing_ChangeTID(0,669)
		TORT G 0 ACS_ExecuteAlways(802,0,48,0,0)
		Goto See
	Pain.DrainHealthEver:
		TORT G 0
		TORT G 0 ACS_ExecuteAlways(772,0,4,0,0)	
	Pain.Turn:
		TNT1 A 0 A_PlaySound("Satanic/Weapons/BellRing",CHAN_WEAPON)
		TNT1 A 0 ACS_Execute(824,0,20,0,0)
		TORT G 3 
		TNT1 A 0 A_ChangeFlag("Friendly",1)
		TORT G 3 A_Pain 
		Goto See 
	Pain: 
		TORT H 0 A_JumpIfInventory("Satanic_IsPosessed",1,1)
		Goto Pain+2
		TORT H 0
		Goto See
		TORT G 3 
		TORT G 3 A_Pain 
		Goto See 
	Death:
		TORT I 0 A_JumpIfInventory("Satanic_IsPosessed",1,1)
		Goto ActualDeath
		TORT I 0 ACS_ExecuteAlways(801,0,0,0,0)
		TORT I 0 ChangeCamera(0, 0, 0) 
		Goto ActualDeath
	Death.DrainMana:
		TROX I 0 A_JumpIfInventory("Satanic_IsPosessed",1,1)
		Goto ActualDeathDrainMana
		TORT I 0 ACS_ExecuteAlways(801,0,0,0,0)
		TORT I 0 ChangeCamera(0, 0, 0) 
		Goto ActualDeathDrainMana
	Death.DrainHealthEver:
	Death.DrainHealth:
		TROX I 0 A_JumpIfInventory("Satanic_IsPosessed",1,1)
		Goto ActualDeathDrainHealth
		TORT I 0 ACS_ExecuteAlways(801,0,0,0,0)
		TORT I 0 ChangeCamera(0, 0, 0) 
		Goto ActualDeathDrainHealth
	Death.DemonFire:
	Burn:
		TROX I 0 A_JumpIfInventory("Satanic_IsPosessed",1,1)
		Goto ActualBurn
		TORT I 0 ACS_ExecuteAlways(801,0,0,0,0)
		TORT I 0 ChangeCamera(0, 0, 0) 
		Goto ActualBurn
	ActualDeath: 
		TORT H 8 A_SpawnItem("Satanic_SmokeSpawner")
		TORT I 8 A_Scream 
		TORT JK 8 A_SpawnItem("Satanic_SmokeSpawner")
		TORT L 0 A_CustomMissile(Satanic_TorturedSoulPoison, 32, 0, 0) 
		TORT L 0 A_CustomMissile(Satanic_TorturedSoulPoison, 32, 0, 45) 
		TORT L 0 A_CustomMissile(Satanic_TorturedSoulPoison, 32, 0, 90) 
		TORT L 0 A_CustomMissile(Satanic_TorturedSoulPoison, 32, 0, 135) 
		TORT L 0 A_CustomMissile(Satanic_TorturedSoulPoison, 32, 0, 180) 
		TORT L 0 A_CustomMissile(Satanic_TorturedSoulPoison, 32, 0, 225) 
		TORT L 0 A_CustomMissile(Satanic_TorturedSoulPoison, 32, 0, 270) 
		TORT L 0 A_CustomMissile(Satanic_TorturedSoulPoison, 32, 0, 315) 
		TORT L 8 A_SpawnItem("Satanic_SmokeSpawner") 
		TORT M 8 A_NoBlocking 
		TORT N 8 
		Stop 
	ActualDeathDrainMana:
		TORT H 0 ACS_ExecuteAlways(779,0,12,0,0)
		TORT H 8 A_SpawnItem("Satanic_SmokeSpawner")
		TORT I 8 A_Scream 
		TORT JK 8 A_SpawnItem("Satanic_SmokeSpawner")
		TORT L 8  A_SpawnItem("Satanic_SmokeSpawner")
		TORT M 8 A_NoBlocking 
		TORT N 8 
		Stop 
	ActualDeathDrainHealth:
		TORT H 0 ACS_ExecuteAlways(772,0,20,0,0)
		TORT H 8 A_SpawnItem("Satanic_SmokeSpawner")
		TORT I 8 A_Scream 
		TORT JK 8 A_SpawnItem("Satanic_SmokeSpawner")
		TORT L 8  A_SpawnItem("Satanic_SmokeSpawner")
		TORT M 8 A_NoBlocking 
		TORT N 8 
		Stop 
	ActualBurn:
		TORT H 0 A_CustomMissile("Satanic_HellfireDeviceBoltSecondary",Random(0,64),0,Random(-360,360),0,0)
		TORT H 0 A_CustomMissile("Satanic_HellfireDeviceBoltSecondary",Random(0,64),0,Random(-360,360),0,0)
		TORT H 0 A_CustomMissile("Satanic_HellfireDeviceBoltSecondary",Random(0,64),0,Random(-360,360),0,0)
		TORT H 0 A_CustomMissile("Satanic_HellfireDeviceBoltSecondary",Random(0,64),0,Random(-360,360),0,0)
		TORT H 0 A_CustomMissile("Satanic_HellfireDeviceBoltSecondary",Random(0,64),0,Random(-360,360),0,0)
		TORT H 0 A_CustomMissile("Satanic_FireStarter",6,Random(-20,20),Random(-360,360),0)         
		TORT H 0 A_CustomMissile("Satanic_FireStarter",6,Random(-20,20),Random(-360,360),0)
		TORT H 8 A_SpawnItem("Satanic_SmokeSpawner")
		TORT I 8 A_Scream 
		TORT JK 8 A_SpawnItem("Satanic_SmokeSpawner")
		TORT L 0 A_CustomMissile(Satanic_TorturedSoulPoison, 32, 0, 0) 
		TORT L 0 A_CustomMissile(Satanic_TorturedSoulPoison, 32, 0, 45) 
		TORT L 0 A_CustomMissile(Satanic_TorturedSoulPoison, 32, 0, 90) 
		TORT L 0 A_CustomMissile(Satanic_TorturedSoulPoison, 32, 0, 135) 
		TORT L 0 A_CustomMissile(Satanic_TorturedSoulPoison, 32, 0, 180) 
		TORT L 0 A_CustomMissile(Satanic_TorturedSoulPoison, 32, 0, 225) 
		TORT L 0 A_CustomMissile(Satanic_TorturedSoulPoison, 32, 0, 270) 
		TORT L 0 A_CustomMissile(Satanic_TorturedSoulPoison, 32, 0, 315)
		TORT L 8 A_SpawnItem("Satanic_SmokeSpawner")
		TORT M 8 A_NoBlocking 
		TORT N 8 
		Stop 
	} 
}

Actor Satanic_TorturedSoulBall 
{ 
	Radius 	8 
    Height 	6 
    Speed 	20 
    Damage 	5 
    RenderStyle Add
	Alpha 		0.67
	Decal Scorch
	DeathSound "imp/shotx" 
	PROJECTILE 
    States 
    { 
	Spawn: 
		TRBL AB 4 
		Loop 
	Death: 
		TRBL CDE 4 
		Stop 
    } 
} 

Actor Satanic_TorturedSoulPoison 
{ 
	Radius	24 
    Height	6 
    Speed	5 
    Damage	1 
	RenderStyle Translucent
	Alpha 		0.67
	PROJECTILE 
	+STRIFEDAMAGE 
    +RIPPER 
    States 
    { 
	Spawn: 
		TRPS ABCDEFGDEFGDEFGDEFGDEFGDCBA 4 
		Stop 
	Death: 
		TRPS DCBA 4 
		Stop 
    } 
} 