//////////////////////////////////////////////////
// -- Base Zombie: AKA "Naked Zombie" -- //
//////////////////////////////////////////////////

ACTOR IsSwimmingZombie : Inventory
{
	Inventory.MaxAmount 1
}

ACTOR HasSpawnedHead : Inventory
{
	Inventory.MaxAmount 1
}

ACTOR Forgotten : Inventory
{
	Inventory.MaxAmount 18
}

ACTOR FlameCounter : Inventory
{
	Inventory.MaxAmount 7
}

ACTOR CorpseDecayTime : Inventory
{
	Inventory.MaxAmount 999
}

ACTOR BaseZombie 11601
{
	Health 60
	Radius 20
	Height 38
	Speed 2
	PainChance 48
	PainChance "QuickMelee", 255
	PainChance "MeleeLeft", 255
	PainChance "MeleeRight", 255
	DamageFactor "Cripple", 1.5
	DamageFactor "head", 1.0
	DamageFactor "Decapitate", 1.0
	DamageFactor "Head_Shotgun", 1.15
	DamageFactor "ItemExplode", 0.00
	DamageFactor "MeleeLeft", 2.5
	DamageFactor "MeleeRight", 2.5
	DamageFactor "MeleeVert", 2.5
	Monster
	+FLOORCLIP
	+NOTARGET
	+NOINFIGHTING
	MaxDropOffHeight 512
	Mass 200
	SeeSound "trent/sight"
	PainSound "trent/pain"
	DeathSound "trent/death"
	ActiveSound "trent/idle"
	Obituary "%o was taken down by a naked zombie."
	States
	{
	Spawn:
		BSZM A 0
		BSZM A 0 A_JumpIfInventory("HasSpawnedHead",1,"Wandering")
		BSZM A 0 ACS_ExecuteAlways(625,0,44,0,0)
		BSZM A 0 ACS_ExecuteWithResult(49,0,0,0)
		SAVG A 0 ACS_NamedExecuteAlways("InitiateLegs",0,0,0,0)
		BSZM A 0 A_GiveInventory("HasSpawnedHead",1)
		Goto Wandering
	Wandering:
		BSZM A 0 A_ChangeFlag("FLOAT",0)
		BSZM A 0 A_Gravity
		BSZM A 0 A_LookEx(0,0,2048,2048,100)
		BSZM A 0 A_JumpIf(waterlevel == 3, "SwimWander")
		BSZM AAAAABBBBB 2 A_Wander
		BSZM A 0 A_LookEx(0,0,2048,2048,100)
		BSZM A 0 A_JumpIf(waterlevel == 3, "SwimWander")
		BSZM CCCCCDDDDD 2 A_Wander
		Loop
    //=============================================================
	// INCENDIARY
	//=============================================================
	Pain.Fire:
	Pain.Dragon:
	Death.Fire:
	DragonPain:
	Death.Dragon:
	FireDeath:
		TNT1 A 0 ACS_ExecuteAlways(72,0,1,30,10)
		BSZM A 1
		TNT1 A 0 A_SpawnItemEx("Flaming_BaseZombie",0,0,0)
		Stop
	//=============================================================
	SwimWander:
		BSZM A 0 A_ChangeFlag("FLOAT",1)
		BSZM A 0 A_NoGravity
		BSZM A 0 A_JumpIf(waterlevel < 3, "Wandering")
		BSZM A 0 A_LookEx(0,0,2048,2048,100)
		POSS AABB 7 A_Wander
		BSZM A 0 A_JumpIf(waterlevel < 3, "Wandering")
		BSZM A 0 A_LookEx(0,0,2048,2048,100)
		POSS BBCC 7 A_Wander
		Loop
	See:
		BSZM A 0 A_TakeInventory("Forgotten",18)
		BSZM A 0 A_ChangeFlag("FLOAT",0)
		BSZM A 0 A_Gravity
		BSZM A 0 A_JumpIf(waterlevel == 3, "SwimSee")
		BSZM AAAABBBB 1 A_Chase
		BSZM A 0 A_JumpIf(waterlevel == 3, "SwimSee")
		BSZM CCCCDDDD 1 A_Chase
		BSZM A 0 A_JumpIfTargetInLOS(1)
		Goto ForgetTarget
		TNT1 A 0
		Goto See+1
	SwimSee:
		BSZM A 0 A_TakeInventory("Forgotten",18)
		BSZM A 0 A_ChangeFlag("FLOAT",1)
		BSZM A 0 A_NoGravity
		BSZM A 0 A_TakeInventory("Forgotten",18)
		BSZM A 0 A_JumpIf(waterlevel < 3, "See")
		POSS AAABBB 1 A_Chase
		BSZM A 0 A_JumpIf(waterlevel < 3, "See")
		POSS CCCDDD 1 A_Chase
		BSZM A 0 A_JumpIfTargetInLOS(1)
		Goto ForgetTarget
		TNT1 A 0
		Goto SwimSee+1
	ForgetTarget:
		BSZM A 0 A_GiveInventory("Forgotten",1)
		BSZM A 0 A_JumpIfInventory("Forgotten",18,1)
		Goto See+1
		BSZM A 0
		BSZM A 0 A_TakeInventory("Forgotten",18)
		BSZM A 0 A_ClearTarget
		Goto Wandering
	Melee:
		BSZM E 8 A_FaceTarget
		BSMM A 8 A_FaceTarget
		BSMM B 6 A_CustomMeleeAttack(3 * random(1, 8), "imp/melee", "")
		Goto See
	Pain:
		BSZM A 1
		BSZM A 2 A_Pain
		Goto See
	Pain.QuickMelee:
		BSZM A 0 A_FaceTarget
		BSZM A 0 A_Recoil(20)
		BSZM A 1
		BSZM A 2 A_Pain
		Goto See
    Death.Decapitate:
    Death.head:
	Death.minorhead:
	Death.Head_Shotgun:
		TNT1 A 0 ACS_ExecuteAlways(72,0,1,35,15)
		TNT1 A 0 A_PlaySound("gore/juicy")
		TNT1 A 0 A_SpawnItemEx("HeadChunkSpawner",0,0,44)
		BSZO A 3
		BSZO B 3 A_NoBlocking
		BSZO CDEFG 3
		BSZO H 3
		BSZO I 1
		BSZM I 0 A_SpawnItemEx("BaseZombieBodyHead",0,0,0)
		Stop
    Death.MeleeDecap:
		TNT1 A 0 ACS_ExecuteAlways(72,0,1,35,15)
		TNT1 A 0 A_PlaySound("gore/juicy")
		TNT1 A 0 A_SpawnItemEx("DecapChunkSpawner",0,0,44)
		BSZO A 3
		BSZO B 3 A_NoBlocking
		BSZO CDEFG 3
		BSZO H 3
		BSZO I 1
		BSZM I 0 A_SpawnItemEx("BaseZombieBodyHead",0,0,0)
		Stop
	Death:
		TNT1 A 0 A_Jump(48,"Choking")
		TNT1 A 0 A_Jump(128,"Death2")
		TNT1 A 0 ACS_ExecuteAlways(72,0,0,30,10)
		BSZM F 5 A_Scream
		BSZM G 5 A_NoBlocking
		BSZM H 5
		BSZM I 5
		BSZM L 1
		BSZM I 0 A_SpawnItemEx("BaseZombieBody",0,0,0)
		Stop
    Death2:
		TNT1 A 0 ACS_ExecuteAlways(72,0,0,30,10)
		BSZM T 3 A_Scream
		BSZM U 3 A_NoBlocking
		BSZM VWXYZ 3
		BSZN A 3
		BSZN B 1
		BSZM I 0 A_SpawnItemEx("BaseZombieBody2",0,0,0)
		Stop
	Death.Cripple:
		BSZM M 0 ACS_ExecuteAlways(72,0,1,35,10)
		//TNT1 A 0 A_SpawnItemEx("GibChunkSpawner",0,0,32)
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_UnsetShootable
		TNT1 A 0 A_SpawnItemEx("BaseImpLegless",0,0,24)
		Stop
	Choking:
		TNT1 A 0 A_Stop
		2ROD A 0 A_UnsetShootable
		BSZC A 3
		BSZC B 5
		BSZC CD 3
		2ROD A 0 A_NoBlocking
		TNT1 A 0 A_SpawnItemEx("BaseImpChoking",0,0,0)
		Stop
	Death.PointBlank:
	Death.ExplosiveDamage:
	Death.PulverizerBoom:
		BSZM M 0 ACS_ExecuteAlways(72,0,1,35,10)
		TNT1 A 0 A_SpawnItemEx("GibChunkSpawner",0,0,32)
		BSZM M 5
		BSZM N 5 A_XScream
		BSZM O 5 A_NoBlocking
		BSZM PQR 5
		BSZM S -1
		Stop
	Death.MeleeLeft:
	Death.MeleeRight:
		BZSP A 0 A_PlaySoundEx("gore/split","Body")
		BZSP A 0 A_Noblocking
		BZSP A 0 A_UnsetShootable
		TNT1 A 0 ACS_ExecuteAlways(72,0,0,30,10)
		TNT1 A 0 A_SpawnItemEx("GibSpawn_Splitter",0,0,30)
		TNT1 A 0 A_SpawnItemEx("Torso_BaseZombie",0,0,30,random(-1,1),random(-1,1),random(3,5))
		BZSP EFG 4
		BZSP H -1
		Stop
	}
}

