// *** MODIFIED BY CHEBMASTER
// I mark most important places modified by me with //***Che -- unless I forget to.





//===========================================================================
//
// Demon
//
//===========================================================================


Actor PinkyBossCubeSpawner: AbstractBossCubeSpawner
{
	Height 56
	Radius 20
	States
	{
		DoSummon:	
			TNT1 A 0 A_GiveInventory("SummonsCount", 1, AAPTR_TRACER)
			TNT1 A 0 A_SpawnItemEx("TeleportationFog")
			TNT1 A 1 A_SpawnItemEx("BullDemon",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0,user_stid)
			Stop
	}
}

ACTOR ZandronumDemon
{
	Game Doom
	SpawnID 8
	Health 150
	PainChance 180
	Speed 10
	Radius 30
	Height 56
	Mass 400
	Monster
	+FLOORCLIP
	SeeSound "demon/sight"
	AttackSound "demon/melee"
	PainSound "demon/pain"
	DeathSound "demon/death"
	ActiveSound "demon/active"
	Obituary "$OB_DEMONHIT"
	States
	{
	Spawn:
		SARG AB 10 A_Look
		Loop
	See:
		SARG AABBCCDD 2 Fast A_Chase
		Loop
	Melee:
		SARG EF 8 Fast A_FaceTarget
		SARG G 8 Fast A_SargAttack
		Goto See
	Pain:
		SARG H 2 Fast
		SARG H 2 Fast A_Pain
		Goto See
	Death:
		SARG I 8
		SARG J 8 A_Scream
		SARG K 4
		SARG L 4 A_NoBlocking
		SARG M 4
		SARG N -1
		Stop
	Raise:
		SARG N 5
		SARG MLKJI 5
		Goto See
	}
}



