ACTOR Cacodemon_ : Cacodemon Replaces Cacodemon
{
	Game Doom
	bloodtype "Blue_Blood", "BlueSawBlood", "BlueSawBlood"
	bloodcolor "Blue"
	SpawnID 19
    GibHealth 25
    damagefactor "Crush", 10.0
	damagefactor "SSG", 100.0
	Radius 24
	Height 56
	Mass 400
	Speed 10
	Health 400
	PainChance 128
	PainChance "Kick", 255
	PainChance "Avoid", 90
	PainChance "Saw", 255
	damagefactor "ExplosiveImpact", 3.0 damagefactor "Shrapnel", 3.0
	damagefactor "GibRemoving", 0.0 damagefactor "HangingHook", 0
	Monster
	Scale 0.9
	+FLOAT +NOGRAVITY +FORCEXYBILLBOARD
	SeeSound "caco/sight"
	PainSound "caco/pain"
	DeathSound "caco/death"
	ActiveSound "caco/active"
	damagefactor "TeleportRemover", 0.0
	DamageFactor "CauseSplash", 0.0 DamageFactor "CauseObjectsToSplashSlime", 0.0 DamageFactor "CauseObjectsToSplashNukage", 0.0
	DamageFactor "CauseObjectsToSplashBlood", 0.0 DamageFactor "CauseObjectsToSplashLava", 0.0
	Obituary "$OB_CACO"
	HitObituary "$OB_CACOHIT"
	DropItem "DemonStrengthRune" 5
	DeathHeight 4
	BurnHeight 0
	damagefactor "Blood", 0.0 damagefactor "BlueBlood", 0.0 damagefactor "GreenBlood", 0.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 5 A_FaceTarget
        Goto Missile
	AvoidRight:
	    HEAD A 1 A_FaceTarget
	    TNT1 A 0 ThrustThing(angle*256/360+64, 15, 0, 0)
        HEAD A 5 A_FaceTarget
        Goto Missile
	
	ReplaceVanilla:
		TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
		TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
		TNT1 A 0 A_SpawnItemEx ("VanillaCacoDemon",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		Stop
    Spawn:
		HEAD A 0
		TNT1 A 0 ACS_NamedExecuteAlways("BDCHeckClassicMonsters", 0, 0, 0, 0)//Check if Vanilla Mode is activated
		HEAD A 1 A_Look
		TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "FatalityMarine")
		Goto Stand
		
	Stand:	
		HEAD A 10 A_Look
		Loop
		
	SearchPlayer:
	    TNT1 A 0 A_ClearTarget
		TNT1 A 0 A_TakeInventory("EnemyMemory", 40)
		HEAD A 10 A_Look
		TNT1 A 0 A_SetAngle(angle - 30)
		HEAD A 10 A_Look
		TNT1 A 0 A_SetAngle(angle + 30)
		HEAD A 10 A_Look
		TNT1 A 0 A_SetAngle(angle + 30)
		HEAD A 10 A_Look
		TNT1 A 0 A_SetAngle(angle - 30)
		
		
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		
		TNT1 A 0 A_Jump(128, "SearchPlayer")
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		HEAD A 0 A_Wander
		HEAD A 2 A_Look
		Goto SearchPlayer
		
	See:
		TNT1 A 0 A_CheckSight("See2")
		HEAD A 2 A_Chase
		HEAD AA 2 A_Chase ("","")
		TNT1 A 0 A_JumpIfCloser(99, "Melee")
		TNT1 A 0 A_TakeInventory("EnemyMemory", 1)
		Loop
		
	See2:
		HEAD AAAAAA 2 A_Chase
		TNT1 A 0 A_JumpIfInventory("EnemyMemory", 25, "SearchPlayer")
		TNT1 A 0 A_GiveInventory("EnemyMemory", 1)
		HEAD AAAAAA 2 A_Chase
		TNT1 A 0 A_JumpIfInventory("EnemyMemory", 25, "SearchPlayer")
		TNT1 A 0 A_GiveInventory("EnemyMemory", 1)
		TNT1 A 0 A_JumpIfInTargetInventory("IsInvisible", 1, "SearchPlayer")
		Goto See	
		
		
	Missile:
	    TNT1 A 0 A_TakeInventory("EnemyMemory", 30)
	    TNT1 A 0 A_JumpIfCloser(140, "Melee")
        TNT1 A 0 A_Jump (198, 3)
        Goto Avoid
        TNT1 AAA 0
		HEAD B 4 A_FaceTarget
		HEAD C 4 A_FaceTarget
		HEAD D 4 BRIGHT A_CustomMissile("CacodemonBall", 34, 0, 0, 0)
		Goto See
		
	Melee:	
		HEAD B 4 A_Facetarget
		HEAD C 4 A_Recoil(-5)
		TNT1 A 0 A_CustomMissile("CacodemonBite", 34, 0, 0, 0)
		//TNT1 A 0 A_JumpIfInventory("Fatality_Marine", 1, "FatalityMarine")
		HEAD D 4
		TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "FatalityMarine")
	Goto See
	
	Pain:
		HEAD E 3
		HEAD E 3 A_Pain
		HEAD F 6
		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 (128, 3)
        Goto Avoid
        TNT1 AAA 0
		HEAD F 6
        Goto See
		
	Pain.Cut:
	Pain.Saw:
		TNT1 A 0 A_Stop
		HEAD EF 6
        Goto See


	Avoid:
         NULL A 0 A_FaceTarget
         HEAD A 6 A_FastChase
         NULL A 0 A_FaceTarget
         HEAD A 6 A_FastChase
         NULL A 0 A_FaceTarget
         HEAD A 6 A_FastChase
         NULL A 0 A_FaceTarget
         HEAD A 6 A_FastChase

		HEAD B 5 A_FaceTarget
		HEAD C 5 A_FaceTarget
		HEAD D 5 BRIGHT A_HeadAttack
		 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 A_NoBlocking
		//TNT1 A 0 A_CustomMissile("CacodemonEyeBall", 50, 0, 0)
        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
        Stop
	
	Deathlulz:
		H3D2 A 6 A_Scream
		H3D2 B 6 A_NoBlocking
		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
        Stop
		
	   Death.Fatality:
        TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_Pain
		TNT1 A 0 A_JumpIfIntargetInventory("FistsSelected", 1, 1)
		Goto Death.SSG
		TNT1 A 0 A_FaceTarget
		TNT1 AA 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0, 0, 20, random (-1, 1), random (-1, 1), 8)
		TNT1 AA 0 A_SpawnItemEx("ArmorShardFatalityBonus", 0, 0, 20, random (-1, 1), random (-1, 1), 8)
		TNT1 A 0 A_GiveToTarget("GoFatality", 1)
        TNT1 A 0 A_Jump(128,5)
        TNT1 A 0 A_GiveToTarget("CacoDemonFatality", 1)
        Stop
        TNT1 AAAAAAA 0
        TNT1 A 0 A_GiveToTarget("CacoDemonFatality2", 1)
        TNT1 A 1
        TNT1 A 0
		Stop
		
	Death.saw:
        TNT1 A 0 A_SetFloorClip
        TNT1 A 0 A_SetFloorClip
		TNT1 A 0 A_Scream
		TNT1 O 0 A_NoBlocking
		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 C -1
        Stop		
		
	Death.cut:
	Death.ExplosiveImpact:
        TNT1 A 0 A_SetFloorClip
		TNT1 A 0 A_Scream
		TNT1 O 0 A_NoBlocking
		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
        Stop	
	Death.Minigun:
		TNT1 O 0 A_Jump(64, 2)
		Goto Death.Brutal
        TNT1 A 0 A_SetFloorClip
        TNT1 A 0 A_SetFloorClip
		TNT1 A 0 A_Scream
		TNT1 O 0 A_NoBlocking
		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
        Stop
	
	Death.Brutal:
	Death.Blast:
	Death.Railgun:
	TNT1 A 0 A_SetFloorClip
    TNT1 A 0 A_SetFloorClip
	TNT1 A 0 A_Scream
	TNT1 O 0 A_NoBlocking
	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
	TNT1 A -1
	Stop
		
		
	Death.SuperPlasma:
    Death.Plasma: Death.Plasma2:
        TNT1 A 0
        TNT1 A 0 A_Scream
        TNT1 A 0 A_NoBlocking
		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
        Stop
		
      Death.fire:
        TNT1 A 0
        TNT1 A 0 A_Scream
        TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_Playsound("props/redfire")
        TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 24, 0, random (0, 180), 2, random (0, 180))
        TNT1 A 0 A_SpawnItem("BurningCacoDemon")
        Stop
		
	Death.Explosives:
	XDeath:
	Death.Desintegrate:
		TNT1 A 0 A_XScream
		TNT1 A 0 A_NoBlocking
        TNT1 A 0 A_CustomMissile ("CacoXDeath", 0, 0, random (0, 360), 2, random (0, 160))
        Stop
		
	Death.SSG:
	Death.ExtremePunches:
	TNT1 A 0
	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 A_NoBlocking
	TNT1 A 0 A_SpawnItem ("BlueGrowingBloodPool", 1)
	TNT1 A 0 A_Stop
	TNT1 A 0 A_SpawnItem("DeadHalfCacoDemon")
	TNT1 A -1
	Stop
	
	 Raise:
    HEAD L 8 A_UnSetFloorClip
    HEAD KJIHG 8
    Goto See
    
	
	Crush:
		TNT1 A 0
		TNT1 A 0
		TNT1 AAAAAA 0 A_SpawnItem("BodyRemovalThing")
		TNT1 A 1 A_XScream
		Stop

    Pain.KillMe:
    Pain.Taunt:
		TNT1 A 0 HealThing(1)
        Goto Missile
    Death.KillMe:
    Death.Taunt:
	    TNT1 A 0 A_ChangeFlag("SOLID", 0)
        TNT1 A 0 A_SpawnItem("CacoDemon")
        Stop
		