ACTOR BaseZombieBody
{
	+THRUACTORS
	+SHOOTABLE
	+MOVEWITHSECTOR
	-NOBLOOD
	-SOLID
	+FLOORCLIP
	+CORPSE
	+NOTELEPORT
	Health 150
	Mass 300000000
	Radius 22
	Height 4
	PainChance 255
	DamageFactor "Fire", 50.0
	DamageFactor "Dragon", 50.0
	States
	{
	Pain:
		BSZM L 0
		Goto Spawn
	Spawn:
		BSZM L 1
		Loop
	Pain.Fire:
	Pain.Dragon:
	Death.Fire:
	Death.Dragon:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx("BurningBaseCorpse",0,0,0)
		Stop
	Pain.PointBlank:
	Death.PointBlank:
	Death.ExplosiveDamage:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx("GibChunkSpawner",0,0,10)
		Stop
	}
}

ACTOR BaseZombieBody2 : BaseZombieBody
{
	States
	{
		Spawn:
		BSZN B 1
		Loop
	}
}

ACTOR BaseZombieBodyHead : BaseZombieBody
{
	States
	{
		Spawn:
		BSZO I 1
		Loop
	}
}

ACTOR ZombieOnGround
{
    Radius 19
    Height 40
	Mass 300
	Monster
	Health 200
	DamageFactor "Head", 3.0
	DamageFactor "PointBlank", 2.0
	DamageFactor "Explosive", 2.0
	DamageFactor "PulverizerBoom", 2.0
    +SHOOTABLE
    +SOLID
    +NOTELEPORT
	+FLOORCLIP
	+NOTARGET
	PainChance 0
	Speed 0
    States
    {
    Spawn:
		TNT1 A 0
		Stop
    }
}

