ACTOR Cacodemon_ : Cacodemon Replaces Cacodemon
{
	Game Doom
	bloodtype "Blue_Blood", "BlueSawBlood", "BlueSawBlood"
	bloodcolor "Blue"
	SpawnID 19
    GibHealth 25
	Radius 31
	Height 56
	Mass 400
	Speed 9
	Health 400
	PainChance 128

	Damagefactor "Avoid", 1.0	Damagefactor "BHFTOnBarrel", 0.0	Damagefactor "Blood", 0.0
	Damagefactor "CancelTeleportFog", 0.0	Damagefactor "CauseWaterSplash", 0.0	DamageFactor "Crush", 4.0
	Damagefactor "GibRemoving", 0.0	Damagefactor "HangingHook", 0.0
	Damagefactor "Head", 0.0	Damagefactor "PussyGrab", 0.0	Damagefactor "Repair", 0.0
	Damagefactor "RevenantHitStomach", 0.0	Damagefactor "SpawnMarine", 0.0	Damagefactor "Stealth", 0.0
	Damagefactor "TeleportRemover", 0.0	Damagefactor "Use", 0.0	Damagefactor "Burn", 0.5
	Damagefactor "Fire", 0.5	Damagefactor "Flames", 0.5	Damagefactor "GreenFire", 0.5
	Damagefactor "HumanBBQ", 0.5	Damagefactor "ExtremePunches", 5.0	Damagefactor "Fatality", 5.0	Damagefactor "HelperMarineFatallity", 5.0
	DamageFactor "SSG", 5.0	DamageFactor "TankWeakSpot", 0.0

	PainChance "Avoid", 64	PainChance "Head", 255
	PainChance "Taunt", 255
	PainChance "Burn", 16	PainChance "Fire", 16	PainChance "Flames", 16
	PainChance "GreenFire", 16	PainChance "HumanBBQ", 16

	Monster
	Scale 0.9
	+FLOAT +NOGRAVITY +FORCEXYBILLBOARD
	SeeSound "caco/sight"
	PainSound "caco/pain"
	DeathSound "caco/death"
	ActiveSound "caco/active"
	Obituary "$OB_CACO"
	HitObituary "$OB_CACOHIT"
	DropItem "DemonStrengthRune", 4
	DeathHeight 4
	BurnHeight 0
	Tag "Cacodemon"
	States
	{
	Pain.Avoid:
	  TNT1 A 0
	  TNT1 A 0 A_Jump(255, "AvoidLeft", "AvoidRight")
	  Goto AvoidLeft

	  AvoidLeft:
	    HEAD A 1 A_FaceTarget
	    TNT1 A 0 ThrustThing(angle*256/360+192, 15, 0, 0)
        HEAD A 15 A_FaceTarget
        Goto Missile
	AvoidRight:
	    HEAD A 1 A_FaceTarget
	    TNT1 A 0 ThrustThing(angle*256/360+64, 15, 0, 0)
        HEAD A 15 A_FaceTarget
        Goto Missile
    Spawn:
		HEAD A 0
		TNT1 A 0 ACS_NamedExecuteAlways("BDCHeckClassicMonsters", 0, 0, 0, 0)//Check if Vanilla Mode is activated
		HEAD A 2
		TNT1 A 0 A_RadiusGive("SlaughterToken", 128, RGF_GIVESELF | RGF_MONSTERS |RGF_CUBE | RGF_NOSIGHT, 1)
		HEAD A 2
		TNT1 A 0 A_JumpIfInventory("SlaughterToken",15,"ReplaceVanilla")
		TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "FatalityMarine")
		Goto Stand

	ReplaceVanilla:
		TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
		TNT1 A 2 A_ChangeFlag("NOINTERACTION", 1)
		TNT1 A 0 A_SpawnItemEx ("VanillaCacoDemon",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 2 Thing_Remove(0)
		Stop

	Stand:
		HEAD A 10 A_Look
		Loop

	See:
		HEAD AAA 2 A_Chase
		Loop

	Missile:
		TNT1 A 0
		TNT1 A 0 A_Stop
		HEAD B 4 A_FaceTarget
		HEAD C 4 A_FaceTarget
		HEAD D 4 BRIGHT A_CustomMissile("CacodemonBall", 28, 0, 0, 0)
		Goto See

	Melee:
		HEAD B 4 A_Facetarget
		HEAD C 4 A_Recoil(-5)
		TNT1 A 0 A_CustomMissile("CacodemonBite", 28, 0, 0, 0)
		HEAD D 4
		TNT1 A 0 A_Stop
		TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "FatalityMarine")
	Goto See

	Pain.Kick:
	Pain.HeavyImpact:
        TNT1 A 0 A_FaceTarget
		HEAD E 6 A_Recoil(5)
		HEAD E 6 A_Pain
		HEAD F 10
		Goto See

	Pain:
		HEAD E 3
		HEAD E 3 A_Pain
        TNT1 A 0 A_Jump (64, 3)
        Goto Pain.Avoid
        TNT1 AAA 0
		HEAD F 6
        Goto See

	Pain.Cut:
	Pain.Saw:
		TNT1 A 0 A_Stop
		HEAD EF 6
        Goto See

    Death.Shotgun:
		TNT1 A 0
		TNT1 A 0 A_JumpIfCloser(500, "Death.Brutal")
		TNT1 A 0
		Goto Death

	Death:
		HEAD G 3 A_Scream
		HEAD H 3
        TNT1 AAAA 0 A_CustomMissile ("Blue_FlyingBlood", 15, 0, random (0, 360), 2, random (0, 160))
        HEAD IJK 4
		TNT1 A 0 A_SpawnItem ("BlueGrowingBloodPool", 1)
        TNT1 A 0 A_SpawnItem ("DeadCacoDemon1", 1)
		TNT1 A -1 A_NoBlocking
        Stop

	Deathlulz:
		H3D2 A 6 A_Scream
		H3D2 B 6
		H3D2 CD 6
        TNT1 AAAA 0 A_CustomMissile ("Blue_FlyingBlood", 15, 0, random (0, 360), 2, random (0, 160))
        H3D2 E 6
		TNT1 A 0 A_SpawnItem ("BlueGrowingBloodPool", 1)
        TNT1 A 0 A_SpawnItem ("DeadCacoDemon1", 1)
		TNT1 A -1 A_NoBlocking
        Stop

	   Death.Fatality:
        TNT1 A 0 A_SetFloorClip
		TNT1 A 0 A_Pain
		TNT1 A 0 A_JumpIfIntargetInventory("FistsSelected", 1, 1)
		Goto Death.SSG
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_SpawnItemEx("HealthCrueltyBonus2", 0, 0, 28, frandom (-2.5, 2.5), frandom (-2.5, 2.5), 5)
		TNT1 A 0 A_SpawnItemEx("ArmorCrueltyBonus2", 0, 0, 28, frandom (-2.5, 2.5), frandom (-2.5, 2.5), 5)
		TNT1 A 0 A_GiveToTarget("GoFatality", 1)
        TNT1 A 0 A_Jump(128,5)
		Death.HelperMarineFatallity:
        TNT1 A 0 A_GiveToTarget("CacoDemonFatality", 1)
		TNT1 A -1 A_NoBlocking
        Stop
        TNT1 AAAAAAA 0
        TNT1 A 0 A_GiveToTarget("CacoDemonFatality2", 1)
		TNT1 A -1 A_NoBlocking
		Stop

	Death.saw:
        TNT1 A 0 A_SetFloorClip
		TNT1 A 0 A_Scream
		TNT1 A 0 A_SpawnItem("Muchblood2Blue", 0, 40)
		TNT1 AA 0 A_CustomMissile ("XDeath2Blue", 25, 0, random (0, 360), 2, random (30, 150))
		TNT1 AA 0 A_CustomMissile ("XDeath3Blue", 25, 0, random (0, 360), 2, random (30, 150))
		TNT1 AA 0 A_CustomMissile ("XDeath4Blue", 25, 0, random (0, 360), 2, random (30, 150))
		TNT1 AAAAA 0 A_CustomMissile ("Blue_FlyingBlood", 47, 0, random (0, 360), 2, random (30, 150))
		TNT1 A 0 A_CustomMissile ("CacoXDeath3", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("CacoXDeath4", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("CacoXDeath6", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 AAA 0 A_CustomMissile ("CacoXDeath7", 50, 0, random (0, 360), 2, random (0, 160))
		HEDC AB 9
		TNT1 A 0 A_SpawnItem ("BlueGrowingBloodPool", 1)
		TNT1 A 0 A_SpawnItem ("SawedCacodemon", 1)
		TNT1 A -1 A_NoBlocking
        Stop

	Death.cut:
	Death.ExplosiveImpact:
        TNT1 A 0 A_SetFloorClip
		TNT1 A 0 A_Scream
		TNT1 A 0 A_SpawnItem("Muchblood2Blue", 0, 40)
		TNT1 AA 0 A_CustomMissile ("XDeath2Blue", 25, 0, random (0, 360), 2, random (30, 150))
		TNT1 AA 0 A_CustomMissile ("XDeath3Blue", 25, 0, random (0, 360), 2, random (30, 150))
		TNT1 AA 0 A_CustomMissile ("XDeath4Blue", 25, 0, random (0, 360), 2, random (30, 150))
		TNT1 A 0 A_CustomMissile ("RipCaco", 0, 0, random (0, 360), 2, random (0, 160))
        CCD3 A 6
		TNT1 A 0 A_SpawnItem ("BlueGrowingBloodPool", 1)
		TNT1 A 0 A_SpawnItem ("DeadHalfCacoDemon", 1)
		TNT1 A -1 A_NoBlocking
        Stop
	Death.Minigun:
		TNT1 O 0 A_Jump(64, 2)
		Goto Death.Brutal
        TNT1 A 0 A_SetFloorClip
		TNT1 A 0 A_Scream
		TNT1 A 0 A_SpawnItem("Muchblood2Blue", 0, 40)
		TNT1 A 0 A_CustomMissile ("RipCaco", 0, 0, random (0, 360), 2, random (0, 160))
		TNT1 AA 0 A_CustomMissile ("XDeath2Blue", 25, 0, random (0, 360), 2, random (30, 150))
		TNT1 AA 0 A_CustomMissile ("XDeath3Blue", 25, 0, random (0, 360), 2, random (30, 150))
		TNT1 AA 0 A_CustomMissile ("XDeath4Blue", 25, 0, random (0, 360), 2, random (30, 150))
        CCD3 A 6
		TNT1 A 0 A_SpawnItem ("BlueGrowingBloodPool", 1)
		TNT1 A 0 A_SpawnItem ("DeadHalfCacoDemon", 1)
		TNT1 A -1 A_NoBlocking
        Stop

	Death.Brutal:
	Death.Railgun:
		TNT1 A 0
		TNT1 A 0 A_SetFloorClip
		TNT1 A 0 A_Scream
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_SpawnItem("Muchblood2Blue", 0, 40)
		TNT1 A 0 A_CustomMissile ("XDeath2bBlue", 25, 0, random (0, 360), 2, random (30, 150))
		TNT1 A 0 A_CustomMissile ("XDeath3bBlue", 25, 0, random (0, 360), 2, random (30, 150))
		TNT1 A 0 A_CustomMissile ("XDeath2Blue", 25, 0, random (160, 210), 2, random (30, 60))
		TNT1 A 0 A_CustomMissile ("XDeath3Blue", 25, 0, random (160, 210), 2, random (30, 60))
		TNT1 A 0 A_CustomMissile ("CacoXDeath3", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("CacoXDeath4", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("CacoXDeath6", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 AAA 0 A_CustomMissile ("CacoXDeath7", 50, 0, random (0, 360), 2, random (0, 160))
		CCD1 A 0
		TNT1 A 0 A_SpawnItem("BrutalizedCacodemon1")
		TNT1 A -1 A_NoBlocking
		Stop

	Death.SuperPlasma:
    Death.Plasma: Death.Plasma2:
        TNT1 A 0
        TNT1 A 0 A_Scream
		TNT1 A 0 A_Stop
		CACB AA 0 A_CustomMissile ("XDeathBurnedBlueMeat1", 0, 0, random (0, 360), 2, random (0, 160))
        CACB AA 0 A_CustomMissile ("XDeathBurnedBlueMeat2", 0, 0, random (0, 360), 2, random (0, 160))
		CACB B 3 A_CustomMissile ("BurnParticles", 16, 0, random (0, 180), 2, random (0, 180))
		TNT1 A 0 A_JumpIf(momz == 0, "FallAndBurn")
		CACB B 3 A_CustomMissile ("BurnParticles", 16, 0, random (0, 180), 2, random (0, 180))
		TNT1 A 0 A_JumpIf(momz == 0, "FallAndBurn")
		CACB B 3 A_CustomMissile ("BurnParticles", 16, 0, random (0, 180), 2, random (0, 180))
		TNT1 A 0 A_JumpIf(momz == 0, "FallAndBurn")
		CACB B 3 A_CustomMissile ("BurnParticles", 16, 0, random (0, 180), 2, random (0, 180))
		TNT1 A 0 A_JumpIf(momz == 0, "FallAndBurn")
		CACB B 3 A_CustomMissile ("BurnParticles", 16, 0, random (0, 180), 2, random (0, 180))
		TNT1 A 0 A_JumpIf(momz == 0, "FallAndBurn")
		CACB B 3 A_CustomMissile ("BurnParticles", 16, 0, random (0, 180), 2, random (0, 180))
		TNT1 A 0 A_JumpIf(momz == 0, "FallAndBurn")
		CACB B 3 A_CustomMissile ("BurnParticles", 16, 0, random (0, 180), 2, random (0, 180))
		TNT1 A 0 A_JumpIf(momz == 0, "FallAndBurn")
		CACB B 3 A_CustomMissile ("BurnParticles", 16, 0, random (0, 180), 2, random (0, 180))
		TNT1 A 0 A_JumpIf(momz == 0, "FallAndBurn")

	FallAndBurn:
		TNT1 A 0 A_SpawnItemEx ("DetectFloorCraterSmall",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 0 A_SpawnItem("BarrelExplosionSmokeColumn")
		TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece", random (-15, 15), random (-15, 15))
		TNT1 AAA 0 A_SpawnItemEx("TinyBurningPiece2", random (-35, 35), random (-35, 35))
		TNT1 AAA 0 A_SpawnItemEx("TinyBurningPiece3", random (-45, 45), random (-45, 35))
        CACB B 8 A_CustomMissile ("BurnParticles", 16, 0, random (0, 180), 2, random (0, 180))
        CACB B -1 A_NoBlocking
        Stop

      Death.fire:
        TNT1 A 0
        TNT1 A 0 A_Scream
        TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 24, 0, random (0, 180), 2, random (0, 180))
        TNT1 A 0 A_SpawnItem("BurningCacoDemon")
		TNT1 A -1 A_NoBlocking
        Stop

	Death.Explosive:
	XDeath:
	Death.Desintegrate:
		TNT1 A 0
		TNT1 A 0 A_XScream
        TNT1 A 0 A_CustomMissile ("CacoXDeath", 0, 0, random (0, 360), 2, random (0, 160))
		TNT1 A -1 A_NoBlocking
        Stop

	Death.SSG:
	Death.ExtremePunches:
		CCD3 A 1 A_Pain
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_Scream
		TNT1 AAAAAA 0 A_CustomMissile ("BlueBloodMistBig", 50, 0, random (0, 360), 2, random (0, 50))
		TNT1 AAAAAA 0 A_CustomMissile ("BlueBloodMistBig", 50, 0, random (160, 200), 2, random (20, 40))
		TNT1 AA 0 A_CustomMissile ("XDeath2Blue", 25, 0, random (140, 230), 2, random (30, 60))
		TNT1 AA 0 A_CustomMissile ("XDeath3Blue", 25, 0, random (140, 230), 2, random (30, 60))
		TNT1 AA 0 A_CustomMissile ("XDeath4Blue", 25, 0, random (140, 230), 2, random (30, 60))

		TNT1 A 0 A_CustomMissile ("CacoXDeath2", 50, 0, random (160, 200), 2, random (20, 40))
		TNT1 A 0 A_CustomMissile ("CacoXDeath1", 50, 0, random (160, 200), 2, random (20, 40))
		TNT1 A 0 A_CustomMissile ("CacoXDeath3", 50, 0, random (160, 200), 2, random (20, 40))
		TNT1 A 0 A_CustomMissile ("CacoXDeath4", 50, 0, random (160, 200), 2, random (20, 40))
		TNT1 AA 0 A_CustomMissile ("CacoXDeath5", 50, 0, random (160, 200), 2, random (20, 40))
		TNT1 AAAA 0 A_CustomMissile ("CacoXDeath6", 50, 0, random (160, 200), 2, random (20, 40))
		TNT1 AAAAAA 0 A_CustomMissile ("CacoXDeath7", 50, 0, random (160, 200), 2, random (20, 40))
		CCD3 A 1
		TNT1 A 0 A_SpawnItem ("BlueGrowingBloodPool", 1)
		TNT1 A 0 A_Stop
		TNT1 A 0 A_SpawnItem("DeadHalfCacoDemon")
		TNT1 A -1 A_NoBlocking
		Stop

	 Raise:
		TNT1 A 0 A_SpawnItem("PentagramSpawner")
		HEAD L 8 A_UnSetFloorClip
		HEAD KJIHG 8
		Goto See

    Pain.KillMe:
    Pain.Taunt:
		TNT1 A 0 HealThing(2)
        Goto Missile
    Death.KillMe:
    Death.Taunt:
		Goto Death

	FatalityMarine:
		TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
		CFPF A 8
		TNT1 A 0 A_PlaySound("DSFDTHE")
		TNT1 AAA 0 A_CustomMissile ("XDeath1", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 AA 0 A_CustomMissile ("BrainBlood", 25, 0, random (0, 360), 2, random (0, 160))

		CFPF B 8
		TNT1 AAA 0 A_CustomMissile ("XDeath1", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 AA 0 A_CustomMissile ("BrainBlood", 25, 0, random (0, 360), 2, random (0, 160))
		CFPF C 8

		CFPF B 8
		TNT1 AAA 0 A_CustomMissile ("XDeath1", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 AA 0 A_CustomMissile ("BrainBlood", 25, 0, random (0, 360), 2, random (0, 160))
		CFPF C 9

		CFPF B 8
		TNT1 AAA 0 A_CustomMissile ("XDeath1", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 AA 0 A_CustomMissile ("BrainBlood", 25, 0, random (0, 360), 2, random (0, 160))
		CFPF C 8

		TNT1 A 0 A_TakeInventory("Curbstomp_Marine",1)
		TNT1 A 0 A_SpawnItem("RipGuts", 0, 40)
		TNT1 A 0 A_SpawnItem ("PlayerJustGotCutInHalf", 1)
		TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
		Goto See

	Death.Ice:
	Death.Freeze:
	Death.Frost:
		TNT1 A 0
		TNT1 A 0 A_SpawnItem("FrozenCacodemon")
		TNT1 A -1 A_NoBlocking
		Stop

	Death.Massacre:
		Goto Death
	}
}

//===========================================================================
//
// Cacodemon plasma ball
//
//===========================================================================
ACTOR CacodemonBall_ Replaces CacodemonBall
{
	Game Doom
	SpawnID 126
	Radius 6
	Height 6
	Speed 15
	FastSpeed 30
	Damage (random(26,26))
	Projectile
	+RANDOMIZE
	+THRUGHOST
	+FORCEXYBILLBOARD
	RenderStyle Add
	Alpha 0.95
    damagetype Plasma
	SeeSound "caco/attack"
	DeathSound "caco/shotx"
	Decal "Scorch"
	Scale 0.3
	States
	{
	Spawn:
		PBAL DE 1 BRIGHT
		Loop
	Death:
        TNT1 A 0 A_CustomMissile ("ShoqueAzul", 3, 0, random (0, 360), 2, random (0, 360))
		EXPL A 0 A_CustomMissile ("FireBallExplosionFlames", 1, 0, random (0, 360), 2, random (0, 360))
		EXPL A 0 A_CustomMissile ("BluePlasmaFire", 1, 0, random (0, 360), 2, random (0, 360))
		TNT1 A 0 A_CustomMissile ("BDExplosionparticlesSmall", 10, 0, random (0, 180), 2, random (40, 90))
		TNT1 AAA 1 A_SpawnItem("RedFlare")
		Stop
	}
}

ACTOR Shoque
{
	Game Doom
	Radius 1
	Height 1
	Speed 3
	Damage 0
    +NOBLOCKMAP
    +NOTELEPORT
    +DONTSPLASH
	+MISSILE
	+FORCEXYBILLBOARD
    +CLIENTSIDEONLY
	+NOGRAVITY
	RenderStyle Add
    Scale 1.0
	Alpha 0.5
	States
	{
    Spawn:
        TNT1 A 1
        SHOQ ABCDEFG 2 BRIGHT
        Stop
	}
}

ACTOR ShoqueAzul
{
	Game Doom
	Radius 1
	Height 1
	Speed 3
	Damage 0
    +NOBLOCKMAP
    +NOTELEPORT
    +DONTSPLASH
	+MISSILE
	+FORCEXYBILLBOARD
    +CLIENTSIDEONLY
	+NOGRAVITY
	RenderStyle Add
    Scale 1.0
	Alpha 0.5
	States
	{
    Spawn:
        TNT1 A 1
        SH1K ABCDEFG 2 BRIGHT
        Stop
	}
}

ACTOR CacoXdeath1
{
	translation "168:191=192:207"
	Radius 8
	Height 8
	Speed 9
	Scale 0.9
	Mass 1
	+NOBLOCKMAP
	+MISSILE
	+NOTELEPORT
	+MOVEWITHSECTOR
	+CLIENTSIDEONLY
	+RIPPER
	+BLOODLESSIMPACT
	Decal BlueBloodSplat
	damagetype Blood
	SeeSound "misc/xdeath4"
	DeathSound "misc/xdeath1"
	Decal BlueBloodSplat
	bloodtype "Blue_Blood", "BlueSawBlood", "BlueSawBlood"
    States
    {
    Spawn:
        TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
        CCP1 A 8 A_CustomMissile("Blue_BloodTrails",0,0,180,2)
        Loop
    Death:
		TNT1 A 0
		TNT1 A 0 A_QueueCorpse
        TNT1 AAAAAAA 0 A_CustomMissile ("Blue_FlyingBloodTrail", 6, 0, random (0, 180), 2, random (0, 180))
        TNT1 A 0 A_SpawnItem("Blue_BloodSpot",0,0,0,1)
        CCP1 B 0
        Goto Rest
	Rest:
		CCP1 B 800
		TNT1 A 0 ACS_NamedExecuteAlways("BDCheckJanitor", 0, 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("lowgraphicsmode", 1, "DoNothing")
		CCP1 B 1202
		Stop
	DoNothing:
    Splash:
        TNT1 A 0
        Stop
    }
}

ACTOR CacoXdeath1b: CacoXdeath1 { Speed 6}

ACTOR CacoXdeath2: CacoXDeath1
{
    SeeSound "misc/xdeath3"
    DeathSound "misc/xdeath1"
    States
    {
    Spawn:
        TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
        CCP1 A 8 A_CustomMissile("Blue_BloodTrails",0,0,180,2)
        Loop
    Death:
		TNT1 A 0
		TNT1 A 0 A_QueueCorpse
        TNT1 AAAAAAA 0 A_CustomMissile ("Blue_FlyingBloodTrail", 6, 0, random (0, 180), 2, random (0, 180))
        TNT1 A 0 A_SpawnItem("Blue_BloodSpot",0,0,0,1)
        CCP1 C 0
        Goto Rest
	Rest:
		CCP1 C 800
		TNT1 A 0 ACS_NamedExecuteAlways("BDCheckJanitor", 0, 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("lowgraphicsmode", 1, "DoNothing")
		CCP1 C 1202
		Stop
    }
}

ACTOR CacoXdeath2b: CacoXdeath2 { Speed 7}

ACTOR CacoXdeath3: CacoXDeath1
{
    SeeSound "misc/xdeath3"
    DeathSound "misc/xdeath1"
	Scale 0.9
    States
    {
    Spawn:
        TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
        CCP2 A 8 A_CustomMissile("Blue_BloodTrails",0,0,180,2)
        Loop
    Death:
		TNT1 A 0
		TNT1 A 0 A_QueueCorpse
        TNT1 AAAAAAA 0 A_CustomMissile ("Blue_FlyingBloodTrail", 6, 0, random (0, 180), 2, random (0, 180))
        TNT1 A 0 A_SpawnItem("Blue_BloodSpot",0,0,0,1)
        CCP2 B 0
        Goto Rest
	Rest:
		CCP2 B 800
		TNT1 A 0 ACS_NamedExecuteAlways("BDCheckJanitor", 0, 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("lowgraphicsmode", 1, "DoNothing")
		CCP2 B 1202
		Stop
    }
}

ACTOR CacoXdeath3b: CacoXdeath3 { Speed 7}

ACTOR CacoXdeath4: CacoXDeath1
{
    SeeSound "misc/xdeath3"
    DeathSound "misc/xdeath1"
	Scale 0.9
    States
    {
    Spawn:
        TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
        CCP2 A 8 A_CustomMissile("Blue_BloodTrails",0,0,180,2)
        Loop
    Death:
		TNT1 A 0
		TNT1 A 0 A_QueueCorpse
        TNT1 AAAAAAAAA 0 A_CustomMissile ("Blue_FlyingBloodTrail", 0, 0, random (0, 180), 2, random (0, 180))
        TNT1 A 0 A_SpawnItem("Blue_BloodSpot",0,0,0,1)
        CCP2 C 0
        Goto Rest
	Rest:
		CCP2 C 800
		TNT1 A 0 ACS_NamedExecuteAlways("BDCheckJanitor", 0, 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("lowgraphicsmode", 1, "DoNothing")
		CCP2 C 1202
		Stop
    }
}

ACTOR CacoXdeath4b: CacoXdeath4 { Speed 7}

ACTOR CacoXdeath5: CacoXDeath1
{
    SeeSound "misc/xdeath3"
    DeathSound "misc/xdeath1"
    States
    {
    Spawn:
        TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
        CCP3 A 8 A_CustomMissile("Blue_BloodTrails",0,0,180,2)
        Loop
    Death:
		TNT1 A 0
		TNT1 A 0 A_QueueCorpse
        TNT1 AAAAAAAAAAA 0 A_CustomMissile ("Blue_FlyingBloodTrail", 0, 0, random (0, 180), 2, random (0, 180))
        TNT1 A 0 A_SpawnItem("Blue_BloodSpot",0,0,0,1)
        CCP3 B 0
        Goto Rest
	Rest:
		CCP3 B 800
		TNT1 A 0 ACS_NamedExecuteAlways("BDCheckJanitor", 0, 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("lowgraphicsmode", 1, "DoNothing")
		CCP3 B 1202
		Stop
    }
}

ACTOR CacoXdeath5b: CacoXdeath5 { Speed 7}

ACTOR CacoXdeath6: CacoXDeath1
{
Scale 0.9
Gravity 0.6
    States
    {
    Spawn:
        TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
        CCP4 ABCDEFG 4 A_CustomMissile("Blue_BloodTrails",0,0,180,2)
        Loop
    Death:
		TNT1 A 0
		TNT1 A 0 A_QueueCorpse
        TNT1 AAAAAAA 0 A_CustomMissile ("Blue_FlyingBloodTrail", 6, 0, random (0, 180), 2, random (0, 180))
        TNT1 A 0 A_SpawnItem("Blue_BloodSpot",0,0,0,1)
        CCP4 H 0
        Goto Rest
	Rest:
		CCP4 H 800
		TNT1 A 0 ACS_NamedExecuteAlways("BDCheckJanitor", 0, 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("lowgraphicsmode", 1, "DoNothing")
		CCP4 H 1202
		Stop
    }
}

ACTOR CacoXdeath6b: CacoXdeath6 { Speed 7}

ACTOR CacoXdeath7: CacoXDeath1
{
    SeeSound "misc/xdeath4"
    DeathSound "misc/xdeath1"
	Decal BlueBloodSplat
	Scale 0.9
	Speed 16
    States
    {
    Spawn:
	    TNT1 A 0
		TNT1 A 0 A_Jump(128, "Spawn2")
	    TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
        CCP5 C 8 A_CustomMissile("Blue_BloodTrails",0,0,180,2)
        Loop
	Spawn2:
	    TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
        CCP5 D 8 A_CustomMissile("Blue_BloodTrails",0,0,180,2)
        Loop
    Death:
		TNT1 A 0
		TNT1 A 0 A_QueueCorpse
		TNT1 A 0 A_Jump(128, "Death2")
		TNT1 A 0 A_SpawnItem("Blue_BloodSpot",0,0,0,1)
		CCP5 A 0
        Goto Rest
	Death2:
		TNT1 A 0
		TNT1 A 0 A_SpawnItem("Blue_BloodSpot",0,0,0,1)
		CCP5 B 0
        Goto Rest1

	Rest:
		CCP5 A 800
		TNT1 A 0 ACS_NamedExecuteAlways("BDCheckJanitor", 0, 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("lowgraphicsmode", 1, "DoNothing")
		CCP5 A 1202
		Stop
	Rest1:
		CCP5 B 800
		TNT1 A 0 ACS_NamedExecuteAlways("BDCheckJanitor", 0, 0, 0, 0)
		TNT1 A 0 A_JumpIfInventory("lowgraphicsmode", 1, "DoNothing")
		CCP5 B 1202
		Stop
    }
}

ACTOR CacoXdeath7b: CacoXdeath7 { Speed 7}

ACTOR HalfCacodemon
{
    Radius 8
    Height 8
	Speed 12
	Mass 1
    +NOBLOCKMAP
	+MISSILE
    +NOTELEPORT
    +DONTSPLASH
	+DOOMBOUNCE
    +MOVEWITHSECTOR
    +CLIENTSIDEONLY
	SeeSound "misc/xdeath4"
    DeathSound "misc/xdeath3"
	Decal BlueBloodSplat
	BounceFactor 0.5
	Scale 0.9
	bloodtype "Blue_Blood", "BlueSawBlood", "BlueSawBlood"
    States
    {
    Spawn:
	    TNT1 A 0 A_JumpIf(waterlevel > 1, "Death")
		CACX ABCDEFGH 2 A_CustomMissile("Blue_FlyingBlood", 15, 0, random (0, 360), 2, random (0, 160))
		Loop
	Death:
		TNT1 A 0
		TNT1 A 0 A_QueueCorpse
	    CACX I -1
		Stop
    }
}

Actor DeadCacoDemon1: CurbstompedMarine Replaces DeadCacodemon
{
	Radius 12
	Height 24
	Scale 0.9
	+SHOOTABLE
	-SOLID
	+NOTELEPORT
	+MOVEWITHSECTOR
	+CORPSE
	bloodtype "Blue_Blood", "BlueSawBlood", "BlueSawBlood"
	bloodcolor darkblue
	Mass 10000
	Health 100
	States
    {
    Spawn:
		HEAD L -1
        Stop

	Pain.Kick:
	Pain.ExplosiveImpact:
		TNT1 A 0
		TNT1 A 0 ThrustThingZ(0,25,0,1)
		TNT1 A 0 A_Jump(256, "Spawn")
		Goto Death

	Pain.Trample:
		TNT1 A 0
		TNT1 A 0 A_PlaySound("floorslimy")
		TNT1 A 0 ThrustThingZ(0,25,1,1)
		TNT1 A 0 A_Jump(256, "Spawn")
		Goto Death

    Death:
  	     TNT1 AAA 0 A_CustomMissile ("CacoXDeath7b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AAA 0 A_CustomMissile ("CacoXDeath1b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 A 0 A_CustomMissile ("CacoXDeath2b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 A 0 A_CustomMissile ("CacoXDeath3b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 A 0 A_CustomMissile ("CacoXDeath4b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AA 0 A_CustomMissile ("CacoXDeath6b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AAA 0 A_CustomMissile ("XDeath1Blue",30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AA 0 A_CustomMissile ("XDeath2bBlue", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 A 0 A_CustomMissile ("XDeath3bBlue", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 A 0 A_CustomMissile ("MuchBlood2Blue", 30, 0, random (0, 360), 2, random (0, 50))
		 TNT1 A 0 A_SpawnItem("DeadHalfCacoDemon")
         Stop
	Death.cut:
	Death.ExplosiveImpact:
        TNT1 A 0 A_SetFloorClip
		TNT1 A 0 A_Scream
		TNT1 O 0 A_NoBlocking
		TNT1 A 0 A_CustomMissile ("RipCaco", 0, 0, random (0, 360), 2, random (0, 160))
        CACL A 1
        TNT1 A 0 A_SpawnItem ("DeadHalfCacoDemon", 3)
        Stop
    Death.Plasma: Death.Plasma2:
        TNT1 A 0 A_Scream
        TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_SpawnItemEx ("DetectFloorCraterSmall",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 0 A_SpawnItem("BarrelExplosionSmokeColumn")
		TNT1 A 0 A_SpawnItemEx("TinyBurningPiece", random (-15, 15), random (-15, 15))
		TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece2", random (-35, 35), random (-35, 35))
		TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece3", random (-45, 45), random (-45, 35))
        CACB A 0 A_CustomMissile ("XDeathBurnedBlueMeat1", 0, 0, random (0, 360), 2, random (0, 160))
        CACB A 0 A_CustomMissile ("XDeathBurnedBlueMeat2", 0, 0, random (0, 360), 2, random (0, 160))
        CACB B -1
        Stop

	Death.Fire: Death.Burn: Death.Flames:
        TNT1 A 0 A_Scream
        TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_SpawnItemEx ("DetectFloorCraterSmall",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 0 A_SpawnItem("BarrelExplosionSmokeColumn")
		TNT1 A 0 A_SpawnItemEx("TinyBurningPiece", random (-15, 15), random (-15, 15))
		TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece2", random (-35, 35), random (-35, 35))
		TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece3", random (-45, 45), random (-45, 35))
		CACB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB 8 A_CustomMissile ("PlasmaSmoke", 16, 0, random (0, 180), 2, random (0, 180))
        CACB B -1
        Stop

	Death.Desintegrate:
	Death.CrushedBodies:
	Crush:
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_SetAngle(0)
		TNT1 A 0 A_CustomMissile ("XDeath1Blue", 5, random (-30, 30), random (0, 360), 2, random (0, 160))
		 TNT1 A 0 A_CustomMissile ("XDeath2bBlue", 5, random (-30, 30), random (0, 360), 2, random (0, 160))
		 TNT1 A 0 A_CustomMissile ("XDeath3bBlue", 5, random (-30, 30), random (0, 360), 2, random (0, 160))
		 TNT1 AAAAA 0 A_CustomMissile ("BlueBloodMistBig", 5, random (-40, 40), random (0, 360), 2, random (30, 90))
		 TNT1 A 0 A_SetAngle(90)
		TNT1 A 0 A_CustomMissile ("XDeath1Blue", 5, random (-30, 30), random (0, 360), 2, random (0, 160))
		 TNT1 A 0 A_CustomMissile ("XDeath2bBlue", 5, random (-30, 30), random (0, 360), 2, random (0, 160))
		 TNT1 A 0 A_CustomMissile ("XDeath3bBlue", 5, random (-30, 30), random (0, 360), 2, random (0, 160))
		 TNT1 AAAAAA 0 A_CustomMissile ("BlueBloodMistBig", 5, random (-40, 40), random (0, 360), 2, random (30, 90))
		TNT1 A 1 A_XScream
		CRS2 B -1
		Stop

		}}

Actor DeadHalfCacoDemon: DeadCacoDemon1
{Health 100 States{Spawn:
        CCD3 B -1
        Stop

	   Death:
	   Death.Cut:
	   Death.Minigun:
  	     TNT1 AAA 0 A_CustomMissile ("CacoXDeath1b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AA 0 A_CustomMissile ("CacoXDeath2b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AA 0 A_CustomMissile ("CacoXDeath3b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AA 0 A_CustomMissile ("CacoXDeath4b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AA 0 A_CustomMissile ("CacoXDeath5b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AAA 0 A_CustomMissile ("XDeath1Blue",30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AA 0 A_CustomMissile ("XDeath2bBlue", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 A 0 A_CustomMissile ("XDeath3bBlue", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 A 0 A_CustomMissile ("MuchBlood2Blue", 30, 0, random (0, 360), 2, random (0, 50))
         Stop
	   }}

Actor DeadCacoDemon2: DeadCacoDemon1
{Health 100 States{Spawn:
        CCD2 B -1
        Stop
	   }}

Actor DeadCacoDemon3: DeadCacoDemon1
{Health 100 States{Spawn:
        CCD1 C -1
        Stop
	   }}

	Actor SawedCacoDemon: DeadCacoDemon1
{Health 100 States{Spawn:
        HEDC C -1
        Stop
       Death.Cut:        Death.Minigun:	        Death:
		 TNT1 AAA 0 A_CustomMissile ("CacoXDeath7b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AAA 0 A_CustomMissile ("CacoXDeath1b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AA 0 A_CustomMissile ("CacoXDeath2b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AA 0 A_CustomMissile ("CacoXDeath3b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AA 0 A_CustomMissile ("CacoXDeath4b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AA 0 A_CustomMissile ("CacoXDeath6b", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AAA 0 A_CustomMissile ("XDeath1Blue",30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AA 0 A_CustomMissile ("XDeath2bBlue", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 A 0 A_CustomMissile ("XDeath3bBlue", 30, 0, random (0, 360), 2, random (20, 90))
		 TNT1 AAAAAA 0 A_CustomMissile ("BlueBloodMistBig", 30, 0, random (0, 360), 2, random (0, 50))
		 TNT1 A 0 A_CustomMissile ("MuchBlood2Blue", 30, 0, random (0, 360), 2, random (0, 50))
		 Stop}}

ACTOR CacodemonBite: ImpAttack
{
	Radius 31
	Height 31
	DamageType HKFT
    Damage (random(40,40))
	States
	{
	Spawn:
		TNT1 A 4
		Stop
	Death:
		TNT1 A 4 A_PlaySOund ("misc/xdeath1")
		Stop
	}
}

ACTOR BrutalizedCacodemon1: DeadCacodemon1
{
	Radius 24
	Height 65
	Health 20
	Scale 0.9
	-SOLID
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_Jump(96, "NoSuffer")
	CCD1 AAEEAAEEAAAAEEAAEEAA 5 A_CustomMissile ("Blue_BloodTrails", 40, 0, random (0, 360), 2, random (0, 160))
	TNT1 A 0 A_DIE("Fall")

	Death.Fall:
	CCD1 ABC 6 A_NoBlocking
	TNT1 A 0 A_SpawnItem("DeadCacodemon3")
	Stop

	Death:
	TNT1 AAAAA 0 A_CustomMissile ("Blue_FlyingBlood", 47, 0, random (0, 360), 2, random (30, 150))
	TNT1 A 0 A_CustomMissile ("CacoXDeath3", 40, 0, random (0, 360), 2, random (0, 160))
	TNT1 A 0 A_CustomMissile ("CacoXDeath4", 40, 0, random (0, 360), 2, random (0, 160))
	TNT1 A 0 A_CustomMissile ("CacoXDeath6", 40, 0, random (0, 360), 2, random (0, 160))
	TNT1 AAA 0 A_CustomMissile ("CacoXDeath7", 40, 0, random (0, 360), 2, random (0, 160))
	TNT1 AAAA 0 A_CustomMissile ("BlueBloodMistBig", 30, 0, random (0, 360), 2, random (0, 50))
	CCD2 A 10 A_Noblocking
	TNT1 A 0 A_SpawnItemEx("HealthCrueltyBonus2", 0, 0, 24, frandom (-2.5, 2.5), frandom (-2.5, 2.5), 5)
	TNT1 A 0 A_SpawnItemEx("ArmorCrueltyBonus2", 0, 0, 24, frandom (-2.5, 2.5), frandom (-2.5, 2.5), 5)
	TNT1 A 0 A_SpawnItem("BrutalizedCacodemon2")
	Stop

	NoSuffer:
	TNT1 AAAAA 0 A_CustomMissile ("Blue_FlyingBlood", 47, 0, random (0, 360), 2, random (30, 150))
	TNT1 A 0 A_CustomMissile ("CacoXDeath3", 40, 0, random (0, 360), 2, random (0, 160))
	TNT1 A 0 A_CustomMissile ("CacoXDeath4", 40, 0, random (0, 360), 2, random (0, 160))
	TNT1 A 0 A_CustomMissile ("CacoXDeath6", 40, 0, random (0, 360), 2, random (0, 160))
	TNT1 AAA 0 A_CustomMissile ("CacoXDeath7", 40, 0, random (0, 360), 2, random (0, 160))
	TNT1 A 0 A_DIE("NoSuffer")

	Death.NoSuffer:
	CCD2 B 6 A_NOBLOCKING
	TNT1 A 0 A_SpawnItem("DeadCacoDemon2")
	Stop
	}
}

ACTOR BrutalizedCacodemon2: BrutalizedCacodemon1
{
	Height 50
	States
	{
	Spawn:
	CCD2 AEAEAEAEAEAEAEAE 5 A_CustomMissile ("Blue_BloodTrails", 40, 0, random (0, 360), 2, random (0, 160))
	TNT1 A 0 A_DIE("Fall")

	Death.Fall:
	CCD2 B 6 A_Noblocking
	TNT1 A 0 A_SpawnItem("DeadCacodemon2")
	Stop

	Death:
	TNT1 AAAAA 0 A_CustomMissile ("Blue_FlyingBlood", 47, 0, random (0, 360), 2, random (30, 150))
	TNT1 AAAA 0 A_CustomMissile ("Blue_FlyingBloodTrail", 0, 0, random (0, 360), 2, random (0, 180))
    TNT1 AA 0 A_CustomMissile ("CacoXDeath6", 30, 0, random (0, 360), 2, random (0, 160))
	TNT1 AAAAA 0 A_CustomMissile ("CacoXDeath7", 30, 0, random (0, 360), 2, random (0, 160))
	TNT1 AAAAAA 0 A_CustomMissile ("BlueBloodMistBig", 30, 0, random (0, 360), 2, random (0, 50))
	TNT1 A 0 A_SpawnItemEx("HealthCrueltyBonus2", 0, 0, 24, frandom (-2.5, 2.5), frandom (-2.5, 2.5), 5)
	TNT1 A 0 A_SpawnItemEx("ArmorCrueltyBonus2", 0, 0, 24, frandom (-2.5, 2.5), frandom (-2.5, 2.5), 5)
	CCD3 A 10 A_Noblocking
	TNT1 A 0 A_SpawnItem("DeadHalfCacoDemon")
	Stop
	}
}