FatalityMarine:
        TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
       CFPF A 1
	   TNT1 A 0 A_PlaySound("DSFDTHE")
       CFPF A 10
		 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 9
		 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 9
		 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 9
		 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 9
	   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
       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 A_ChangeFlag("SHOOTABLE", 0)
	TNT1 A 0 A_ChangeFlag("SOLID", 0)
	TNT1 A 0 A_SpawnItem("FrozenCacodemon")
	Stop
	
Death.Massacre:
	Goto Death	
		
	}
}

//===========================================================================
//
// Cacodemon plasma ball
//
//===========================================================================
ACTOR CacodemonBall_ Replaces CacodemonBall
{
	Game Doom
	SpawnID 126
	Radius 6
	Height 6
	Speed 14
	FastSpeed 18
	Damage (random(30,30))
	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 2 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 2
	Damage 0 
    +NOBLOCKMAP
    +NOTELEPORT
    +DONTSPLASH
	+MISSILE
	+FORCEXYBILLBOARD
    +CLIENTSIDEONLY
	RenderStyle Add
    Scale 0.7
	Gravity 0
	Alpha 0.5
	States
	{
    Spawn:
        TNT1 A 1
        SHOQ ABCDEFG 1 BRIGHT
        Stop
	}
}


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




ACTOR CacoXdeath1
{
translation "168:191=192:207"
    Radius 8
    Height 8
    Speed 9
    Scale 1.1
	Mass 1
    +NOBLOCKMAP
	+MISSILE
    +NOTELEPORT
    +MOVEWITHSECTOR
    +CLIENTSIDEONLY
    +RIPPER
    +BLOODLESSIMPACT 
Decal BlueBloodSplat
damagetype Blood
    SeeSound "misc/xdeath4"
    DeathSound "misc/xdeath1"
	Decal BlueBloodSplat
    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 2002
        Stop
     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 2002
        Stop
        TNT1 A 1
    }
}


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 2002
        Stop
        TNT1 A 1
    }
}

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 2002
        Stop
        TNT1 A 1
    }
}

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 2002
        Stop
        TNT1 A 1
    }
}