ACTOR BaseImpChoking : ZombieOnGround
{
    Radius 19
    Height 40
	Mass 300
	Monster
	Health 200
	DamageFactor "Head", 3.0
	DamageFactor "PointBlank", 2.0
	DamageFactor "Explosive", 2.0
	DamageFactor "PulverizerBoom", 2.0
    +SHOOTABLE
    +SOLID
    +NOTELEPORT
	+FLOORCLIP
    +MOVEWITHSECTOR
	+NOTARGET
	PainChance 0
	Speed 0
    States
    {
    Spawn:
		TNT1 A 0
		Goto Choking
	Choking:
		TNT1 A 0 A_PlaySound("zombie/choking",CHAN_VOICE)
		BSZC EFEF 8 DamageThing(10,0)
		SAVC A 0 A_SpawnItemEx("GibletPuddle",random(-5,5),random(-5,5),20)
		Loop
	Death:
		BSZC G 0 A_SpawnItemEx("GrowingBloodPuddle",0,0,0)
		BSZC G -1
		Stop
	Death.PointBlank:
	Death.PulverizerBoom:
	Death.Explosive:
		TNT1 A 0 A_SpawnItemEx("GibChunkSpawner",0,0,16)
        TNT1 A 1 A_SpawnItem("DeadSavageImp_Half", 5)
		Stop
    }
}

ACTOR BaseImpLegless : ZombieOnGround
{
    Radius 19
    Height 40
	Mass 200
	Monster
	Health 200
	DamageFactor "Head", 3.0
	DamageFactor "PointBlank", 2.0
	DamageFactor "Explosive", 2.0
	DamageFactor "PulverizerBoom", 2.0
    +SHOOTABLE
    +SOLID
    +NOTELEPORT
	+FLOORCLIP
    +MOVEWITHSECTOR
	+NOTARGET
	PainChance 0
	Speed 0
    States
    {
    Spawn:
		BSZL A 2
		BLUD C 0 ThrustThingZ (0,random(10,15),0,0)
		TNT1 A 0 A_SetInvulnerable
	Flying:
		BSZL A 2 A_CheckFloor("Dead")
		Loop
    Dead:
		TNT1 A 0 A_PlaySoundEx("hammer/flesh","SoundSlot5")
		TNT1 A 0 A_SpawnItemEx("GrowingBloodPuddle",0,0,0)
	    TNT1 A 0 A_UnSetInvulnerable
        BSZL G 16
		BSZL FE 3
		SAVG A 0 //ACS_ExecuteAlways(625,0,20,0,0)		// Head
		Goto Begging
	Begging:
		SAVH A 0 A_PlaySound("dimp/pain",CHAN_VOICE)
		BSZL BC 16 DamageThing(20,0)
		TNT1 A 0 A_Jump(64,"Blink")
        Loop
	Blink:
		BSZL D 3
		Goto Begging
	Death:
		BSZL EF 5
		BSZL G -1
		Stop
	Death.PointBlank:
	Death.PulverizerBoom:
	Death.Explosive:
		TNT1 A 0 A_SpawnItemEx("GibChunkSpawner",0,0,16)
        TNT1 A 1 A_SpawnItem("DeadSavageImp_Half", 5)
		Stop
    }
}