ACTOR FBD_BullDemon: ZandronumDemon 17841
{
	//***Che radius, height and maxdropoffheight (n/a for flying ones) MUST be kept consistent with FBD_TrySpawn in FBD_CORE.acs!    
	
	//***Che: cross-mod hardening: see ACTOR BullDemon: FBD_BullDemon Replaces Demon {} in Doom_Replacements.txt
	
	//$category "FBD Monsters"
	//$Sprite SARGA1
	
	//***Che
	var int user_head_tid;
//	var int user_head_type; // unnecessary variable -- just in case some script tries accessing it
	var int user_sleeping;
	var int user_item_no;
	var int user_serverside_sfchk;
	
	GibHealth 35
	//Radius 30
	Health 200
    Scale 1.1
	Height 56
	Radius 20
	Mass 400
    Speed 14
	DamageFactor "Explosive", 1.4
    FastSpeed 22
	PainChance "Saw", 200
	Painchance "Slide", 0
	PainChance "Cut", 200
	PainChance "Taunt", 255
	PainChance "ExtremePunches", 255 PainChance "SuperPunch", 255
	PainChance "Kick", 255 PainChance "HangingHook", 0
    damagefactor "Crush", 10.0    damagefactor "SSG", 5.0
	damagefactor "Avoid", 0.0	damagefactor "GibRemoving", 0.0	damagefactor "TeleportRemover", 0.0
	DamageFactor "CauseSplash", 0.0 DamageFactor "CauseObjectsToSplashSlime", 0.0 DamageFactor "CauseObjectsToSplashNukage", 0.0
	DamageFactor "CauseObjectsToSplashBlood", 0.0 DamageFactor "CauseObjectsToSplashLava", 0.0
	Monster
	damagefactor "Blood", 0.0 damagefactor "BlueBlood", 0.0 damagefactor "GreenBlood", 0.0
	+FLOORCLIP 
	-FASTER
	+SLIDESONWALLS
	+NEVERFAST
	SeeSound "demon/sight"
	PainSound "demon/pain"
	DeathSound "demon/death"
	ActiveSound "PINKIDL"
    BloodType "FBD_Blood", "FBD_SawBlood", "FBD_SawBlood"
	DamageType Eat
	MaxStepHeight 32
	MaxDropOffHeight 32
	MeleeRange 100
	Tag "$BULLDEMON" // "Pinky"
	DropItem "DemonStrengthRune" 2
	
	PainChance "Argent", 255
	DamageFactor "Argent", 1.0
	
	var int user_jump_power; // passed to A_ThrustThingZ, set via ACS call (scales with map gravity for EDAY Mars chapter)
	
	PainChance "Bullet792", 160 // machineguns and snip[er rifles not aimed
	PainChance "SniperBullet", 255 // sniper rifle aimed

	damagefactor "Bullet792", 1.2
	damagefactor "SniperBullet", 1.2 // must die in 3 shots (damage 60)
	
	damagefactor "Killme", 1.0 // AOE inflicted by captured marines
	PainChance "Killme", 255	
	
	damagefactor "ComeEatMeDemon", 1.0 // the only monster affected by this (AOE spammed by dead player's lower half, causes pinkies to come and eat it)
	PainChance "ComeEatMeDemon", 255
	
	PainChance "Ice", 255
	
	States
	{
		//***Che
		Pain.Ice:
			"----" A 20 A_Pain
			Goto See
		WaitTargetsFatalityOut:
			TNT1 A 0 A_PlaySound("demon/sight", CHAN_VOICE)
			SARG H 1 A_Jump(256, "WTF1", "WTF2", "WTF3", "WTFWander", "WTFWander", "WTFWander")
			Wait
		WTF1:
			SARG HHHH 12 A_SetAngle(angle + Random(-20,20))
			Goto See
		WTF2:
			SARG EEEEEE 9 A_SetAngle(angle + Random(-20,20))
			Goto See	
		WTF3:
			SARG YZYZYZYZ 6 
			Goto See	
		WTFWander:
			SARG AABBCCDDAABBCCDDAABBCCDD 2 A_Wander
			Goto See
		
		Death.FriendlyExplosion:
			TNT1 A 0
			goto Death.ExplosiveImpact		
	/*	
		ReplaceVanilla:
			TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			TNT1 A 0 A_SpawnItemEx ("VanillaDemon",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
			Stop
	*/		
		PotPourriSwap:
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
		PotPourriWait:			
			KYPP A 5 A_JumpIf(CallAcs("FBD_GetMapRandomizerReady"), 1) // a two-second delay to allow re-randomizing on loading an auto-save
			Loop
			TNT1 A 0 A_Jumpif(!CallAcs("GetPotPourriChance", 66), "PotPourriNoSwap") // pinkies have 66% chance instead 33%
			TNT1 A 0 A_ChangeFlag("SOLID", 0)
			TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
			TNT1 A 0 A_SpawnItemEx ("BullDemonPotpourriSwapper",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG | SXF_TRANSFERPOINTERS | SXF_TRANSFERSPECIAL | SXF_CLEARCALLERSPECIAL | SXF_CLEARCALLERTID  ,0, tid)
			TNT1 A 30
			Stop
		PotPourriNoSwap:
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 1)
			Goto PotPourriCancel			
			
		Spawn:
			SARG Y 0 NODELAY A_JumpIf(CallAcs("GetPotPourri"), "PotPourriSwap")
		PotPourriCancel:	
			TNT1 A 0 
			SARG Y 0 ACS_NamedExecuteWithResult("FBD_RunMonster")
			SARG Y 2 // jump power script can only decect EDAY on the second tic
			SARG Y 0 A_SetUserVar("user_jump_power", CallAcs("AdjustJumpPowerForEDAYMarsChapter", 25))
		
		Spawned:	
			TNT1 A 0 A_JumpIfInventory("EatMe", 1, "Eat")
			SARG YZYZYZYZYZ 10 A_Look
			Loop
			
		Forget:	
			TNT1 A 0 A_ClearTarget
			TNT1 A 0 A_TakeInventory("EnemyMemory", 15)
		SearchPlayer:
		Idle:
			
			SARG YZ 10 A_Look
			TNT1 A 0 A_SetAngle(angle - 40)
			SARG YZ 10 A_Look
			TNT1 A 0 A_SetAngle(angle + 40)
			SARG YZ 10 A_Look
			
			
			SARG A 0 A_Wander
			SARG A 2 A_Look
			SARG A 0 A_Wander
			SARG A 2 A_Look
			SARG B 0 A_Wander
			SARG B 2 A_Look
			SARG B 0 A_Wander
			SARG B 2 A_Look
			SARG C 0 A_Wander
			SARG C 2 A_Look
			SARG C 0 A_Wander
			SARG C 2 A_Look
			SARG D 0 A_Wander
			SARG D 2 A_Look
			SARG D 0 A_Wander
			SARG D 2 A_Look
			
			TNT1 A 0 A_Jump(128, "SearchPlayer")
			
			SARG A 0 A_Wander
			SARG A 2 A_Look
			SARG A 0 A_Wander
			SARG A 2 A_Look
			SARG B 0 A_Wander
			SARG B 2 A_Look
			SARG B 0 A_Wander
			SARG B 2 A_Look
			SARG C 0 A_Wander
			SARG C 2 A_Look
			SARG C 0 A_Wander
			SARG C 2 A_Look
			SARG D 0 A_Wander
			SARG D 2 A_Look
			SARG D 0 A_Wander
			SARG D 2 A_Look
			
			Goto SearchPlayer
			
		See:
			TNT1 A 0 A_CheckSight("SeeNeverSeen")
		
		SeeContinue:
			TNT1 A 0
			
			TNT1 A 0 A_JumpIf(!user_sleeping, 3) // forgo the expensive sight check if already awake
			TNT1 A 0 A_CheckSight(2) // do not consider ourselves awake if none of the players can see us
			TNT1 A 0 A_SetUserVar("user_sleeping", 0)
			
			TNT1 A 0 A_JumpIfInventory("ZombieManFatality", 1, "FatalityZombieman")
			TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "FatalitySergeant")
			TNT1 A 0 A_JumpIfInventory("ImpFatality", 1, "FatalityImp")
			TNT1 A 0 A_JumpIfInventory("ComandoFatality", 1, "FatalityComando")
			TNT1 A 0 A_JumpIfInventory("ComeEatMeDemon", 1, "EnragedSee")
			TNT1 A 0 A_CheckSight("SeeNoSee")
			TNT1 A 0 A_JumpIfInventory("EatMe", 1, "Eat")
			//TNT1 A 0 A_SpawnItemEx("FootSep6", 0, 0, 30, 0, 0)
			TNT1 A 0 A_TakeInventory("EnemyMemory", 17)
			SARG AA 2 A_Chase
			SARG BB 2 A_Chase
			//TNT1 A 0 A_SpawnItemEx("FootSep6", 0, 0, 30, 0, 0)
			SARG CC 2 A_Chase
			SARG DD 2 A_Chase
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "Idle")
			TNT1 A 0 A_JumpIfCloser(1000, "SeeContinue")
			TNT1 A 0 A_Jump(16, "Sprint")
			Loop
			
		SeeNoSee:
			//TNT1 A 0 A_SpawnItemEx("FootSep6", 0, 0, 30, 0, 0)
			SARG AA 2 A_Chase
			SARG BB 2 A_Chase
			SARG CC 2 A_Chase
			SARG DD 2 A_Chase
			TNT1 A 0 A_GiveInventory("EnemyMemory", 1)
			TNT1 A 0 A_JumpIfInventory("EnemyMemory", 15, "Forget")
			Goto See
			
		SeeNeverSeen:
			//TNT1 A 0 A_SpawnItemEx("FootSep6", 0, 0, 30, 0, 0)
			SARG AA 2 A_Chase("Melee", "")
			SARG BB 2 A_Chase
			SARG CC 2 A_Chase
			SARG DD 2 A_Chase
			Loop

		//Missile:
			//SARG A 0 A_FaceTarget
			//TNT1 A 0 A_JumpIfCloser(160, "JumpAttacK")
			//TNT1 A 0 A_JumpIfCloser(1000, "See")
			//TNT1 A 0 A_GiveInventory("ComeEatMeDemon", 1)
			//Goto EnragedSee

		Pain.Taunt:	
			TNT1 A 0
			TNT1 A 0 HealThing(1)
			TNT1 A 0 A_JumpIfInventory("ComeEatMeDemon", 1, "EnragedSee")
			TNT1 A 0 A_PlaySound("demon/sight", CHAN_VOICE)
			SARG FGF 2 A_FaceTarget
			TNT1 A 0 A_GiveInventory("ComeEatMeDemon", 1)
			TNT1 A 0 A_ChangeFlag("QUICKTORETALIATE", 1)
			Goto EnragedSee
		Sprint: // 33% faster, a clone of EnragedSee
			SARG A 1 A_Chase("Melee", "")
			SARG A 2 A_Chase("Melee", "")
			SARG B 1 A_Chase("Melee", "")
			SARG B 2 A_Chase("Melee", "")
			SARG C 1 A_Chase("Melee", "")
			SARG C 2 A_Chase("Melee", "")
			SARG D 1 A_Chase("Melee", "")
			SARG D 2 A_Chase("Melee", "")
			TNT1 A 0 A_Jump(64, "See")
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "Idle")
			Loop			
			
		EnragedSee: // 25% faster
			TNT1 A 0 A_JumpIfInventory("EatMe", 1, "Eat")
			TNT1 A 0 A_TakeInventory("EnemyMemory", 17)
			SARG A 1 A_Chase("Melee", "")
			SARG A 2 A_Chase("Melee", "")
			SARG B 1 A_Chase("Melee", "")
			SARG B 2 A_Chase("Melee", "")
			SARG C 1 A_Chase("Melee", "")
			SARG C 2 A_Chase("Melee", "")
			SARG D 1 A_Chase("Melee", "")
			SARG D 2 A_Chase("Melee", "")
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "Idle")
			Loop
		
		Melee:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInTargetInventory("GoFatality", 1, "WaitTargetsFatalityOut")
			TNT1 A 0 A_JumpIfCloser(70, "Bite")
			TNT1 A 0
			TNT1 A 0 A_PlaySound("demon/melee", CHAN_BODY)
			TNT1 A 0 A_TakeInventory("EnemyMemory", 100)
			//TNT1 A 0 A_JumpIfInTargetInventory("ComeEatMeDemon", 1, "See")
			
			SAPC A 5 A_FaceTarget
			SARG E 3 A_FaceTarget
			TNT1 A 0 ThrustThingZ(0,user_jump_power,0,1) // downscales in EDAY Mars maps!
			TNT1 A 0 A_Recoil(-10)
			SAPC B 5 
			SARG GGG 4 A_CustomMissile("DemonAttack",40,0,0,2)
			TNT1 A 0 A_CustomMissile("DemonAttack",5,0,0,2)
			
			TNT1 A 0 A_JumpIfInventory("ZombieManFatality", 1, "FatalityZombieman")
			TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "FatalitySergeant")
			TNT1 A 0 A_JumpIfInventory("ImpFatality", 1, "FatalityImp")
			TNT1 A 0 A_JumpIfInventory("ComandoFatality", 1, "FatalityComando")	
			TNT1 A 0 A_JumpIfInventory("EatMe", 1, "Eat")
			SARG G 6
			TNT1 A 0 A_JumpIfCloser(70, "Bite")
			Goto SeeContinue
			
		Bite:	
			SARG G 0 A_FaceTarget
			TNT1 A 0 A_PlaySound("demon/melee", CHAN_BODY)
			TNT1 A 0 A_Recoil(-15)
			TNT1 A 0 A_TakeInventory("EnemyMemory", 100)
			TNT1 A 0 A_JumpIfInTargetInventory("ComeEatMeDemon", 1, "MeleeDown")
			SARG E 6 A_FaceTarget
			SARG F 6 A_FaceTarget
			TNT1 A 0 A_CustomMissile("DemonAttack",40,0,0,2)
			SARG G 12 A_CustomMissile("DemonAttack",5,0,0,2)

			TNT1 A 0 A_JumpIfInventory("ZombieManFatality", 1, "FatalityZombieman")
			TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "FatalitySergeant")
			TNT1 A 0 A_JumpIfInventory("ImpFatality", 1, "FatalityImp")
			TNT1 A 0 A_JumpIfInventory("ComandoFatality", 1, "FatalityComando")	
			TNT1 A 0 A_JumpIfInventory("EatMe", 1, "Eat")
			Goto SeeContinue
			
			
		MeleeDown:
			PDEV A 6 A_FaceTarget
			PDEV B 6 A_FaceTarget
			PDEV C 12 A_CustomMissile("DemonAttack",5,0,0,0)
			 TNT1 A 0 A_JumpIfInventory("ZombieManFatality", 1, "FatalityZombieman")
			 TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "FatalitySergeant")
			 TNT1 A 0 A_JumpIfInventory("ImpFatality", 1, "FatalityImp")
			 TNT1 A 0 A_JumpIfInventory("ComandoFatality", 1, "FatalityComando")	
			 TNT1 A 0 A_Jump(32, "EatFast")
			Goto SeeContinue	

		Pain:
			SARG H 0 A_Pain
			TNT1 A 0 A_JumpIfInventory("ZombieManFatality", 1, "EndFatalityZombieman")
			TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "EndFatalitySergeant")
			TNT1 A 0 A_JumpIfInventory("ImpFatality", 1, "EndFatalityImp")
			TNT1 A 0 A_JumpIfInventory("ComandoFatality", 1, "EndFatalityComando")	
			SARG H 4
			Goto SeeContinue
			
		Pain.Argent:

			TNT1 A 0
		
			//TNT1 A 0 A_ClearTarget
			TNT1 A 0 HealThing(30)
			TNT1 A 0 ACS_NamedExecuteWithResult("DisplayArgentDischarge", 20, 48, 0)	
			
			TNT1 A 0 A_GiveInventory("ComeEatMeDemon", 1)
			TNT1 A 0 A_ChangeFlag("QUICKTORETALIATE", 1)
			TNT1 A 0 A_ChangeFlag("ALWAYSFAST", 1)
			TNT1 A 0 A_ChangeFlag("NEVERFAST", 0)
			
			SARG HHHH 8 A_Pain
			Goto SeeContinue			
		
		Pain.Melee:
			SARG H 0 A_Pain
			TNT1 A 0 A_JumpIfInventory("ZombieManFatality", 1, "EndFatalityZombieman")
			TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "EndFatalitySergeant")
			TNT1 A 0 A_JumpIfInventory("ImpFatality", 1, "EndFatalityImp")
			TNT1 A 0 A_JumpIfInventory("ComandoFatality", 1, "EndFatalityComando")	
			SARG H 6 
			Goto SeeContinue
		
		
			
		Pain.Shotgun:
			TNT1 A 0 A_Pain
			TNT1 A 0
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_Recoil (2)
			SARG H 0
			TNT1 A 0 A_JumpIfInventory("ZombieManFatality", 1, "EndFatalityZombieman")
			TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "EndFatalitySergeant")
			TNT1 A 0 A_JumpIfInventory("ImpFatality", 1, "EndFatalityImp")
			TNT1 A 0 A_JumpIfInventory("ComandoFatality", 1, "EndFatalityComando")	
			SARG H 4
			Goto SeeContinue	

		Pain.Kick:
		Pain.HeavyImpact:
		Pain.SuperPunch:
		Pain.ExtremePunches:
			SARG A 0 A_Pain
			SARG A 0 A_FaceTarget
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_Recoil (15)
			TNT1 A 0 A_JumpIfInventory("ZombieManFatality", 1, "EndFatalityZombieman")
			TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "EndFatalitySergeant")
			TNT1 A 0 A_JumpIfInventory("ImpFatality", 1, "EndFatalityImp")
			TNT1 A 0 A_JumpIfInventory("ComandoFatality", 1, "EndFatalityComando")	
			SARG H 8
			Goto SeeContinue
		
		Death.Eat:
			TNT1 A 0 A_GiveToTarget("EatMe",1)
			//Goto Death+3 //***Che: this was glitching
			Goto Death
	
		Death:
			TNT1 A 0
			TNT1 A 0 A_Jump(96, "LeftDeath")
			TNT1 A 0 A_Jump(96, "ArmBittenOff") //13)
			
		//***Che:
		Death.Psionic:
		
		Death.Minor:
			TNT1 AA 0
			SARG I 8
			SARG J 8 A_Scream
			SARG K 4
			SARG L 4 A_NoBlocking
			SARG M 4
			//TNT1 A 0 A_SpawnItem ("DeadDemon1", 1)
			TNT1 A 0 A_SpawnItemEx("DeadDemon1", 0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
			// ? 
			TNT1 AAAAAAAAA 0
		ArmBittenOff:	
			TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathDemonArm", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SAAR A 8 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SAAR B 8 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("PoorPinkyLostHisArm",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death.Electric:
		Death.Burn: // imp fireball
			TNT1 A 0
			TNT1 A 0 A_SpawnItem("BarrelExplosionSmokeColumn")
			TNT1 A 0 A_Jump(96, "LeftDeath")
			Goto Death.Minor
			
		LeftDeath:
			S2RG I 8
			S2RG J 8 A_Scream
			S2RG K 4
			S2RG L 4 A_NoBlocking
			S2RG M 4
			TNT1 A 0 A_SpawnItemEx("DeadDemon1Left", 0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		CleanDeath:
			TNT1 A 0
			TNT1 A 0 A_Jump(96, "LeftDeath")
			SARG I 8
			SARG J 8 A_Scream
			SARG K 4
			SARG L 4 A_NoBlocking
			SARG M 4
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx("DeadDemon1", 0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death.Kick:
		Death.Melee:
		Death.SuperKick:
			TNT1 A 0
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_Recoil(5)
			TNT1 A 0 ThrustThingZ(0,20,0,1)
			Goto CleanDeath
			
		Death.Shotgun:
			TNT1 A 0
			TNT1 A 0 A_JumpIfCloser(300, "Death.Strong")
			Goto Death.Minor //***Che //Death+4
			
		Death.Strong:
			TNT1 A 0
			TNT1 A 0 A_Jump(128, "DeathRemoveArm")
			TNT1 A 0 A_FaceTarget
		Death.Strong2:
			 TNT1 AA 0 A_CustomMissile ("SmallBrainPiece", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			 TNT1 AA 0 A_CustomMissile ("XDeath3", random (45, 55), random (5, -5), random (160, 200), 2, random (-10, 10))
			 TNT1 AA 0 A_CustomMissile ("XDeath2", random (45, 55), random (5, -5), random (160, 200), 2, random (-10, 10))
			TNT1 AAAAAA 0 A_CustomMissile ("BloodMistBig", 40, 0, random (0, 360), 2, random (40, 90))
			TNT1 A 0 A_CustomMissile ("BloodMistExtraBig", 40, 0, random (0, 360), 2, random (40, 90))
			TNT1 A 0 A_CustomMissile ("PinkyHeadPiece", 52, 0, random (0, 360), 2, random (0, 160))
			//TNT1 A 0 A_CustomMissile ("PinkyJaw", 52, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("SmallBrainPieceFast", random (45, 55), random (5, -5), random (170, 190), 2, random (-10, 10))
			SARH AAAAAAA 2 A_CustomMissile ("Brutal_LiquidBlood", 40, 0, random (0, 360), 2, random (30, 110))
			SARH BBBBBB 2 A_CustomMissile ("Brutal_LiquidBlood", 40, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Scream 
			SARH CCCCCC 2 A_CustomMissile ("Brutal_LiquidBlood", 30, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			SARH DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 0 A_SpawnItemEx("DeadDemonNoHead",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) //-1
			Stop

		Death.Saw:
			TNT1 A 0
			TNT1 AA 0 A_SpawnItem("muchblood3", 0, 40)
			TNT1 A 0 A_Jump(196, "DeathRemoveArm")
			TNT1 A 0 A_CustomMissile ("XDeathStomach", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath2b", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath3b", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARG O 8
			SARG P 8 A_Scream
			SARG Q 4 A_NoBlocking
			SARG RRSSTT 2 A_CustomMissile ("Brutal_LiquidBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 110))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx("DeadDemonHalf",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 110))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) //-1
			Stop
		
		Death.Cut:
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 AA 0 A_SpawnItem("muchblood3", 0, 40)
			TNT1 A 0 A_Jump(128, "Death.Cut2")
			TNT1 A 0 A_CustomMissile ("XDeathHalfDemon", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathStomach", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath2b", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath3b", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARC AAABBBCCCDDD 3 A_CustomMissile ("Brutal_LiquidBlood", 35, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			SARC DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD 2 A_CustomMissile ("Brutal_LiquidBlood", 15, 0, random (0, 360), 2, random (30, 110))
			SARC D 0 A_SpawnItemEx("DeadDemonHalf23",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) //-1
			Stop
		
		Death.Cut2:
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("XDeathPinkyDemonHead", random (45, 55), random (-5, 5), random (0, 360), 2, random (30, 90))
			TNT1 AA 0 A_CustomMissile ("XDeath3b", random (45, 55), random (5, -5), random (160, 200), 2, random (-10, 10))
			TNT1 AA 0 A_CustomMissile ("XDeath2b", random (45, 55), random (5, -5), random (160, 200), 2, random (-10, 10))
			TNT1 A 0 A_CustomMissile ("MuchBlood", 60, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("BloodMistBig", 50, 0, random (0, 360), 2, random (30, 90))
			TNT1 AAAAA 0 A_CustomMissile ("SmallBrainPieceFast", random (45, 55), random (5, -5), random (170, 190), 2, random (-10, 10))
			SARH AAAAAAA 2 A_CustomMissile ("Brutal_LiquidBlood", 40, 0, random (0, 360), 2, random (30, 110))
			SARH BBBBBB 2 A_CustomMissile ("Brutal_LiquidBlood", 40, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Scream 
			SARH CCCCCC 2 A_CustomMissile ("Brutal_LiquidBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 110))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			SARH DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 0 A_SpawnItemEx("DeadDemonNoHead",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) //-1
			Stop
   
		Death.Blast:
		Death.SSG:
		Death.Railgun:
			TNT1 A 0
			TNT1 A 0 A_Stop
			SARC A 1 A_Pain
			SARC A 1 A_FaceTarget
			
			TNT1 AAA 0 bright A_CustomMissile ("SuperGoreSpawner", 35, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			//TNT1 A 0 A_CustomMissile ("MeatDeath", 0, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAAAA 0 A_CustomMissile ("BloodMistBig", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 90))
			TNT1 AA 0 A_CustomMissile ("BloodMistExtraBig", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 90))
			TNT1 AA 0 A_CustomMissile ("pinkyheadPiece", 42, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("PinkyJaw", 42, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathDemonArm", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			SARC AAABBBCCCDDD 3 A_CustomMissile ("Brutal_LiquidBlood", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 110))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			SARC DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD 2 A_CustomMissile ("Brutal_LiquidBlood", 15, 0, random (0, 360), 2, random (30, 110))
			SARC D 0 A_SpawnItemEx("DeadDemonHalf23",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) //-1
			Stop
			
		Death.SuperPunch:
		Death.ExtremePunches:
		Death.DHFT:
			 TNT1 A 0
			 //TNT1 A 0 A_JumpIfInTargetInventory("HeavyStrikeUpper", 1, "HeavyPunchUpper")
			 TNT1 A 0 ThrustThingZ(0,15,0,1)
			 TNT1 A 0 A_FaceTarget
			 TNT1 A 0 A_Recoil(5)
			 Goto Death.Strong2
			 
			TNT1 A 0 
			TNT1 A 0 A_ClearTarget
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 42, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_ChangeFlag("NOBLOCKMONST", 1)
			POSL A 1 A_Chase("", "")
			POSL A 1 A_Pain
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_Recoil(8)
			TNT1 A 0 ThrustThingZ(0,45,0,1)
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Scream
			POSL ABCDE 6
			POSL F -1
			Stop
			
		HeavyPunchRight:
			TNT1 A 0
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 ThrustTHing(angle*256/360+64, 10, 0)
			TNT1 A 0 A_Jump(128, "Death.LandMine")
			Goto BlownAwayLeft
			
		HeavyPunchLeft:
			TNT1 A 0
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 ThrustTHing(angle*256/360+192, 10, 0)
			Goto BlownAwayRight
		
		Death.SniperBullet:
		Death.Bullet792:
		Death.Minigun:
			TNT1 A 0
			TNT1 A 0 A_Jump(32, "Death.Cut")
			TNT1 A 0 A_Jump(132, "DeathRemoveArm")
			Goto Death
			
			
		Death.Stomp:
			// if 15% random chance or the cyberdemon is below us, be catapulted violently
			TNT1 A 0 A_JumpIf(Random(0,100) < 15 || CallAcs("GetZDeltaToTarget") < - 32, "Death.ExtremePunches") 		
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			SARG IJKL 2
			TNT1 AA 0 A_SpawnItem("MeatDeathSmall")
			TNT1 AAA 0 bright A_CustomMissile ("SuperGoreSpawner", 5, 0, random (0, 360), 2, random (30, 180))
			TNT1 AAAA 0 bright A_CustomMissile ("XDeath1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			TNT1 AA 0 bright A_CustomMissile ("XDeath2b", 55, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			TNT1 AA 0 bright A_CustomMissile ("XDeath3b", 55, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			TNT1 AAAAAA 0 A_CustomMissile ("BloodMistBig", 40, 0, random (0, 360), 2, random (40, 90))
			TNT1 AA 0 A_CustomMissile ("BloodMistExtraBig", 40, 0, random (0, 360), 2, random (40, 90))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItem ("CrushedRemains")
			TNT1 A 1
			TNT1 A 1 A_XScream
			
			TNT1 A -1 //***Che: Gibbed monsters -- ONLY the gibbed monsters -- may use this
				//   to auto-respawn on nightmare and be raised by viles.
				// Employing this on a destructible corpse results in that corpse
				//   respawning on nightmare as a corpse (or worse, as a burning hollering demon)
				// If a monster's death state spawns a destructible corpse,
				//   the respawning/raising is relegated to that corpse
				//   and the monster MUST use Stop instead	
			Stop
			
		Crush:
			TNT1 A 0
			TNT1 AAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail8", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAAA 0 A_SpawnItemEx ("BodyRemovalThing",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 1 A_XScream
			
			TNT1 A -1 //***Che: Gibbed monsters -- ONLY the gibbed monsters -- may use this
				//   to auto-respawn on nightmare and be raised by viles.
				// Employing this on a destructible corpse results in that corpse
				//   respawning on nightmare as a corpse (or worse, as a burning hollering demon)
				// If a monster's death state spawns a destructible corpse,
				//   the respawning/raising is relegated to that corpse
				//   and the monster MUST use Stop instead	
			Stop	
			
		DeathRemoveArm:
			TNT1 A 0
			TNT1 AAAAAA 0 A_CustomMissile ("BloodMistBig", 40, 0, random (0, 360), 2, random (40, 90))
			TNT1 A 0 A_CustomMissile ("BloodMistExtraBig", 40, 0, random (0, 360), 2, random (40, 90))
			Goto ArmBittenOff //Death+14
		
		Death.GreenFire:
			TNT1 A 0
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 AAAAA 0 A_CustomMissile ("BloodMistBig", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 90))
			

			TNT1 A 0 A_CustomMissile ("XDeathBurnedDemonArm", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedDemonLeg", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			EXPL AAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("GreenFlameTrails", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			XBRN AAAA 2 BRIGHT A_SpawnItem("GreenFlare",0,43)
			
			TNT1 A -1 //***Che: Gibbed monsters -- ONLY the gibbed monsters -- may use this
				//   to auto-respawn on nightmare and be raised by viles.
				// Employing this on a destructible corpse results in that corpse
				//   respawning on nightmare as a corpse (or worse, as a burning hollering demon)
				// If a monster's death state spawns a destructible corpse,
				//   the respawning/raising is relegated to that corpse
				//   and the monster MUST use Stop instead	
			Stop
			
		XDeath.Electric:
		Death.SuperPlasma:
		Death.Plasma: 
		Death.Plasma2:
			TNT1 A 0 A_Stop
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			
			TNT1 A 0 A_CustomMissile ("XDeathBurnedDemonArm", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedDemonLeg", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("BluePlasmaFireNonStatic", 42, 0, random (0, 360), 2, random (0, 180))
			TNT1 AAA 0 A_CustomMissile ("Blood", 32, 0, random (0, 360), 2, random (0, 180))
			TNT1 AAA 0 A_CustomMissile ("BloodMistSmall", 32, 0, random (0, 360), 2, random (0, 180))
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (0, 360), 2, random (0, 180))
			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))
			SPRG ABCDEF 6
			CARB J -1
			Stop
			
		Death.Fire:
		Death.Flames:
			TNT1 A 0
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("BurningDemon",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop

		Death.Shrapnel:
			TNT1 A 0
			TNT1 A 0 ThrustThingZ(0, 30, 0, 0)
			TNT1 A 0 A_Jump(128, "Death.Strong2")
			TNT1 A 0 A_SpawnItem("MuchBlood", 0, 32)
			Goto Death
			
		Death.Fatality:
			TNT1 A 0 A_Pain
			
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_JumpIfIntargetInventory("IsARevenant", 1, "Death.Kick")
			TNT1 A 0 A_JumpIfIntargetInventory("IsPlayer", 1, 1)
			Goto Death.Kick
			TNT1 A 0 A_FaceTarget
			//TNT1 AA 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 10, 5, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_JumpIfIntargetInventory("FistsSelected", 1, 1)
			Goto Death.ExplosiveImpact
			TNT1 A 0 A_GiveToTarget("GoFatality", 1)
			TNT1 A 0 A_Jump(256, "DemonFatality1", "DemonFatality2", "DemonFatality3")
			
		DemonFatality1:
			TNT1 A 0 A_GiveToTarget("DemonFatality", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, the bonus drop script runs ownerless
			Stop
		DemonFatality2:
			TNT1 A 0 A_GiveToTarget("DemonFatality2", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		DemonFatality3:
			TNT1 A 0 A_GiveToTarget("DemonFatality3", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
			
		Death.BHFT:
		Death.RVFT:
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_JumpIfIntargetInventory("IsARevenant", 1, "Death.Kick")
			TNT1 A 0 A_GiveToTarget("DemonFatality", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death.Desintegrate:
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_FaceTarget
			SAGB ABC 5 A_Stop
			TNT1 AAAAAA 0 A_CustomMissile ("BloodmistBig", 56, 0, random (0, 360), 2, random (30, 90))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			TNT1 AAA 0 A_CustomMissile ("XDeath2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			TNT1 AAA 0 A_CustomMissile ("XDeath3", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			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 AAAAA 0 A_CustomMissile ("Guts", 24, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_SpawnItem("SplatteredLarge")
			TNT1 A 0 A_CustomMissile ("BloodSplinter", 0, 0, random (0, 360), 2, random (0, 35))
			TNT1 A 0 A_CustomMissile ("SuperGoreSpawner2", 30, 0, random (0, 360), 2, random (10, 90))
			SAGB EFGHIJ 5
			SAGB J -1
			Stop
			
		XDeath:
		DEath.Explosive:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_FaceTarget
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 42, 0, random (0, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3", 42, 0, random (0, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 AAA 0 A_CustomMissile ("XDeath2", 42, 0, random (0, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("XDeath4", 42, 0, random (0, 190), CMF_AIMDIRECTION, random (10, 60))
			
			// BullXDeath is a pure gore spawner
			TNT1 A 0 A_CustomMissile ("BullXDeath", 0, 0, random (0, 360), 2, random (0, 160))
			
			TNT1 A -1 //***Che: Gibbed monsters -- ONLY the gibbed monsters -- may use this
				//   to auto-respawn on nightmare and be raised by viles.
				// Employing this on a destructible corpse results in that corpse
				//   respawning on nightmare as a corpse (or worse, as a burning hollering demon)
				// If a monster's death state spawns a destructible corpse,
				//   the respawning/raising is relegated to that corpse
				//   and the monster MUST use Stop instead	
			Stop
			
		Death.ExplosiveImpact:
			TNT1 A 0 A_ChangeFLag("NODROPOFF", 0)
			TNT1 A 0
			TNT1 A 0 ThrustThingZ(0,25,0,1)
			TNT1 A 0 A_FaceTarget
			TNT1 A 1
			TNT1 A 0 A_JumpIf(angle < 180, "IsFacingNorth")
			TNT1 A 0 A_JumpIf(velx < 0, "BlownAwayRight")
			TNT1 A 0 A_JumpIf(velx > 0, "BlownAwayLeft")
			Goto XDeath
		IsFacingNorth:
			TNT1 A 0 A_JumpIf(velx > 0, "BlownAwayRight")
			TNT1 A 0 A_JumpIf(velx < 0, "BlownAwayLeft")
			Goto XDeath
			
		BlownAwayLeft:	
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("XDeath1", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_ChangeFlag("NOBLOCKMONST", 1)
			TNT1 A 0 A_CustomMissile ("Brains2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			 TNT1 A 0 A_CustomMissile ("XDeathStomach", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			 TNT1 A 0 A_CustomMissile ("XDeathBullLeg12", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			 TNT1 A 0 A_CustomMissile ("XDeathDemonArm", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			 TNT1 AA 0 A_CustomMissile ("XDeath2b", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			 TNT1 AA 0 A_CustomMissile ("XDeath3b", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			 TNT1 A 0 A_CustomMissile ("XDeathPinkyDemonHead", 42, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("BloodMistLarge", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (20, 90))
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			TNT1 A 0 A_Xscream
			SRRD ABCD 5 A_CustomMissile ("FBD_FlyingBlood", 0, 0, 0, 2, 90)
			SRRD DDDDDDDDDD 3 A_CheckFloor("LandBlownAwayLeft")
			LandBlownAwayLeft:
			TNT1 A 0 A_Stop
			TNT1 A 0 A_SpawnItem("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx("DeadDemonSRRDE",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) //-1
			Stop
			
		BlownAwayRight:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("XDeath1", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_ChangeFlag("NOBLOCKMONST", 1)
			TNT1 A 0 A_CustomMissile ("Brains2", 50, 0, random (0, 360), 2, random (0, 160))
			 TNT1 A 0 A_CustomMissile ("XDeathStomach", 32, 0, random (0, 360), 2, random (0, 160))
			 TNT1 A 0 A_CustomMissile ("XDeathBullLeg12", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			 TNT1 A 0 A_CustomMissile ("XDeathDemonArm", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			 TNT1 AA 0 A_CustomMissile ("XDeath2b", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			 TNT1 AA 0 A_CustomMissile ("XDeath3b", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			 TNT1 A 0 A_CustomMissile ("XDeathPinkyDemonHead", 42, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("BloodMistLarge", 40, 0, random (0, 360), 2, random (20, 90))
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			TNT1 A 0 A_Xscream
			SRRD FGHI 5 A_CustomMissile ("FBD_FlyingBlood", 0, 0, 0, 2, 90)
			SRRD GGGGGGGGGG 3 A_CheckFloor("LandBlownAwayRight")
			LandBlownAwayRight:
			TNT1 A 0 A_Stop
			TNT1 A 0 A_SpawnItem("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx("DeadDemonSRRDJ",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) //-1
			Stop	
		
		
		Raise:
			TNT1 A 0 A_SpawnItemEx("StandaloneRezSfx",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			SARG N 5
			SARG MLKJI 5
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_CustomizeOnRez") // it runs OnRezMapScript
				// if the map prpvides one
			Goto See
			
		FallbackRaise: // we were put into this state by the superarchvile AOE raising, our height is hopelessly kaput and we have to spawn a substitute
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_ChangeFlag("COUNTKILL", 0)
			"----" A 0 A_ChangeFlag("SHOOTABLE", 0)
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2009) // see _mob_list.xlsx
			Stop
			
		FallbackRezSuccess:
			TNT1 A 0 A_SpawnItemEx("StandaloneRezSfx",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30
			Stop			
		
		Pain.ComeEatMeDemon:
		Pain.KillMe:
			TNT1 A 0
			TNT1 A 0 HealThing(1)
			Goto See
		Death.Avoid:
		Death.KillMe:
		Death.Taunt:
			SARG HHHH 8 A_Pain
			Goto Death
			//TNT1 A 0 A_ChangeFlag("SOLID", 0)
			//TNT1 A 0 A_SpawnItem("Demon")
			//Stop


		FatalityZombieman:
			SARK DEDEDEDEDE 10 A_CustomMissile ("MuchBlood2", 45, 0, random (0, 360), 2, random (0, 160))
		   
		EndFatalityZombieman:	
			TNT1 A 0 A_CustomMissile ("XDeathHalfZombieManDown", 20, 0, random(0, 360), 2, random (0, 160))
			TNT1 A 0 A_TakeInventory("ZombiemanFatality",1)
			Goto See
			
		FatalitySergeant:
			SARK FGFGFGFGFG 10 A_CustomMissile ("MuchBlood2", 45, 0, random (0, 360), 2, random (0, 160))
		  
		EndFatalitySergeant:
			TNT1 A 0 A_CustomMissile ("XDeathHalfZombieManDown", 20, 0, random(0, 360), 2, random (0, 160))
			TNT1 A 0 A_TakeInventory("SergeantFatality",1)
			Goto See
			
		FatalityComando:
			SARK JKJKJKJKJK 10 A_CustomMissile ("MuchBlood2", 45, 0, random (0, 360), 2, random (0, 160))
		EndFatalityComando:  
			TNT1 A 0 A_TakeInventory("ComandoFatality",1)
			Goto See
			
		FatalityImp:
			SARK HIHIHIHIHI 10 A_CustomMissile ("MuchBlood2", 45, 0, random (0, 360), 2, random (0, 160))
		   
		EndFatalityImp: 
			TNT1 A 0 A_TakeInventory("ImpFatality",1)
			Goto See


		Eat:
			TNT1 A 0 A_TakeInventory ("EatMe", 1)
			SARK A 20 A_Look
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look

			SARK A 10 A_Look
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look

			SARK A 10 A_Look
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look

			SARK A 10 A_Look
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 15, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look

			SARK A 10 A_Look
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look

			SARK A 10 A_Look
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look

			SARK A 10 A_Look
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look

			SARK A 10 A_Look
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look

			SARK A 10 A_Look
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look

			SARK A 10 A_Look
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look

			SARK A 10 A_Look
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 15, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look

			SARK A 10 A_Look
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look
			Goto Spawn
			
		EatFast:
			TNT1 A 0 A_TakeInventory ("EatMe", 1)
			SARK A 20 A_Look
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look

			SARK A 10 A_Look
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look

			SARK A 10 A_Look
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look

			SARK A 10 A_Look
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look

			SARK A 10 A_Look
			TNT1 AAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail", 35, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SARK B 10 A_Look

			Goto MeleeDown
			
			
		Death.Ice:
		Death.Freeze:
		Death.Frost:
			//TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			//TNT1 A 0 A_ChangeFlag("SOLID", 0)
			TNT1 A 0
			TNT1 A 0 A_NoBlocking // freeze deaths are permanent
			TNT1 A 0 A_SpawnItemEx("FrozenDemon",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop	
			
		Death.IOS_Frost:
			TNT1 A 0
			TNT1 A 0 A_NoBlocking 
			TNT1 A 0 A_SpawnItemEx("PermafrostDemon",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop				
			
		
		Death.Massacre:
			Goto Death

	}
}


ACTOR DemonRaisedByVile: FBD_BullDemon {
	States {
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster")
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			//SARG N 5 // for reference
			//SARG MLKJI 5
			SAGB J 3 // jump power script can only decect EDAY on the second tic
			TNT1 A 0 A_SetUserVar("user_jump_power", CallAcs("AdjustJumpPowerForEDAYMarsChapter", 25))
			SAGB IHGFEDCBA 3
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_CustomizeOnRez") // it runs OnRezMapScript
				// if the map prpvides one
			Goto See		
	}
}

Actor BullDemon_PP: FBD_BullDemon
{
	States
	{
		PotPourriSwap:
			TNT1 A 0
			Goto PotPourriCancel		
	}
}


ACTOR ArmlessDemon: FBD_BullDemon
{
	Health 100
	+LOOKALLAROUND
	+NOPAIN
	-COUNTKILL
	+NEVERRESPAWN
	States
		{
		
		Pain.KillMe:
		Pain.Taunt:
			TNT1 A 0
			TNT1 A 0 HealThing(1)
			Goto Missile //See
			
		//Idle:	//***Che The Sigh. Another one...
		Spawn:
			SG1A A 1 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster")
		Idle:	
			SG1A A 2 A_Look 
			TNT1 A 0 A_GiveInventory("DemonBleedingOut", 2)
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 42, 0, random (0, 360), 2, random (0, 45))
			Loop
		See:
			
			//***Che: him possibly falling off cliffs via A_Recoil is fine, he is dying and not in his right mind
			
			SG1A AA 2 A_Chase
			TNT1 A 0 A_Recoil(-2)
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 42, 0, random (0, 360), 2, random (0, 45))
			SG1A BB 2 A_Chase
			TNT1 A 0 A_Recoil(-2)
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 42, 0, random (0, 360), 2, random (0, 45))
			SG1A CC 2 A_Chase
			TNT1 A 0 A_Recoil(-2)
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 42, 0, random (0, 360), 2, random (0, 45))
			SG1A DD 2 A_Chase
			TNT1 A 0 A_Recoil(-2)
			TNT1 A 0 A_GiveInventory("DemonBleedingOut", 1)
			TNT1 A 0 A_JumpIfInventory("DemonBleedingOut", 15, "Death")
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 42, 0, random (0, 360), 2, random (0, 45))
			Loop
		Melee:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("DemonBleedingOut", 1)
			TNT1 A 0 A_JumpIfInventory("DemonBleedingOut", 15, "Death")
			TNT1 A 0 A_TakeInventory("EnemyMemory", 100)
			SG1A E 3 A_FaceTarget
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 42, 0, random (0, 360), 2, random (0, 45))
			SG1A E 3 A_FaceTarget
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 42, 0, random (0, 360), 2, random (0, 45))
			TNT1 A 0 A_GiveInventory("DemonBleedingOut", 1)
			SG1A F 3 A_FaceTarget
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 42, 0, random (0, 360), 2, random (0, 45))
			SG1A F 3 A_FaceTarget
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 42, 0, random (0, 360), 2, random (0, 45))
			TNT1 A 0 A_GiveInventory("DemonBleedingOut", 1)
			SG1A G 3 A_CustomMissile("DemonAttack",5,0,0,0)
			TNT1 A 0 A_CustomMissile("DemonAttack",40,0,0,0)
			SG1A GGG 3
			Goto See	
			
		Missile:
			TNT1 A 0
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_Recoil(-5)
			Goto See
		
		Death.Shotgun:
		Death.SniperBullet:
		Death.Bullet792:		
		Death.Minigun:
			TNT1 A 0
			TNT1 A 0 A_FaceTarget
			
			TNT1 A 0 A_CustomMissile ("PinkyHeadExplode", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SAAR GGGGGGG 2 A_CustomMissile ("Brutal_LiquidBlood", 40, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Scream 
			SAAR HHHHHHHHH 2 A_CustomMissile ("Brutal_LiquidBlood", 30, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			SAAR IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, random (0, 360), 2, random (30, 110))
			SAAR I 0 A_SpawnItemEx("DeadDemonSAARI",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Death:
		Death.Kick:
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			SAAR BCDEF 5
			TNT1 A 0 A_SpawnItemEx ("DeadDemonNoArm",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}
		

ACTOR DemonAttack: ZandronumBaronBall //BaronBall
{
	Radius 12
	Height 48
	DamageType Eat
	Projectile 
    Speed 16
	FastSpeed 16
	+RANDOMIZE
    Damage (random(4,4))
    
	+RIPPER 
	//***Che ripper projectiles rip *exactly* 8 times per tic, so in this case there are 8 damage points spaced at 2 map unit intervals.
	// damage can vary from as low as 4 from a glancing blow to as high as 8 x 4 = 32 at full contact
	
	+FORCEXYBILLBOARD
	+THRUGHOST
	RenderStyle Add
	Alpha 0.6
	SeeSound "none"
	DeathSound "none"
	Decal "none"
	+NODAMAGETHRUST
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 1
			Stop
		
		// sadly, ripper projectiles only die if colliding with a boss (+DONTRIP) or a wall
		Death:
			TNT1 A 0 BRIGHT
			TNT1 A 0 A_PlaySOund ("misc/xdeath1")
			TNT1 A 10
			Stop
	}
}



Actor DeadDemon1: FBD_CurbstompedMarine Replaces DeadDemon
{
    Radius 20 //18 //***Che to increase vile raising reliability
    Height 12
    Scale 1.1
    +SHOOTABLE
    +NOTELEPORT
    +MOVEWITHSECTOR
    +CORPSE
	+FLOORCLIP
	-SOLID
	-THRUACTORS
	+SHOOTABLE
	-GHOST
	-THRUGHOST
	Species "Marines"
	damagefactor "Crush", 50.0
    Mass 9000
    Health 300
    damagefactor "Blood", 0.0
    damagefactor "Trample", 0.0
	States
    {
		Raise:
			// note: the frame letter of the "----" (keep previous) sprite is ignored
			"----" A 0
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_NoBlocking // the raising code deep in C++ makes it solid
			"----" A 0 A_JumpIf(!CallAcs("EnoughSpaceToRezNormally", 2009), "FallbackRaise")
			// The vile had already copied his friendliness and target to this corpse.
			// A_SpawnItem(Ex) automatically copy friendliness
			//   and target, but only if both the spawner and the spawnee are monsters.
			"----" A 0 A_ChangeFlag("COUNTKILL", 0)
			"----" A 0 A_ChangeFlag("ISMONSTER", 1)
			"----" A 0 A_SpawnItemEx ("DemonRaisedByVile",0,0,0, 0,0,0, 0,SXF_TRANSFERPOINTERS | SXF_NOCHECKPOSITION)
			"----" A 1 A_Jump(256, "OnRezSfx")
			Wait //Zandronum client repeats the last frame while it waits for a status update from the server
			
		FallbackRaise:
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_ChangeFlag("SHOOTABLE", 0)
			//"----" A -1 ACS_NamedExecuteAlways("FallbackRez", 0, 8, 0, 0) //"DemonRaisedByVile"
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2009) // see _mob_list.xlsx
			Stop

		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			SARG N 5 
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Stay") // not until the actor stops sliding		
		Land:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			SARG N 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			SARG N -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
		LandOnLava:
			TNT1 A 0
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			SARG N 90 // delay
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			TNT1 A 0 A_SpawnItemEx("BurnedDemonDeadChe",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		Death:
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_NoBlocking
			
			TNT1 A 0 A_SpawnItem("MeatDeathSmall")
			TNT1 AAA 0 A_CustomMissile ("SmallBrainPiece", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath3", random (25, 35), random (5, -5), random (160, 200), 2, random (-10, 10))
			TNT1 AA 0 A_CustomMissile ("XDeath2", random (25, 35), random (5, -5), random (160, 200), 2, random (-10, 10))
			TNT1 A 0 A_CustomMissile ("MuchBlood", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("pinkyheadPiece", 22, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("BloodMistBig", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 90))
			TNT1 A 0 A_SpawnItemEx("DeadDemonNoHead",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			 Stop
			 
		Death.Plasma: 
		Death.Plasma2:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			EXPL AAA 0 A_CustomMissile ("ExplosionSmoke", 32, 0, random (0, 360), 2, random (0, 360))
			//***Che detaching smoke emittinf from burned corpses
			// because archvile would otherwise only rez the corpse after it stopped smoking
			TNT1 A 0 A_SpawnItemEx("FBD_CorpseSmoke",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0,0)
			//CARB JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ 10 A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), 2, random (0, 160))
			CARB J -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}


Actor DeadDemonHalf: DeadDemon1
{	Health 300 
	States{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			SARG T 5 
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Stay") // not until the actor stops sliding		
		Land:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			SARG T 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			SARG T -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		LandOnLava:
			TNT1 A 0
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			SARG T 90 // delay
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			TNT1 A 0 A_SpawnItemEx("BurnedDemonDeadChe",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		Death:
			TNT1 A 0 A_NoBlocking
			TNT1 AA 0 A_CustomMissile ("XDeathBullLeg12", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			TNT1 AA 0 A_CustomMissile ("XDeathDemonArm", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			TNT1 AA 0 A_SpawnItem("MeatDeathSmall", 0, 20)
			
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}
		
Actor DeadDemonHalf23: DeadDemon1
{
	Health 300 
	Height 16
	States{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			SARC D 5 
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Stay") // not until the actor stops sliding		
		Land:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			SARC D 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			SARC D -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		LandOnLava:
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			SARC DDDDDDDDD 10 A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem("GoryAshes")
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)			
			Stop
			
		Death:
			TNT1 A 0 A_NoBlocking
			TNT1 AA 0 A_CustomMissile ("XDeathBullLeg12", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			TNT1 AA 0 A_SpawnItem("MeatDeathSmall", 0, 20)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}	

Actor DeadDemonNoArm: DeadDemon1
{
	Health 300 
	States{
		Spawn:
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			SAAR F 5 
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Stay") // not until the actor stops sliding		
		Land:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			SAAR F 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			SAAR F -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		LandOnLava:
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			SAAR FFFFFFFFF 10 A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem("GoryAshes")
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)			
			Stop				
		Death:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("XDeathDemonArm", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			TNT1 AA 0 A_SpawnItem("MeatDeathSmall", 0, 20)
			
			TNT1 A 0 A_SpawnItem("MeatDeathSmall")
			TNT1 AAA 0 A_CustomMissile ("SmallBrainPiece", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath3", random (25, 35), random (5, -5), random (160, 200), 2, random (-10, 10))
			TNT1 AA 0 A_CustomMissile ("XDeath2", random (25, 35), random (5, -5), random (160, 200), 2, random (-10, 10))
			TNT1 A 0 A_CustomMissile ("MuchBlood", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("pinkyheadPiece", 22, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("BloodMistBig", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 90))
			TNT1 A 0 A_SpawnItemEx("DeadDemonSAARK",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}
	  
	  
Actor DeadDemonSAARK: DeadDemon1
{
	Health 300 
	States{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			SAAR K 5 
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Stay") // not until the actor stops sliding		
		Land:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			SAAR K 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			SAAR K -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		LandOnLava:
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			SAAR KKKKKKKK 10 A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem("GoryAshes")	
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop			
			
		Death:
			TNT1 A 0 A_NoBlocking
			TNT1 AA 0 A_CustomMissile ("XDeathBullLeg12", 35, 0, random (0, 360), 2, random (10, 40))
			TNT1 AA 0 A_SpawnItem("MeatDeathSmall", 0, 20)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
    }
}	  

Actor DeadDemonNoHead: DeadDemon1
{
	Health 300 
	States{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			SARH D 5 
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Stay") // not until the actor stops sliding		
		Land:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			SARH D 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			SARH D -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		LandOnLava:
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			SARH DDDDDDDD 10 A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem("GoryAshes")
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)			
			Stop
			
		Death:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("XDeathStomach", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathDemonArm", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			TNT1 A 0 A_CustomMissile ("PinkyJaw", 22, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_SpawnItem("MeatDeathSmall", 0, 20)
			TNT1 A 0 A_SpawnItemEx("DeadDemonHalf23",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}

//***Che
Actor BurnedDemonDeadChe: BurnedDemon
{
	States {
		Spawn:
			CARB Q  2
			TNT1 A 0 A_NoBlocking
			CARB JJJJ 2 A_CustomMissile ("FlameTrails", 45, 0, random (0, 360), 2, random (50, 130))
			CARB JJJJ 2 A_CustomMissile ("FlameTrails", 30, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 0 A_Playsound("props/redfire")
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			CARB JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ 2 A_CustomMissile ("FlameTrails", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))
			CARB JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ 20 A_CustomMissile ("SmallSmoke", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (70, 110))
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)			
			CARB J -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}
		
		
Actor DeadDemon1Left: DeadDemon1
{
	States
	{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			S2RG N 5 
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Stay") // not until the actor stops sliding		
		Land:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			S2RG N 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			S2RG N -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
		LandOnLava:
			TNT1 A 0
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			S2RG N 90 // delay
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			TNT1 A 0 A_SpawnItemEx("BurnedDemonDeadChe",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop			
	}
}

Actor DeadDemonStomped: DeadDemonNoARm
{
	States
	{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			FD2M K 5 
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Stay") // not until the actor stops sliding		
		Land:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			FD2M K 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			FD2M K -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
		LandOnLava:
			TNT1 A 0
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			FD2M K 90 // delay
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			TNT1 A 0 A_SpawnItemEx("BurnedDemonDeadChe",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop			
	}
}	




Actor DeadDemonSRRDJ: DeadDemon1
{
	States
	{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			SRRD J 5 
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Stay") // not until the actor stops sliding		
		Land:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			SRRD J 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			SRRD J -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		LandOnLava:
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			SRRD JJJJJJJJJJ 10 A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem("GoryAshes")
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		Death:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("XDeathStomach", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathDemonArm", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			TNT1 A 0 A_CustomMissile ("XDeathBullLeg12", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			TNT1 AA 0 A_SpawnItem("MeatDeathSmall", 0, 20)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}	

Actor DeadDemonSRRDE: DeadDemon1
{
	States
	{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			SRRD E 5 
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Stay") // not until the actor stops sliding		
		Land:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			SRRD E 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			SRRD E -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		LandOnLava:
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			SRRD EEEEEEEEE 10 A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem("GoryAshes")
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop

		Death:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("XDeathStomach", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathDemonArm", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			TNT1 A 0 A_CustomMissile ("XDeathBullLeg12", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			TNT1 AA 0 A_SpawnItem("MeatDeathSmall", 0, 20)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}	



Actor DeadDemonSAARI: DeadDemon1
{
	States
	{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			SAAR I 5 
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Stay") // not until the actor stops sliding		
		Land:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			SAAR I 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			SAAR I -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		LandOnLava:
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			SAAR IIIIII 10 A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem("GoryAshes")
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)			
			Stop
			
		Death:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("XDeathStomach", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathDemonArm", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			TNT1 A 0 A_CustomMissile ("PinkyJaw", 22, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_SpawnItem("MeatDeathSmall", 0, 20)
			TNT1 A 0 A_SpawnItemEx("DeadDemonHalf23",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}

#include Stoneskin_pinky.txt
	