ACTOR CacoXdeath5b: CacoXdeath5 { Speed 7}

ACTOR CacoXdeath6: CacoXDeath1
{
Scale 1.3
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 2002
        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 2002
        Stop
	  Death2:
	TNT1 A 0
       TNT1 A 0 A_SpawnItem("Blue_BloodSpot",0,0,0,1)
        CCP5 B 2002
        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
    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 300
  damagefactor "CrushedBodies", 500.0
	States
    {
    Spawn:
		HEAD L -1
        Stop
    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.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 200 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 200 States{Spawn:
        CCD2 B -1
        Stop    
	   }}	
	   
Actor DeadCacoDemon3: DeadCacoDemon1
{Health 200 States{Spawn:
        CCD1 C -1
        Stop    
	   }}		   
		
		
	Actor SawedCacoDemon: DeadCacoDemon1
{Health 400 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
{
    +THRUGHOST
	DamageType HKFT
    Damage 5
}





ACTOR BrutalizedCacodemon1: DeadCacodemon1
{
	Radius 24
	Height 48
	Health 50
	Scale 1.0
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_Jump(96, "NoSuffer")
	TNT1 A 0 A_Jump(64, "Fall")
	CCD1 AAEEAAEEAAAAEEAAEEAA 5 A_CustomMissile ("Blue_BloodTrails", 40, 0, random (0, 360), 2, random (0, 160))
	Fall:
	TNT1 AAAAA 0 A_NoBlocking
	TNT1 A 0 A_Fall
	TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
	TNT1 A 0 A_ChangeFlag("SOLID", 0)
	CCD1 ABC 6
	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
	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))
	CCD2 B 6
	TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
	TNT1 A 0 A_ChangeFlag("SOLID", 0)
	TNT1 A 0 A_SpawnItem("DeadCacoDemon2")
	Stop	
}}

ACTOR BrutalizedCacodemon2: BrutalizedCacodemon1
{
	States
	{
	Spawn:
	CCD2 AEAEAEAEAEAEAEAE 5 A_CustomMissile ("Blue_BloodTrails", 40, 0, random (0, 360), 2, random (0, 160))
	TNT1 A 0 A_NoBlocking
	TNT1 A 0 A_Fall
	CCD2 B 6
	TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
	TNT1 A 0 A_ChangeFlag("SOLID", 0)
	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_SpawnItem ("ArmorShardFatalityBonus")
	CCD3 A 10
	TNT1 A 0 A_SpawnItem("DeadHalfCacoDemon")
	Stop	
}}

	
	






