///////////////////////////////////////////////
// -- Eviscerator
///////////////////////////////////////////////

ACTOR EvisceratorAmmo : Inventory { Inventory.MaxAmount 20 }

ACTOR Eviscerator 11602
{
	Health 400
	Radius 20
	Height 38
	Speed 2
	PainChance 24
	PainChance "QuickMelee", 255
	DamageFactor "Normal", 0.75
	DamageFactor "head", 0.85
	DamageFactor "minorhead", 0.85
	DamageFactor "Decapitate", 1.15
	DamageFactor "Head_Shotgun", 1.35
	DamageFactor "ExplosiveDamage", 0.6
	DamageFactor "ItemExplode", 0.00
	DamageFactor "Fire", 1.25
	DamageFactor "Dragon", 1.25
	Monster
	+FLOORCLIP
	+NOTARGET
	+NOINFIGHTING
	-FLOAT
	-NOGRAVITY
	MaxTargetRange 512
	MaxDropOffHeight 512
	MinMissileChance 254
	Mass 200
	SeeSound "eviscerator/see"
	PainSound "eviscerator/pain"
	DeathSound "eviscerator/death"
	ActiveSound "eviscerator/breath"
	Obituary "%o had %p body bullet-fucked by an Eviscerator."
	States
	{
	//=============================================================
	// INCENDIARY
	//=============================================================
	Pain.Fire:
	Pain.Dragon:
	Death.Fire:
		VZOF A 0
		VZOF A 0 A_Jump(32,"DragonPain")
		VZOF A 0 A_JumpIf(health < 100, "DragonPain")
		Goto Pain
	DragonPain:
		TNT1 A 0 ACS_ExecuteAlways(72,0,0,50,20)
		BCGN A 1 bright
		VZOF A 0 A_SpawnItemEx("Flaming_Eviscerator",0,0,0)
		Stop
	Death.Dragon:
		TNT1 A 0 ACS_ExecuteAlways(72,0,0,50,20)
		BCGN A 1 bright
		VZOF K 0 A_NoBlocking
		VZOF K 0 A_UnsetShootable
		BCGN EFGHIJ 2 bright
		Goto Charred
	BurningCorpse:
		BSZF A 0 A_JumpIfInventory("CorpseDecayTime",200,"Charred")
		BCGN K 2 bright A_SpawnItemEx("CorpseFlameFX",0,0,0)
		VZOF K 0 A_GiveInventory("CorpseDecayTime",1)
		Loop
	Charred:
		BSZF A 0
		BSZF A 0 A_SpawnItemEx("Charred_Eviscerator",0,0,0)
		Stop
	//=============================================================
	Spawn:
		BSZM A 0
		BSZM A 0 A_JumpIfInventory("HasSpawnedHead",1,"Wandering")
		BSZM A 0 ACS_ExecuteWithResult(49,0,0,0)
		BSZM A 0 ACS_ExecuteAlways(625,0,44,1,0)
		BSZM A 0 A_GiveInventory("HasSpawnedHead",1)
		Goto Wandering
	Wandering:
		ZCGN E 0 A_StopSoundEx("SoundSlot6")
		ZCGN A 0 A_ChangeFlag("FLOAT",0)
		ZCGN A 0 A_Gravity
		ZCGN A 0 A_LookEx(0,0,2048,2048,100)
		ZCGN A 0 A_JumpIf(waterlevel == 3,"SwimWander")
		ZCGN E 0 A_PlaySoundEx("eviscerator/step","Body")
		ZCGN AAAAABBBBB 2 A_Wander
		ZCGN A 0 A_LookEx(0,0,2048,2048,100)
		ZCGN A 0 A_JumpIf(waterlevel == 3,"SwimWander")
		ZCGN E 0 A_PlaySoundEx("eviscerator/step","Body")
		ZCGN CCCCCDDDDD 2 A_Wander
		Loop
	See:
		ZCGN A 0 A_TakeInventorY("EvisceratorAmmo",20)
		ZCGN E 0 A_StopSoundEx("SoundSlot6")
		ZCGN A 0 A_TakeInventory("Forgotten",18)
		ZCGN A 0 A_ChangeFlag("FLOAT",0)
		ZCGN A 0 A_Gravity
		ZCGN A 0 A_JumpIf(waterlevel == 3,"Swim")
		ZCGN E 0 A_PlaySoundEx("eviscerator/step","Body")
		ZCGN AAAAAABBBBBB 1 A_Chase
		ZCGN A 0 A_JumpIf(waterlevel == 3,"Swim")
		ZCGN E 0 A_PlaySoundEx("eviscerator/step","Body")
		ZCGN CCCCCCDDDDDD 1 A_Chase
		ZCGN A 0
		Goto See+3
	Swim:
		ZCGN A 0 A_TakeInventorY("EvisceratorAmmo",20)
		ZCGN A 0 A_ChangeFlag("FLOAT",1)
		ZCGN A 0 A_NoGravity
		ZCGN A 0 A_JumpIf(waterlevel < 1, "Surface")
		ZCGN AABB 3 A_Chase
		ZCGN A 0 A_Recoil(-1)
		ZCGN A 0 A_JumpIf(waterlevel < 1, "Surface")

		ZCGN A 0 A_JumpIf(waterlevel < 1, "Surface")
		ZCGN CCDD 3 A_Chase
		ZCGN A 0 A_Recoil(-1)
		ZCGN A 0 A_JumpIf(waterlevel < 1, "Surface")
		Loop
	SwimWander:
		ZCGN A 0 A_ChangeFlag("FLOAT",1)
		ZCGN A 0 A_NoGravity
		ZCGN A 0 A_JumpIf(waterlevel < 1, "Surface")
		ZCGN A 0 A_Look
		ZCGN AABB 3 A_Wander
		ZCGN A 0 A_JumpIf(waterlevel < 1, "Surface")

		ZCGN A 0 A_JumpIf(waterlevel < 1, "Surface")
		ZCGN A 0 A_Look
		ZCGN CCDD 3 A_Wander
		ZCGN A 0 A_JumpIf(waterlevel < 1, "Surface")
		Loop
	Surface:
		ZCGN A 0
		ZCGN A 1 A_Facetarget
		ZCGN A 0 A_Recoil(-6)
		ZCGN A 0 ThrustThingZ(0,25,0,1)
		ZCGN AAAA 1 A_FaceTarget
		Goto DisableSwimming
	SurfaceWander:
		ZCGN A 0
		ZCGN A 0 A_ChangeFlag("SHOOTABLE", 0)
		ZCGN A 1
		ZCGN A 0 A_Recoil(-6)
		ZCGN A 0 ThrustThingZ(0,25,0,1)
		ZCGN AAAA 1
		ZCGN A 0 A_CheckFloor("DisableSwimming")
		ZCGN A 0 A_Recoil(-6)
		Goto DisableSwimmingWander
	DisableSwimmingWander:
		ZCGN A 0 A_ChangeFlag("FLOAT",0)
		ZCGN A 0 A_Gravity
		Goto Wandering
	DisableSwimming:
		ZCGN A 0 A_ChangeFlag("FLOAT",0)
		ZCGN A 0 A_Gravity
		Goto See+1
	ForgetTarget:
		ZCGN A 0 A_GiveInventory("Forgotten",1)
		ZCGN A 0 A_JumpIfInventory("Forgotten",18,1)
		Goto See+3
		ZCGN A 0
		ZCGN A 0 A_TakeInventory("Forgotten",18)
		ZCGN A 0 A_ClearTarget
		Goto Wandering
	Missile:
		ZCGN A 0 A_Jump(128,"See")
		ZCGN E 0 A_PlaySoundEx("eviscerator/windup","SoundSlot6")
		ZCGN EEEEEEEEEE 1 A_FaceTarget
		ZCGN E 0 A_PlaySoundEx("eviscerator/windloop","SoundSlot6",true)
		Goto ChainLoop
	ChainLoop:
		ZCGN F 0 A_JumpIfInventory("EvisceratorAmmo",20,"WindDown")
		ZCGN F 0 A_PlaySound("eviscerator/fire", CHAN_WEAPON)
		ZCGN F 0 A_CustomBulletAttack(6.5, 6.5, 1, random(1,2)*2, "BulletPuff2", 0, CBAF_NORANDOM)
		ZCGN F 0 A_SpawnItemEx("LongRifleCaseSpawn",0,20,30)
		ZCGN F 0 A_SpawnItemEx("ShooterLight",0,0,5)
		ZCGN F 0 A_GiveInventory("EvisceratorAmmo",1)
		ZCGN F 1 bright
		ZCGN E 1
		ZCGN G 0 A_PlaySound("eviscerator/fire", CHAN_WEAPON)
		ZCGN F 0 A_SpawnItemEx("LongRifleCaseSpawn",0,20,30)
		ZCGN G 0 A_CustomBulletAttack(6.5, 6.5, 1, random(1,2)*2, "BulletPuff2", 0, CBAF_NORANDOM)
		ZCGN F 0 A_SpawnItemEx("ShooterLight",0,0,5)
		ZCGN F 0 A_GiveInventory("EvisceratorAmmo",1)
		ZCGN G 1 bright
		ZCGN E 1
		ZCGN G 0 A_MonsterRefire(130,"WindDown")
		Loop
	WindDown:
		ZCGN E 0 A_TakeInventory("EvisceratorAmmo",20)
		ZCGN E 0 A_PlaySoundEx("eviscerator/winddown","SoundSlot6")
		ZCGN EEEEEE 1
		Goto See
	Pain:
		ZCGN E 0 A_StopSoundEx("SoundSlot6")
		ZCGN A 1
		ZCGN A 2 A_Pain
		Goto See
	Pain.Decapitate:
	Pain.head:
	Pain.minorhead:
	Pain.Head_Shotgun:
		ZCGN E 0 A_StopSoundEx("SoundSlot6")
		ZCGN A 1 A_Pain
		Goto See
	Pain.QuickMelee:
		ZCGN E 0 A_StopSoundEx("SoundSlot6")
		BSZM A 0 A_FaceTarget
		BSZM A 0 A_Recoil(10)
		ZCGN A 1
		ZCGN A 2 A_Pain
		Goto See
    Death.Decapitate:
    Death.head:
	Death.minorhead:
	Death.Head_Shotgun:
		ZCGN E 0 A_StopSoundEx("SoundSlot6")
		TNT1 A 0 ACS_ExecuteAlways(72,0,1,65,90)
		TNT1 A 0 A_PlaySound("gore/juicy")
		TNT1 A 0 A_SpawnItemEx("HeadChunkSpawner",0,0,62)
		ZCGN H 4
		ZCGN I 4 A_NoBlocking
		ZCGN JKLM 4
		BSZM I 0 A_SpawnItemEx("EvisceratorBody",0,0,0)
		Stop
    Death.MeleeDecap:
		ZCGN E 0 A_StopSoundEx("SoundSlot6")
		TNT1 A 0 ACS_ExecuteAlways(72,0,1,65,90)
		TNT1 A 0 A_PlaySound("gore/juicy")
		TNT1 A 0 A_SpawnItemEx("DecapChunkSpawner",0,0,62)
		ZCGN H 4
		ZCGN I 4 A_NoBlocking
		ZCGN JKLM 4
		BSZM I 0 A_SpawnItemEx("EvisceratorBody",0,0,0)
		Stop
	Death:
		ZCGN E 0 A_StopSoundEx("SoundSlot6")
		TNT1 A 0 ACS_ExecuteAlways(72,0,0,50,70)
		ZCGN H 0 A_Scream
		ZCGN H 4
		ZCGN I 4 A_NoBlocking
		ZCGN JKLM 4
		BSZM I 0 A_SpawnItemEx("EvisceratorBody",0,0,0)
		Stop
	Death.PointBlank:
	Death.ExplosiveDamage:
		ZCGN E 0 A_StopSoundEx("SoundSlot6")
		BSZM M 0 ACS_ExecuteAlways(72,0,1,50,70)
		TNT1 A 0 A_SpawnItemEx("GibChunkSpawner_Chain",0,0,32)
		BSZM M 5
		BSZM N 5 A_XScream
		BSZM O 5 A_NoBlocking
		BSZM PQR 5
		BSZM S -1
		Stop
	}
}

ACTOR EvisceratorBody
{
	+THRUACTORS
	+SHOOTABLE
	+MOVEWITHSECTOR
	-NOBLOOD
	-SOLID
	+FLOORCLIP
	+CORPSE
	+NOTELEPORT
	DamageFactor "Fire", 50.0
	DamageFactor "Dragon", 50.0
	Health 150
	Mass 30000000
	Radius 22
	Height 1
	States
	{
	Spawn:
		ZCGN N 1
		Loop
	Pain.PointBlank:
	Death.PointBlank:
	Death.ExplosiveDamage:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx("GibChunkSpawner",0,0,10)
		Stop
	}
}