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





ACTOR MancubusPotpourriChecker: AbstractPotpourriChecker
{
	Radius 24
	Height 60
}

Actor MancubusBossCubeSpawner: AbstractBossCubeSpawner
{
	Radius 24
	Height 60	
	States
	{
		DoSummon:	
			TNT1 A 0 A_GiveInventory("SummonsCount", 1, AAPTR_TRACER)
			TNT1 A 0 A_SpawnItemEx("ThiccTeleportFog")
			TNT1 A 1 A_SpawnItemEx("FBD_Mancubus",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0,user_stid)
			Stop
	}
}

ACTOR FBD_Mancubus : ZandronumFatso 17858 

{
	//$category "FBD Monsters"
	
	//***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 Mancubus: FBD_Mancubus Replaces Fatso {} in Doom_Replacements.txt
	
	var int user_head_tid;
	var int user_head_type;
	var int user_head_rel;
	var int user_head_scale;
	var int user_head_xyzf; /* 
		a packed value: 
		bits 0..7 =x+128, clamped to -128..127
		bits 8..15 =y+128, clamped to -128..127
		bits 16..23 =z, clamped to 1..255
		bit 29 is a command to assume an unique TID, used in monster-on-monster headshotting
		A zero value is a command to terminate
	*/		
	var int user_sleeping;
	var int user_item_no;
	var int user_serverside_sfchk; // on client, always 0. 
	// on server, -1 means command for DECORATE to perform a_radiusGive,
	// 1 decorate replies it had performed RadiusGive

	PainChance "HeadStun", 255
	PainChance "HeadPlasma", 32
	PainChance "Decaptate", 96
	var int user_bleeding_angle;
	
	
	Scale 1.1
	MaxStepHeight 16
	MaxDropOffHeight 24
    damagefactor "Crush", 10.0
	damagefactor "Avoid", 0.0
	PainChance "Kick", 255
	PainChance "ExtremePunches", 255 PainChance "HangingHook", 0
	PainChance "Taunt", 255
	PainChance "Explosive", 255
	damagefactor "TeleportRemover", 0.0
	damagefactor "GibRemoving", 0.0
	DamageFactor "CauseSplash", 0.0 DamageFactor "CauseObjectsToSplashSlime", 0.0 DamageFactor "CauseObjectsToSplashNukage", 0.0
	DamageFactor "CauseObjectsToSplashBlood", 0.0 DamageFactor "CauseObjectsToSplashLava", 0.0
	DamageFactor "Shotgun", 0.8
	PainChance "SSG", 255
	PainChance "Railgun", 255
	DamageFactor "SSG", 0.1
	Radius 24
	Height 60
    GibHealth 30
    Health 600
	Mass 500
	Speed 8
	FAstSpeed 12
    BloodType "FBD_Blood", "FBD_SawBlood", "FBD_SawBlood"
	DropItem "DemonStrengthRune" 5
	Obituary "%o was incinerated by a Mancubus."
	damagefactor "Blood", 0.0 damagefactor "BlueBlood", 0.0 damagefactor "GreenBlood", 0.0
    +DONTHURTSPECIES
	+THRUGHOST
	-FASTER
	DeathHeight 6
	BurnHeight 0
	
	PainChance "Argent", 255
	DamageFactor "Argent", 1.0
	
	PainChance "Bullet792", 160 // machineguns and snip[er rifles not aimed
	PainChance "SniperBullet", 160 // sniper rifle aimed
	
	damagefactor "Killme", 1.0 // AOE inflicted by captured marines
	PainChance "Killme", 255	

	Tag "$FBD_MANCUBUS" // "Mancubus";
	
	PainChance "Ice", 64

	States
	{
		  
		Pain.Ice:
			"----" A 20 A_Pain
			Goto See
		  
		//***Che
		WaitTargetsFatalityOut:
			TNT1 A 0 A_PlaySound("fatso/sight", CHAN_VOICE)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 11, 0, 55)
			FATT B Random(8,20)
			TNT1 A 0 A_SetAngle(angle - 40)
			FATT B Random(8,20)
			TNT1 A 0 A_SetAngle(angle + 40)
			FATT B Random(8,20)
			Goto See
		
		
		Death.FriendlyExplosion:
			TNT1 A 0
			goto Death.ExplosiveImpact

/*
		//***Che: deprecated. See TNT1 A 0 A_JumpIfInventory("IAmClassicMonster"
		ReplaceVanilla:
			TNT1 A 0 A_GiveInventory ("RifleAmmo", 1)
*/
		Idle:
		LookingForPlayer:
			TNT1 A 0
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 11, 0, 55) // creates the said head if there is none,
				// subject to load balancing ( no more than ~100 new heads could be created per tic)
			TNT1 A 0 A_SetUserVar("user_sleeping", 1)	
		
		LookingForPlayerLoop:
			TNT1 A 0 A_GiveInventory("SKImp", 1)
			
			//TNT1 A 0 A_SpawnItem ("HeadshotTarget10", 26, 60,0)
			FATT BBB  10 A_Look
			TNT1 A 0 A_SetAngle(angle - 40)
			//TNT1 A 0 A_SpawnItem ("HeadshotTarget10", 26, 60,0)
			FATT BBB 10 A_Look
			TNT1 A 0 A_SetAngle(angle + 40)
			//TNT1 A 0 A_SpawnItem ("HeadshotTarget10", 26, 60,0)
			FATT BBB 10 A_Look
			
			FATT A 0 A_Wander
			FATT AA 2 A_Look
			//TNT1 A 0 A_Recoil(-1)
			//TNT1 A 0 A_SpawnItem("HeadshotTarget6", 26, 60,0)
			
			FATT B 0 A_Wander
			FATT BB 2 A_Look
			//TNT1 A 0 A_Recoil(-1)
			//TNT1 A 0 A_SpawnItem("HeadshotTarget6", 26, 60,0)
			
			FATT C 0 A_Wander
			FATT CC 2 A_Look
			//TNT1 A 0 A_Recoil(-1)
			//TNT1 A 0 A_SpawnItem("HeadshotTarget6", 26, 60,0)
			
			FATT D 0 A_Wander
			FATT DD 2 A_Look
			//TNT1 A 0 A_Recoil(-1)
			//TNT1 A 0 A_SpawnItem("HeadshotTarget6", 26, 60,0)
			
			
			TNT1 A 0 A_jump(128, "LookingForPlayer")
			
			
			FATT A 0 A_Wander
			FATT AA 2 A_Look
			//TNT1 A 0 A_Recoil(-1)
			//TNT1 A 0 A_SpawnItem("HeadshotTarget6", 26, 60,0)
			
			FATT B 0 A_Wander
			FATT BB 2 A_Look
			//TNT1 A 0 A_Recoil(-1)
			//TNT1 A 0 A_SpawnItem("HeadshotTarget6", 26, 60,0)
			
			FATT C 0 A_Wander
			FATT CC 2 A_Look
			//TNT1 A 0 A_Recoil(-1)
			//TNT1 A 0 A_SpawnItem("HeadshotTarget6", 26, 60,0)
			
			FATT D 0 A_Wander
			FATT DD 2 A_Look
			//TNT1 A 0 A_Recoil(-1)
			//TNT1 A 0 A_SpawnItem("HeadshotTarget6", 26, 60,0)
			//Goto LookingForPlayer2
			Loop
			
			
			
		ForgetTarget:
			TNT1 A 0 A_ClearTarget
			TNT1 A 0 A_TakeInventory("EnemyMemory", 25)
			TNT1 A 0 A_GiveInventory("LookingForPlayer", 1)
			Goto LookingForPlayer
	
		PotPourriSwap:
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
		PotPourriWait:			
			KYPP G 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", 33), "PotPourriNoSwap")
			
			TNT1 A 0 A_ChangeFlag("SOLID", 0)
			TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
			TNT1 A 0 A_SpawnItemEx ("MancubusPotpourriSwapper",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:
		
			// The slaughter-aware blood checks the parent monster and goes low-res automatically
					
			FATT B 0 NODELAY A_JumpIf(CallAcs("GetPotPourri"), "PotPourriSwap")
		PotPourriCancel:	
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunMonster", 5) // default headbox (tiny! hard to headsot!)
			TNT1 A 0 A_GiveInventory("TargetIsAMancubus")
			// checking for vanilla is intergrated into the slaughtermap init script now
			// checking for classic monsters is intergrated into the slaughtermap init script now

			FATT B 7 // Slaughtermap init takes 5 tics + 1 + one more to be sure
			Goto Stand 
			
		Raise:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII") // should not have a headbox by now -- but what if?
			TNT1 A 0 A_SpawnItemEx("StandaloneRezSfx",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			FATT R 5
			FATT QPONMLK 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", 2021) // 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			
			
		Stand:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(user_serverside_sfchk >= 4, 2) // extreme slaughtermap optimization
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 11, 0, 55)
			FATT BB 10 A_Look
			Loop
			
		See:
			FATT A 0
			//TNT1 A 0 A_CheckSight(2)
			//TNT1 A 0 A_JumpIf(!user_sleeping, 3) // forgo the expensive sight check if already awake
			//TNT1 A 0 A_SetUserVar("user_sleeping", 0)
			//TNT1 A 0 A_JumpIfInventory("IAmClassicMonster", 1, "ChaseLoopVanilla")
		
			TNT1 A 0 A_TakeInventory("EnemyMemory", 5)
			Goto ChaseLoop
		ChaseLoop:
			TNT1 A 0
			
			// slaughtermap manage
			TNT1 A 0 A_JumpIf(!user_sleeping, 3) // forgo the expensive sight check if already awake
			TNT1 A 0 A_CheckSight(2)
			TNT1 A 0 A_SetUserVar("user_sleeping", 0)
			TNT1 A 0 A_JumpIf(user_serverside_sfchk != -1, 3) // -1 means ACS commands us to do the radiusgive
			// A_RadiusGive is:
			//  1. serverside-only: the call is skipped on the client; only if a player is involved, a network command to update his item count is sent, otherwise the item count only increases on the server
			//  2. iterates over all actors in an infinitely tall square column checking their flags and coordinates
			//  3. performs expensive precision radius calculation (using a square root) unless RGF_CUBE is given (which results in cheaper delta per-coordinate comparison)
			//  4. performs expensive sight check, for each thing that passes flag and radius checks, unless RGF_NOSIGHT is given
			TNT1 A 0 A_RadiusGive("SfestCounterServerside", 500, RGF_MONSTERS | RGF_CUBE | RGF_NOSIGHT, 1)			
			TNT1 A 0 A_SetUserVar("user_serverside_sfchk", 1) // reply that we did the deed
		
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 11, 0, 55) // doesn't move his head around during walking

			//TNT1 A 0 A_SpawnItem("HeadshotTarget8", 24, 60, 0)
			////TNT1 A 0 A_SpawnItemEx("HeavyFootSteps", 0, -10)
			TNT1 A 0 A_JumpIfInventory("EnemyMemory", 10, "ForgetTarget")
			
			FATT AABBCCDDEEFF 4 A_Chase
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "ForgetTarget")
			TNT1 A 0 A_CheckSight("ChaseForgetful")
			Loop
		ChaseForgetful:	
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("EnemyMemory", 1)
			Goto ChaseLoop
/*			
		ChaseLoopVanilla:
			TNT1 A 0
			// slaughtermap manage
			TNT1 A 0 A_JumpIf(!user_sleeping, 3) // forgo the expensive sight check if already awake
			TNT1 A 0 A_CheckSight(2)
			TNT1 A 0 A_SetUserVar("user_sleeping", 0)
			TNT1 A 0 A_JumpIf(user_serverside_sfchk != -1, 3) // -1 means ACS commands us to do the radiusgive
			// A_RadiusGive is:
			//  1. serverside-only: the call is skipped on the client; only if a player is involved, a network command to update his item count is sent, otherwise the item count only increases on the server
			//  2. iterates over all actors in an infinitely tall square column checking their flags and coordinates
			//  3. performs expensive precision radius calculation (using a square root) unless RGF_CUBE is given (which results in cheaper delta per-coordinate comparison)
			//  4. performs expensive sight check, for each thing that passes flag and radius checks, unless RGF_NOSIGHT is given
			TNT1 A 0 A_RadiusGive("SfestCounterServerside", 500, RGF_MONSTERS | RGF_CUBE | RGF_NOSIGHT, 1)			
			TNT1 A 0 A_SetUserVar("user_serverside_sfchk", 1) // reply that we did the deed

			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 11, 0, 55)
			FATT AABBCCDDEEFF 4 A_Chase //never idle
			Loop
*/		
	//***Che:
		Death.Psionic:
		
		Death.minorhead:
		Death.head:
			TNT1 A 0
			//TNT1 A 0 A_JumpIfInTargetInventory("HasPlasmaWeapon", 1, "Death.Plasma")
		Death.HeadStun:
		Death.decaptate:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_SpawnItem("MancubusHeadExplode", 0, 50)
			FATT KKK 2 A_CustomMissile ("Brutal_LiquidBlood2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 50))
			FATT LLL 2 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 50)) 
			TNT1 A 0 A_Scream
			TNT1 A 0 A_BossDeath
			FATT MMM 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (20, 50))
			TNT1 A 0 A_NoBlocking
			FATT NNOOPPQQRRSS 2 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (20, 50))
			FATT TTTTTTTTTTTTTTTTTTTTTTT 2 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (20, 50))
			
			TNT1 A 0 A_SpawnItemEx ("DeadFatNoHead",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop
/*
	Alas, there is no headless death animation. This was resulting in head flying off... 
	And the corpse falling with half the head still attached :(
	Sad day for ChebMaster :(
		Death.decaptate:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 AAAAAA 0 A_CustomMissile ("Xdeath1", 62, 0, random (50, 130), 2, random (50, 130))
			TNT1 A 0 A_CustomMissile ("XdeathMancubusHead", 62, 0, random (50, 130), 2, random (50, 130))
			FATT O 6 A_Scream
			FATT P 6 A_NoBlocking
			FATT QRS 6
			FATT T 1 A_BossDeath
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			
			TNT1 A 0 A_SpawnItemEx("DeadFatNoHead",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop	
*/


		Death:
			FAT3 A 1 A_Jump(64, "Death2")
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			FAT3 B 6 A_Scream
			FAT3 C 6 A_NoBlocking
			FAT3 DEF 6
			FAT3  F 1 A_BossDeath
			
			TNT1 A 0 A_SpawnItemEx("DeadFAT3F",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop
		
		Death2:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			FATK A 6
			FATK B 6 A_Scream
			FATK C 6 A_NoBlocking
			FATK DEF 6
			FATK F 1 A_BossDeath    
			TNT1 A 0 A_SpawnItemEx("DeadFat",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop

		Melee:
		Missile:
			TNT1 A 0
			
			// Kinslayer check:	
			TNT1 A 0 A_JumpIf(!CheckClass("Mancubus", AAPTR_TARGET, true), 2)
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_InfightFriendlyFireOn")
			
			
			TNT1 A 0 A_JumpIfInTargetInventory("IsLTGPlayer", 1, "LTGCheck")
		MissileContinueAfterLTGCheck:				
			
			TNT1 A 0 A_JumpIf(waterlevel > 1, 2) // skip flamethrowers underwater (their flames expire instantly anyway)
			TNT1 A 0 A_JumpIfCloser(180, "Flamethrowers") //"Melee")
			
			// slaughtermap manage - warming the headbox up
			TNT1 A 0 A_JumpIf(!user_sleeping, 4) // forgo the expensive sight check if already awake
			TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, 2) // bypass the sight check 
			TNT1 A 0 A_CheckSight(2) // out of sight of any player, AND attacking another monster, keep slumbering
			TNT1 A 0 A_SetUserVar("user_sleeping", 0)
			
		Fireballz:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 0, 51)
			TNT1 A 0 A_JumpIfInventory("IAmSfestMonster", 1, "FireballzSlaughterFest")
		
			FATT G 0 A_FaceTarget
			////TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 56, 0)
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget
			
			FATT G 4 //A_FaceTarget
			TNT1 A 0 A_JumpIfInventory("Enraged", 1, 1)
			FATT G 6 A_FatRaise
			////TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 56, 0)
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget
			
			FATT G 10 //A_FaceTarget
			////TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 56, 0)
			
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
			TNT1 A 0 A_JumpIfTargetInLOS(4)
			// the version with auto-aim disabled:
			TNT1 A 0 A_CustomMissile("BigFireBall",30,-25,10 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("BigFireBall",30,25,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_Jump(256, 3)
			// the auto-aimed version:
			TNT1 A 0 A_CustomMissile("BigFireBall",30,-25,10,0)
			TNT1 A 0 A_CustomMissile("BigFireBall",30,25,0,0)
			
			FATT H 10 BRIGHT
			//TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 56, 0)
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget
			
			FATT IG 5 //A_FaceTarget
			//TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 56, 0)
			
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
			TNT1 A 0 A_JumpIfTargetInLOS(4)
			// the version with auto-aim disabled:
			TNT1 A 0 A_CustomMissile("BigFireBall",30,-25,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("BigFireBall",30,25,-10 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_Jump(256, 3)
			// the auto-aimed version:
			TNT1 A 0 A_CustomMissile("BigFireBall",30,-25,0,0)
			TNT1 A 0 A_CustomMissile("BigFireBall",30,25,-10,0)	
			
			FATT H 10 BRIGHT
			//TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 56, 0)
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget
			
			FATT IG 5 //A_FaceTarget
			//TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 56, 0)
			
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
			TNT1 A 0 A_JumpIfTargetInLOS(4)
			// the version with auto-aim disabled:		
			TNT1 A 0 A_CustomMissile("BigFireBall",30,-25,4 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("BigFireBall",30,25,-4 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_Jump(256, 3)
			// the auto-aimed version:
			TNT1 A 0 A_CustomMissile("BigFireBall",30,-25,4,0)
			TNT1 A 0 A_CustomMissile("BigFireBall",30,25,-4,0)		
			
			FATT H 10 BRIGHT
			//TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 56, 0)
			FATT IG 5
			Goto See
		FireballzSlaughterFest:	
			TNT1 A 0
			FATT G 4 A_FaceTarget
			TNT1 A 0 A_JumpIfInventory("Enraged", 1, 1)
			FATT G 6 A_FatRaise
			FATT G 10			
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
			TNT1 A 0 A_JumpIfTargetInLOS(4)
			// the version with auto-aim disabled:
			TNT1 A 0 A_CustomMissile("BigFireBallSfest",30,-25,10 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("BigFireBallSfest",30,25,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_Jump(256, 3)
			// the auto-aimed version:
			TNT1 A 0 A_CustomMissile("BigFireBallSfest",30,-25,10,0)
			TNT1 A 0 A_CustomMissile("BigFireBallSfest",30,25,0,0)
			
			FATT H 10 BRIGHT
			////TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 56, 0)
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget
			
			FATT IG 5 //A_FaceTarget
			////TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 56, 0)
			
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
			TNT1 A 0 A_JumpIfTargetInLOS(4)
			// the version with auto-aim disabled:
			TNT1 A 0 A_CustomMissile("BigFireBallSfest",30,-25,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("BigFireBallSfest",30,25,-10 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_Jump(256, 3)
			// the auto-aimed version:
			TNT1 A 0 A_CustomMissile("BigFireBallSfest",30,-25,0,0)
			TNT1 A 0 A_CustomMissile("BigFireBallSfest",30,25,-10,0)	
			
			FATT H 10 BRIGHT
			////TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 56, 0)
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget
			
			FATT IG 5 //A_FaceTarget
			////TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 56, 0)
			
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
			TNT1 A 0 A_JumpIfTargetInLOS(4)
			// the version with auto-aim disabled:		
			TNT1 A 0 A_CustomMissile("BigFireBallSfest",30,-25,4 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("BigFireBallSfest",30,25,-4 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_Jump(256, 3)
			// the auto-aimed version:
			TNT1 A 0 A_CustomMissile("BigFireBallSfest",30,-25,4,0)
			TNT1 A 0 A_CustomMissile("BigFireBallSfest",30,25,-4,0)		
			
			FATT H 10 BRIGHT
			////TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 56, 0)
			FATT IG 5
			Goto See			
		Flamethrowers:
			TNT1 A 0
			
			// slaughtermap manage - warming the headbox up
			TNT1 A 0 A_JumpIf(!user_sleeping, 4) // forgo the expensive sight check if already awake
			TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, 2) // bypass the sight check 
			TNT1 A 0 A_CheckSight(2) // out of sight of any player, AND attacking another monster, keep slumbering
			TNT1 A 0 A_SetUserVar("user_sleeping", 0)
			
			TNT1 A 0 A_JumpIfInTargetInventory("GoFatality", 1, "WaitTargetsFatalityOut")
			
			TNT1 A 0 A_JumpIfInventory("IAmClassicMonster", 1, "Fireballz")
			////TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 56, 0)
			//TNT1 A 0 A_JumpIfInventory("RifleAmmo", 1, "Fireballz")
			
			//TNT1 A 0 A_JumpIfInventory("Enraged", 1, 1) // this doesn't do anything because jump 1 is just moving to the next command; 
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 0, 51)
			
				//***Che: adjust aim *early* if target is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_FaceTarget		
			
			TNT1 A 0 A_JumpIfInventory("Enraged", 1, 2)
			FATT G 10 A_FatRaise
			//TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 56, 0)
			
			FATT G 10 //A_FaceTarget
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget
			
			//TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 56, 0)
			TNT1 A 0 A_PlaySound("BREATHOF")
			
			//***Che
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "MeleeAtInvisible")
			TNT1 A 0 A_JumpIfTargetInLOS(2)
			TNT1 A 0 A_Jump(256, "MeleeAtInvisible")
			
			// the version with autoaim enabled *must* use autoaim to account for projectile origin horizontal offset
			// (without auto-aim both projectiles fly by with you safely in between)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15,0)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15,0)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15,0)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15,0)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15,0)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15,0)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15,0)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15,0)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15,0)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15,0)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15,0)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15,0)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15,0)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15,0)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15,0)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15,0)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15,0)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15,0)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15,0)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15,0)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15,0)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15,0)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15,0)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15,0)
			Goto See
			
		MeleeAtInvisible:
			// the version with autoaim disabled - fires in the direction the monster is facing, no correction to account for origin's horizontal shift.
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			FATT H 1 BRIGHT A_CustomMissile("FlamethrowerMissileFatso",30,-25,15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_CustomMissile("FlamethrowerMissileFatso",30,25,-15 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			
			
			Goto See	
		Pain:
			TNT1 A 0 //A_SpawnItem("HeadshotTarget10", 24, 60, 0)
			FATT J 3 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, 6, 50)
			FATT J 3 A_Pain
			Goto See
			
		Pain.Argent: // inflicted by ghost souls spammed by super archviles
			TNT1 A 0
			TNT1 A 0 HealThing(66)
			TNT1 A 0 ACS_NamedExecuteWithResult("DisplayArgentDischarge", 20, 55, 0)	
			
			FATT J 3 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, 6, 50)
			FATT J 3 A_Pain
			
			Goto Pain.Taunt // results in furious spraying in a random direction if target is out of sight
			
		Pain.Explosive:
		Pain.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, 0, 60) //meningless: the smoke from a rocket/bfg10k ball explosion obscures everything!
		Pain.SSG:
		Pain.ExtremePunches:
		Pain.Railgun:
		Pain.HeadPlasma:
			TNT1 A 0 //A_SpawnItem("HeadshotTarget10", 24, 60, 0)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 62)			
			TNT1 A 0 A_FaceTarget
			FAT4 A 4 ThrustThingZ(0,30,0,1)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 57)
			FAT4 B 4 A_Pain
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			FAT4 C 4 A_Stop
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 42)
			FAT4 DDDD 4
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 57)
			FAT4 C 4 A_Stop
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 62)
			FAT4 BA 4
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			Goto See
		Pain.Decaptate:
		Pain.HeadStun:	// powerful headshot inflicted more than 250 damage
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 62)			
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			
			FAT4 A 4 ThrustThingZ(0,30,0,1)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 57)
			FAT4 B 4 A_Pain
			FAT4 C 4 A_Stop
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 42)
			
			TNT1 A 0 A_SetUserVar("user_bleeding_angle", random(-110, 110))

			TNT1 A 0 A_Jump(128, 14)
			FAT4 DDDDDD 3 A_CustomMissile ("Brutal_LiquidBlood2", 45, 0, angle + user_bleeding_angle + random (-15, 15), CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (25, 45))
			TNT1 A 0 A_Pain
			FAT4 DDDDDD 3 A_CustomMissile ("Brutal_LiquidBlood2", 45, 0, angle + user_bleeding_angle + random (-15, 15), CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (35, 55))
			TNT1 A 0 A_Pain
			FAT4 DDDDDD 3 A_CustomMissile ("Brutal_LiquidBlood2", 45, 0, angle + user_bleeding_angle + random (-15, 15), CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (25, 45))
			TNT1 A 0 A_Pain
			FAT4 DDDDDD 3 A_CustomMissile ("Brutal_LiquidBlood2", 45, 0, angle + user_bleeding_angle + random (-15, 15), CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (35, 55))
			FAT4 DDDD 6 A_CustomMissile ("Brutal_LiquidBlood2", 45, 0, angle + user_bleeding_angle + random (-15, 15), CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (45, 55))
			FAT4 DDDD 8 A_CustomMissile ("Brutal_LiquidBlood2", 45, 0, angle + user_bleeding_angle + random (-15, 15), CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (25, 35))
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 57)
			FAT4 C 4 A_Stop
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 62)
			FAT4 BA 4
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			Goto Missile
		Pain.Kick:
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_Recoil(2)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, 6, 50)
			//TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 60, 0)
			FATT J 9 A_Pain  
			//TNT1 A 0 A_SpawnItem("HeadshotTarget10", 24, 60, 0)
			FATT J 8
			Goto See



		Death.Fatality:
			TNT1 A 0 A_Pain
			TNT1 A 0 A_JumpIfIntargetInventory("FistsSelected", 1, 1)
			Goto Death
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			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 AAA 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, 15, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_GiveToTarget("GoFatality", 1)
			TNT1 A 0 A_GiveToTarget("FatsoFatality", 1)
			TNT1 A 1 A_BossDeath
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, the bonus drop script runs ownerless
			Stop
		Death.Shotgun:
			TNT1 A 0 
			TNT1 A 0 A_JumpIfInTargetInventory("SSGSelected", 1, "Death.SSG")
			TNT1 A 0 A_Jump(96, "Death.Minigun")
			Goto Death
			
		Death.SSG:
			TNT1 A 0
			TNT1 A 0 A_Stop
			TNT1 A 0 A_Scream
			TNT1 A 0 A_noBlocking
			TNT1 A 0 A_BossDeath
			TNT1 A 0 A_Jump(256, "DeathSSG1", "DEathSSG2", "Death.Cut")
		DeathSSG1:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("MuchBlood", 55, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathMancubusArm", 30, 0, random (0, 360), 2, random (50, 130))
			XFT2 AAAAAAAAAAAA 2 A_CustomMissile ("Brutal_LiquidBlood2", 50, 0, random (0, 360), 2, random (30, 50))
			
			XFT2 BC 5
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx ("FUckedFatso1",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop
			
		DeathSSG2:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_SpawnItem("MancubusHeadExplode", 0, 50)
			TNT1 AA 0 A_CustomMissile ("XDeathMancubusArm", 30, 0, random (0, 360), 2, random (50, 130))
			TNT1 AAA 0 A_CustomMissile ("MuchBlood", 55, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), 2, random (0, 160))
			XFT3 AAAAAAAAAAAAAAAAAAAAAAAA 2 A_CustomMissile ("Brutal_LiquidBlood2", 50, 0, random (0, 360), 2, random (30, 50))
			XFT3 BC 5
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx ("FUckedFatso2",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop	
			
		Death.SniperBullet:
		Death.Bullet792:			
		Death.Arm:
		Death.Minigun:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_BossDeath
			TNT1 A 0 A_CustomMissile ("XDeathMancubusArm", 30, 0, random (0, 360), 2, random (50, 130))
			TNT1 AA 0 A_CustomMissile ("MuchBlood", 55, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), 2, random (0, 160))
			XFT1 AAAAAAAA 1 A_CustomMissile ("Brutal_LiquidBlood2", 50, 0, random (0, 360), 2, random (30, 50))
			TNT1 A 0 A_SpawnItemEx("DyingFatso01",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop		
			
		Death.Saw:
			TNT1 O 0 A_Jump(195, 2)
			Goto Death.Minigun
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 AAA 0 A_CustomMissile ("MuchBlood", 35, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_Scream
			TNT1 O 0 A_NoBlocking
			FAT2 KL 5 A_CustomMissile ("MuchBlood", 75, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("RipGuts", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_BossDeath
			FAT2 MNOP 5 A_CustomMissile ("MuchBlood", 15, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx ("FBD_NoGutsFatso",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop
			
		Death.Cut:	
		Death.Railgun:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_Stop
			XFAT AB 4
			TNT1 A 0 A_Scream
			TNT1 O 0 A_NoBlocking
			TNT1 AA 0 A_CustomMissile ("MuchBlood", 35, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("RipGuts", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath2b", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath3b", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_BossDeath
			XFAT CDEF 5
			XFAT GH 5
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx("FBD_NoGutsFatso2",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 AAAAAAAAAAAAAAAAAA 4 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 50))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop
			
		Death.Fire: 
		//Death.Burn: //burn is an imp fireball. Lighting this hulk on fire. Just no!
		Death.Flames:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
		
			BF4T AAA 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			TNT1 A 0 A_Pain
			BF4T BBB 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			BF4T CCC 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			BF4T BBB 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			
			BF4T AAA 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			TNT1 A 0 A_Pain
			BF4T BBB 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			BF4T CCC 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			BF4T BBB 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			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))
			BF4T AAA 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			TNT1 A 0 A_Pain
			BF4T BBB 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			BF4T CCC 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			BF4T BBB 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			
			BF4T AAA 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			TNT1 A 0 A_Pain
			BF4T BBB 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			BF4T CCC 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			BF4T BBB 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			TNT1 A 0 A_SpawnItemEx ("DetectFloorCraterSmall",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_BossDeath
			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))
			BF4T DEF 4 A_CustomMissile ("BurnParticles", 12, 0, random (0, 180), 2, random (50, 90))
			BF4T FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 10 A_CustomMissile ("BurnParticles", 12, 0, random (0, 180), 2, random (50, 90))
			CARB L -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.SuperPlasma:
		Death.Plasma: 
		Death.Plasma2:
		Death.HeadPlasma:
		
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
		
			TNT1 A 0 A_BossDeath
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			CRB7 GGG 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			TNT1 A 0 A_Playsound("props/redfire")
			
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 50, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), 2, random (0, 160))
			CRB7 HH 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 2, random (0, 180))
			EXPL AAAAAA 0 A_CustomMissile ("ExplosionSmoke", 32, 0, random (0, 360), 2, random (0, 360))
			CRB7 IIJJ 2 BRIGHT A_CustomMissile ("BurnParticles", 42, 0, random (0, 180), 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 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))
			CARB LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL 10 A_CustomMissile ("BurnParticles", 12, 0, random (0, 180), 2, random (50, 90))
			CARB L -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.Explosives:
		XDeath:
		Death.ExplosiveImpact:
		Death.Landmine:
		Death.ExtremePunches:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
		Death.DHFT:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_CustomMissile ("MeatDeath", 0, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAAAAAAAAAAA 0 A_CustomMissile ("BloodMistExtraBig", 30, 0, random (0, 360), 2, random (60, 90))
			TNT1 AAAAAA 0 A_CustomMissile ("SuperGoreSpawner", 30, 0, random (0, 360), 2, random (40, 70))
			TNT1 A 0 A_CustomMissile ("XDeathMancubusArm", 20, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 0 A_CustomMissile ("XDeathMancubusHead", 20, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathMancubusTorso", 20, 0, random (0, 360), 2, random (40, 160))
			TNT1 A 0 A_CustomMissile ("XDeathMancubusLeg", 20, 0, random (0, 360), 2, random (40, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2", 20, 0, random (0, 360), 2, random (10, 90))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3", 20, 0, random (0, 360), 2, random (10, 90))
			TNT1 AAAA 0 A_CustomMissile ("Guts2", 32, 0, random (0, 360), 2, random (10, 90))
			 TNT1 A 0 A_CustomMissile ("XDeathOrgan1", 24, 0, random (0, 360), 2, random (10, 90))
			 TNT1 A 0 A_CustomMissile ("XDeathOrgan2", 24, 0, random (0, 360), 2, random (10, 90))
			XFBT A 4 A_Scream
			XFBT B 4 A_NoBlocking
			TNT1 A 0 A_SpawnItem ("SplatteredLarge")
			TNT1 A 0 A_Stop
			XFBT CDEF 4 
			XFBT F 1 A_BossDeath
			
			// XDeadFat is a full fledged raiseable corpse, not a gore spawner
			TNT1 A 0 A_SpawnItemEx ("XDeadFat",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop

		Crush:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 AAAAAA 0 A_SpawnItemEx ("BodyRemovalThing",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 1 A_XScream
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			
			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

		Pain.Taunt:
			TNT1 A 0
			SPOS B 0 A_Pain
			TNT1 A 0 A_JumpIfInventory("Enraged", 1, "Missile")
			TNT1 A 0 A_ChangeFlag("FASTER", 1)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 A_ChangeFlag("MISSILEMORE", 1)
			TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 1)
			TNT1 A 0 A_PlaySound("demon/pain", CHAN_VOICE)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 2, 53)
			FATR A 1 A_FaceTarget
			FATR A 10
			TNT1 A 0 A_Pain
			FATR B 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 2, 57)
			FATR A 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 2, 53)
			FATR C 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 9, 50)
			TNT1 A 0 A_Pain
			FATR A 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 2, 53)
			FATR B 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 2, 57)
			FATR A 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 2, 53)
			FATR C 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 9, 50)
			TNT1 A 0 A_Pain
			FATR A 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 2, 53)
			FATR B 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 2, 57)
			FATR A 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 2, 53)
			FATR C 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 9, 50)
			TNT1 A 0 A_GiveInventory("Enraged", 1)
			Goto Missile

		Pain.KillMe:
			TNT1 A 0
			TNT1 A 0 HealThing(1)
			Goto Missile
		Death.KillMe:
		Death.Taunt:
			TNT1 A 0
			//TNT1 A 0 A_ChangeFlag("SOLID", 0)
			//TNT1 A 0 A_SpawnItem("Fatso")
			//Stop
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			SPOS B 0 A_Pain
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 A_PlaySound("demon/pain", CHAN_VOICE)
			FATR A 1 A_FaceTarget
			FATR A 10
			TNT1 A 0 A_Pain
			FATR BAC 8
			TNT1 A 0 A_Pain
			FATR ABAC 8
			TNT1 A 0 A_Pain
			FATR ABAC 8
			Goto Death	
			
		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_StopSound(CHAN_VOICE)
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_NoBlocking // in my version, freeze death is permanent
			TNT1 A 0 A_SpawnItemEx ("FrozenMancubus",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_BossDeath
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop	
		Death.IOS_Frost:
			TNT1 A 0
			TNT1 A 0 A_StopSound(CHAN_VOICE)
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_NoBlocking 
			TNT1 A 0 A_SpawnItemEx ("PermafrostMancubus",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_BossDeath
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop		
		
		Death.Massacre:
			Goto Death
			
		LTGCheckExtreme: // extreme outfits, 25% chance to treat the player as naked on each attack.
			TNT1 A 0 A_JumpIfCloser(400, 1)
			Goto MissileContinueAfterLTGCheck
			TNT1 A 0 A_JumpIfInTargetInventory("LTGExtreme", 1, 1)
			Goto MissileContinueAfterLTGCheck
			TNT1 A 0 A_Jump(64, "LTGCheckB")
			Goto MissileContinueAfterLTGCheck
		LTGCheck:
			TNT1 A 0 A_JumpIfInTargetInventory("IsDressed", 1, "LTGCheckExtreme")
		LTGCheckB:
			TNT1 A 0 A_JumpIfInventory("AlreadyPerformedLTGCatCall", 1, "MissileContinueAfterLTGCheck")
			
			TNT1 A 0 A_JumpIfCloser(600, 1)
			Goto MissileContinueAfterLTGCheck			
			
			TNT1 A 0 A_GiveInventory("AlreadyPerformedLTGCatCall", 1)
			
			TNT1 A 0 A_Jump(256, "LTGCheck1", "LTGCheck2", "LTGCheck3", "LTGCheck4", "LTGCheck5")
			
		LTGCheck1:
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 11, 0, 55)
			FATT Z Random(11,16) A_PlaySound("fatso/pain", CHAN_VOICE)
			FATT B Random(11,16) A_PlaySound("fatso/pain", CHAN_VOICE)
			FATT Z Random(11,16) A_PlaySound("fatso/pain", CHAN_VOICE)
			FATT B Random(11,16) A_PlaySound("fatso/pain", CHAN_VOICE)
			FATT Z Random(11,16) A_PlaySound("fatso/pain", CHAN_VOICE)
			FATT B Random(11,16) A_PlaySound("fatso/pain", CHAN_VOICE)
			FATT Z Random(11,16) A_PlaySound("fatso/pain", CHAN_VOICE)
			Goto See
		LTGCheck2:	
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 0, 51)
			TNT1 A 0 A_PlaySound("fatso/sight", CHAN_VOICE)
			FATT I Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATT I Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATT I Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATT I Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATT I Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATT I Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATT I Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			Goto See
		LTGCheck3:
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 11, 0, 55)
			FATT Z Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATT B Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATT Z Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATT B Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATT Z Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATT B Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATT Z Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			Goto See
		LTGCheck4:	
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 0, 51)
			FATT I Random(11,16) A_PlaySound("fatso/pain", CHAN_VOICE)
			FATT I Random(11,16) A_PlaySound("fatso/pain", CHAN_VOICE)
			FATT I Random(11,16) A_PlaySound("fatso/pain", CHAN_VOICE)
			FATT I Random(11,16) A_PlaySound("fatso/pain", CHAN_VOICE)
			FATT I Random(11,16) A_PlaySound("fatso/pain", CHAN_VOICE)
			FATT I Random(11,16) A_PlaySound("fatso/pain", CHAN_VOICE)
			FATT I Random(11,16) A_PlaySound("fatso/pain", CHAN_VOICE)
			Goto See
		LTGCheck5:	
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, -7, 37)
			FATR C Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATR C Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATR C Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATR C Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATR C Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			FATR C Random(11,16) A_PlaySound("fatso/sight", CHAN_VOICE)
			Goto See				

    } 
} 


Actor Mancubus_PP: FBD_Mancubus
{
	States
	{
		PotPourriSwap:
			TNT1 A 0
			Goto PotPourriCancel		
	}
}	


ACTOR BigFireBall Replaces Fatshot
{
	Game Doom
	SpawnID 153
	Radius 6
	Height 8
	Speed 20
    Fastspeed 25
	Damage (random(40,40))
	Projectile 
    Scale 0.6
	+FORCEXYBILLBOARD
	+THRUGHOST
	+GHOST
	RenderStyle Add
    DamageType Fire
	ExplosionRadius 150
	ExplosionDamage 8
	Alpha 1
	Decal "Scorch"
	SeeSound "BREATHOF"
	DeathSound "fatso/shotx"
	
	-NOBLOCKMAP // without this, A_RadiusGive does not see them and so projectile-destroying effects do not work. 	
	
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("BDCheckJanitor", 0, 0, 0, 0)//Check Effects
		
		Spawn1:
			TNT1 A 0 A_JumpIfInventory("lowgraphicsmode", 1, "SpawnCheap")
			TNT1 A 0 
			BLHD AB 1 BRIGHT A_SpawnItem ("FireballExplosionFlamesSmall")
			TNT1 A 0 A_CustomMissile ("RocketSmokeTrail52", 2, 0, random (70, 110), 2, random (0, 360))
			Loop
			
		SpawnCheap:
			TNT1 A 0 A_SpawnItem ("FireballExplosionFlamesSmall")
			BLHD AB 1 BRIGHT A_SpawnItem("RedFlare22")
			Loop	
			
		Death:
		
			TNT1 A 0 A_ChangeFlag("NOGRAVITY", 0)
			TNT1 A 0 A_Explode(10, 50, 0)
			Goto ExplosionEffect
		
		ExplosionEffect:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("lowgraphicsmode", 1, "DeathCheap")
			TNT1 AA 0 A_SpawnItemEx ("ExplosionFlareSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_CustomMissile ("BDExplosionparticles", 0, 0, random (0, 360), 2, random (40, 90))
			TNT1 A 0 A_CustomMissile ("BDExplosionparticles2", 0, 0, random (0, 360), 2, random (40, 90))
			TNT1 A 0 A_CustomMissile ("BDExplosionparticles3", 10, 0, random (0, 360), 2, random (40, 90))
			EXPL A 0 A_CustomMissile ("FlamethrowerFireParticles", 6, 0, random (0, 360), 2, random (0, 90))
			//FRFX ZZZ 0 BRIGHT A_CustomMissile ("BigBlackSmoke", 2, 0, random (0, 360), 2, random (0, 30))
			//TNT1 A 2 A_SpawnItem("BurningGroundLowDamage")
			TNT1 A 0 A_SpawnItemEx("TinyBurningPiece", random (-15, 15), random (-15, 15))
			TNT1 A 0 A_SpawnItemEx("TinyBurningPiece2", random (-35, 35), random (-35, 35))
			TNT1 A 0 A_SpawnItemEx("TinyBurningPiece3", random (-45, 45), random (-45, 35))
			TNT1 AA 20 A_CustomMissile ("BigBlackSmoke", 0, 0, random (0, 360), 2, random (40, 160))
			Stop
			
		DeathCheap:
		XDeath:
			TNT1 A 0
			TNT1 A 0 A_JumpIfCloser(200, "StopInAir")
			TNT1 A 0 A_SpawnItemEx ("ExplosionFlareSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_CustomMissile ("BDExplosionparticles", 0, 0, random (0, 360), 2, random (40, 90))
			TNT1 A 0 A_CustomMissile ("BDExplosionparticles2", 0, 0, random (0, 360), 2, random (40, 90))
			TNT1 A 0 A_CustomMissile ("BDExplosionparticles3", 10, 0, random (0, 360), 2, random (40, 90))
			EXPL A 0 A_CustomMissile ("FlamethrowerFireParticles", 6, 0, random (0, 360), 2, random (0, 90))
			Stop
		
			
		StopInAIr:	
			EXPL AAA 0 A_CustomMissile ("FlamethrowerFireParticles", 6, 0, random (0, 360), 2, random (0, 90))
			Stop
	}
}

Actor BigFireBallSfest: BigFireBall {
	Scale 1.0
	Gravity 0.1
	Decal "none"
	States {
		Spawn:
			MANF XY 4 BRIGHT
			Loop
		Death: // hit a wall
		Crash: // hit something that cannot bleed
			TNT1 A 0
			//TNT1 A 0 A_ChangeFlag("NOGRAVITY", 0)
			TNT1 A 0 A_Explode(10, 50, 0)
		XDeath: // hit something that can bleed
			TNT1 A 0
			TNT1 A 0 A_JumpIfCloser(200, "StopInAir")
			TNT1 A 0 A_SetScale(1.8, 1.8)
			FIR3 BCDEFGHUJKLMNOP 2 BRIGHT
			Stop
		StopInAIr:	
			EXPL AAA 0 A_CustomMissile ("FlamethrowerFireParticles", 6, 0, random (0, 360), 2, random (0, 90))
			Stop	
			
	}
}

// June 2024: fixing corpses not being raiseable by archviles
Actor MancubusRaisedByVile: FBD_Mancubus {
	States {
		Spawn:
			FATT B 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 5) // default headbox (tiny! hard to headsot!)
			
			FATT B 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 A_GiveInventory("TargetIsAMancubus")

			TNT1 A 0 
			
			//FATT RQPONMLK 5
			XFBT FEDCB 3
			XFAT DCBA 3
			XFAT Z 8

			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 FBD_NoGutsFatso: FBD_CurbstompedMarine
{
    
	//***Che: THE NEVER DYING FATALIZED MANCUBUS BUG
	// this class inherits from FBD_CurbstompedMarine,
	// which has specific methods for 
	// Pain.Kick, Pain.ExplosiveImpact and Pain.Trample
	// that cycle back to Spawn.
	// Since this sufferer does not actually count as *dead*,
	// pain states bring him back to writhing in agony.
	// even raising him from a charred skeleton.
	
	// I solve this by creating a couple specialized classes 
	//  (FatalizedMancubusCorpse, CharredMancubus)
	//	 that have those pain states removed
	

// ------- DEAD MANCUBUS FIX ------------------------------------------------------------------
// rationale: unlike all other monsters, dead mancubi are guaranteed 
// to block polyobjects, thus breaking advanced elevators and horizontal crushers

	// all kinds of dead mancubus inherit from this
	
	// May 2024: reverting back, was breaking your ability to rip them with axe
	//-SOLID
	//+THRUACTORS
    +NOTELEPORT
    +MOVEWITHSECTOR
	
	// June 2024: fixing corpses not being raiseable by archviles
	+CORPSE
	
	
	Radius 24
    Mass 10000
    Health 500
    Scale 1.1
	States
		{
		// June 2024: fixing corpses not being raiseable by archviles
		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", 2021), "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 ("MancubusRaisedByVile",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, 18, 0, 0) //"MancubusRaisedByVile"
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2021) // 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
			FAT2 P 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
			FAT2 P 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			FAT2 P -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
			
		LandOnLava:
			TNT1 A 0
			Goto Death.Burn
			
		Death:
			TNT1 A 0 A_SpawnItem("GutsPile")
			TNT1 A 0 A_NoBlocking
			TNT1 AAA 0 A_CustomMissile ("UltraGoreSpawner", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 90))
			TNT1 AAAAAAA 0 A_CustomMissile ("XDeathSkinPiece2", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeathSkinPiece1", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAAAAA 0 A_CustomMissile ("SmallSuperGore", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 170))
			TNT1 AA 0 A_CustomMissile ("XDeathMancubusArm", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathMancubusTorso", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathMancubusLeg", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 160))
			TNT1 A 0 A_CustomMissile ("XDeathMancubusHead", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 160))
			
			//***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)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
			
		Death.flames:
		Death.burn:
		Death.Plasma: 
		Death.Plasma2:
			TNT1 A 0
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_SpawnItemEx ("CharredMancubus",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
			//TNT1 AA 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), 2, random (0, 160))
			//TNT1 AA 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), 2, random (0, 160))
			//EXPL AAAAAA 0 A_CustomMissile ("ExplosionSmoke", 32, 0, random (0, 360), 2, random (0, 360))
			//CARB LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL 10 //A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), 2, random (0, 160))
			//CARB L -1
			
		Crush:	
		Death.CrushedBodies:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0 A_NoBlocking
			TNT1 AA 0 A_SpawnItem("MeatDeathSmall")
			TNT1 AAA 0 bright A_CustomMissile ("SuperGoreSpawner", 1, 0, random (0, 360), CMF_AIMDIRECTION, random (5, 10))
			TNT1 AA 0 bright A_CustomMissile ("XDeath1", 1, random (-30, 30), random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			TNT1 AA 0 bright A_CustomMissile ("XDeath2b", 1, random (-30, 30), random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			TNT1 AA 0 bright A_CustomMissile ("XDeath3b", 1, random (-30, 30), random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			CRS3 B 1 A_XScream
			CRS3 B -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0) 
			Stop 	
	  
    }
}

ACTOR DeadMancubusBugFixBase: FBD_NoGutsFatso {
	+NOPAIN
	// cancels the pain states
	States {
		Pain:
			Stop
		Pain.ExplosiveImpact:
			Stop
		Pain.FriendlyExplosion:
			Stop	
		Pain.Trample:	
			Stop
	}
}

ACTOR CharredMancubus: DeadMancubusBugFixBase {
	States {
		Spawn:
			TNT1 A 0
			Goto Death
		Death:
			TNT1 AA 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			EXPL AAAAAA 0 A_CustomMissile ("ExplosionSmoke", 32, 0, random (0, 360), CMF_AIMDIRECTION, 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 LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL 10 A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			CARB L -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
	}		
}

Actor FBD_NoGutsFatso2: FBD_NoGutsFatso
{
	Health 500 
	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
			XFAT 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
			XFAT I 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			XFAT I -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}


Actor DeadFat: FBD_NoGutsFatso
{
    Radius 16
    Height 18
    Scale 1.1
    Mass 10000
    Health 500
	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
			FATK 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
			FATK F 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			FATK F -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop			
		Death:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem("MancubusHeadExplode", 0, 10)
			TNT1 A 0 A_SpawnItemEx("DeadFatNoHead",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		Death.flames:
		Death.burn:
		Death.Plasma: 
		Death.Plasma2:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			EXPL AAAAAA 0 A_CustomMissile ("ExplosionSmoke", 32, 0, random (0, 360), CMF_AIMDIRECTION, 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 LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL 10 A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))

			CARB L -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}
		
		
		
Actor DeadFAT3F: DeadFat
{
States
    {
		Spawn:
			//***Che
			//FAT3 F -1
			//Stop
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("BDCheckFloorType", 0, 0, 0, 0)
			FAT3 F 30
			TNT1 A 0 A_JumpIfInventory("IsOverLava", 1, "LandOnLava")
			FAT3 F -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop				
			
		Death:
		Death.Cut:
		Death.Saw:
			TNT1 A 0 A_NoBlocking
			TNT1 AAA 0 A_CustomMissile ("UltraGoreSpawner", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 90))
			TNT1 AAAAAAA 0 A_CustomMissile ("XDeathSkinPiece2", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeathSkinPiece1", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAAAAA 0 A_CustomMissile ("SmallSuperGore", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 170))
			TNT1 AAAA 0 A_CustomMissile ("BloodMistSmall", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 90))
			TNT1 A 0 A_SpawnItem("RipGuts", 0, 40)
			TNT1 A 0 A_SpawnItemEx("FBD_NoGutsFatso",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop	
    }
}		
		

Actor DeadFatNoHead: DeadFat
{
	Health 500 
	States{
		Spawn:
			//***Che
			//FATT T -1
			//Stop    
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("BDCheckFloorType", 0, 0, 0, 0)
			FATT T 30
			TNT1 A 0 A_JumpIfInventory("IsOverLava", 1, "LandOnLava")
			FATT T -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop			
		Death:
			
			TNT1 A 0 A_NoBlocking
			TNT1 AAA 0 A_CustomMissile ("UltraGoreSpawner", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 90))
			TNT1 AAAAAAA 0 A_CustomMissile ("XDeathSkinPiece2", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeathSkinPiece1", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("SmallSuperGore", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 170))
			TNT1 A 0 A_CustomMissile ("XDeathMancubusArm", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathMancubusTorso", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 160))
			
			// XDeadFat is a full fledged raiseable corpse, not a gore spawner
			TNT1 A 0 A_SpawnItemEx("XDeadFat",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			
			Stop
	}
}

Actor DeadFatNoHead_RemovedWeapon: DeadFatNoHead
{
	Health 500 
	States{
		Spawn:
			//***Che
			//FAT2 R -1
			//Stop    
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("BDCheckFloorType", 0, 0, 0, 0)
			FAT2 R 30
			TNT1 A 0 A_JumpIfInventory("IsOverLava", 1, "Death.Burn")
			FAT2 R -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		//***Che: parent method not suitable as charred sprite has both guns
		Death.flames:
		Death.burn:
		Death.Plasma: 
		Death.Plasma2:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem ("CharredMeatsplosion")
			TNT1 A 0 A_SpawnItem("GoryAshesSafe")
			
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}
		
		
Actor XDeadFat: DeadFat
{
	Health 500 
	States{
		Spawn:
			//***Che
			//XFBT F -1
			//Stop   
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("BDCheckFloorType", 0, 0, 0, 0)
			XFBT F 30
			TNT1 A 0 A_JumpIfInventory("IsOverLava", 1, "Death.burn")
			XFBT F -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		Death.flames:
		Death.burn:
		Death.Plasma: 
		Death.Plasma2:

			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem ("CharredMeatsplosion")
			TNT1 A 0 A_SpawnItem("GoryAshesSafe")
			TNT1 A 0 A_CustomMissile ("XDeathMancubusArm", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			
			//***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)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop			
		Death:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0 A_SpawnItem("GutsPile")
			TNT1 A 0 A_NoBlocking
			TNT1 AAA 0 A_CustomMissile ("UltraGoreSpawner", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 90))
			TNT1 AAAAAAA 0 A_CustomMissile ("XDeathSkinPiece2", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeathSkinPiece1", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAAAAA 0 A_CustomMissile ("SmallSuperGore", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 170))
			TNT1 A 0 A_CustomMissile ("XDeathMancubusArm", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathMancubusLeg", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 160))
			
			//***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)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}
		
		
		

Actor FuckedFatso1: DeadFat
{
	Health 500 
	States{
		Spawn:
			//***Che
			//XFT2 D -1
			//Stop   
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("BDCheckFloorType", 0, 0, 0, 0)
			XFT2 D 30
			TNT1 A 0 A_JumpIfInventory("IsOverLava", 1, "Death.burn")
			XFT2 D -1
			Stop
		//***Che: parent method not suitable because the charred sprite has guns
		Death.flames:
		Death.burn:
		Death.Plasma: 
		Death.Plasma2:
		
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 AA 0 A_SpawnItem ("CharredMeatsplosion")
			TNT1 A 0 A_SpawnItem("GoryAshesSafe")
			
			//***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)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop			
		Death:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0 A_SpawnItem("GutsPile")
			TNT1 A 0 A_NoBlocking
			TNT1 AAA 0 A_CustomMissile ("UltraGoreSpawner", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 90))
			TNT1 AAAAAAA 0 A_CustomMissile ("XDeathSkinPiece2", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeathSkinPiece1", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAAAAA 0 A_CustomMissile ("SmallSuperGore", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 170))
			TNT1 AA 0 A_CustomMissile ("XDeathMancubusLeg", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 160))
			
			//***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)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}	
		
		
		

Actor FuckedFatso2: DeadFat
{
	Health 500 
	States{
		Spawn:
			//***Che
			//XFT3 D -1
			//Stop   
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("BDCheckFloorType", 0, 0, 0, 0)
			XFT3 D 30
			TNT1 A 0 A_JumpIfInventory("IsOverLava", 1, "Death.burn")
			XFT3 D -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		Death.flames:
		Death.burn:
		Death.Plasma: 
		Death.Plasma2:
		
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 AA 0 A_SpawnItem ("CharredMeatsplosion")
			TNT1 A 0 A_SpawnItem("GoryAshesSafe")
			
			//***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)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop				
		Death:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0 A_SpawnItem("GutsPile")
			TNT1 A 0 A_NoBlocking
			TNT1 AAA 0 A_CustomMissile ("UltraGoreSpawner", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 90))
			TNT1 AAAAAAA 0 A_CustomMissile ("XDeathSkinPiece2", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeathSkinPiece1", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAAAAA 0 A_CustomMissile ("SmallSuperGore", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 170))
			TNT1 AA 0 A_CustomMissile ("XDeathMancubusLeg", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 160))
			
			//***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)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0) 
			Stop
	}
}	
		
		
Actor DeadFatLegStumps: DeadFat
{
	Health 200 
	States{
		Spawn:
			//***Che
			//XFT4 C -1
			//Stop   
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("BDCheckFloorType", 0, 0, 0, 0)
			XFT4 C 30
			TNT1 A 0 A_JumpIfInventory("IsOverLava", 1, "Death.burn")
			XFT4 C -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		Death.flames:
		Death.burn:
		Death.Plasma:
		Death.Plasma2:
		
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 AA 0 A_SpawnItem ("CharredMeatsplosion")
			TNT1 A 0 A_SpawnItem("GoryAshesSafe")
			TNT1 AA 0 A_CustomMissile ("Guts", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 90))
			
			//***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)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop				
		Death:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0 A_NoBlocking
			TNT1 AA 0 A_CustomMissile ("MuchBlood2", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("Guts", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 90))
			TNT1 AAA 0 A_CustomMissile ("XDeathSkinPiece2", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathSkinPiece1", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathMancubusLeg", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 160))
			
			//***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)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}			
		
		
		
		
		
		
Actor DeadFatsoNoArm: DeadFat
{
	Health 500 
	States{
		Spawn:
			//***Che
			//XFT1 D -1
			//Stop   
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("BDCheckFloorType", 0, 0, 0, 0)
			XFT1 D 30
			TNT1 A 0 A_JumpIfInventory("IsOverLava", 1, "Death.burn")
			XFT1 D -1
			Stop
		Death.flames:
		Death.burn:
		Death.Plasma: 
		Death.Plasma2:
		
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem ("CharredMeatsplosionIntoGoryAshes")
			TNT1 A 0 A_CustomMissile ("XDeathMancubusArm", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			
			//***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)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop			
		Death:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0 A_SpawnItem("GutsPile")
			TNT1 A 0 A_NoBlocking
			TNT1 AAA 0 A_CustomMissile ("UltraGoreSpawner", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 90))
			TNT1 AAAAAAA 0 A_CustomMissile ("XDeathSkinPiece2", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeathSkinPiece1", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAAAAA 0 A_CustomMissile ("SmallSuperGore", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 170))
			TNT1 A 0 A_CustomMissile ("XDeathMancubusArm", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AA 0 A_CustomMissile ("XDeathMancubusLeg", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 160))
			
			//***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)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}			


Actor FatalizedFatso: FBD_NoGutsFatso
{
	Scale 1.0 
	Health 500 
	States{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
			TNT1 A 0 
			FATF F 1 A_PlaySound("fatso/pain", CHAN_VOICE)
			FATF FFEE 10 A_CustomMissile ("Blood", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			FATF F 1 A_PlaySound("fatso/pain", CHAN_VOICE)
			FATF FFEE 10 A_CustomMissile ("Blood", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			FATF F 1 A_PlaySound("fatso/pain", CHAN_VOICE)
			FATF FFEE 10 A_CustomMissile ("Blood", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))			

		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			
			FATF F 1 A_PlaySound("fatso/pain", CHAN_VOICE)
			FATF FF 10 A_CustomMissile ("Blood", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			FATF E 1 A_PlaySound("fatso/death", CHAN_VOICE)
			FATF EEEEEEEEE 4 A_CustomMissile ("Blood", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			//***Che
			//FATF E -1
			//Stop 
			
			//***Che: THE NEVER DYING FATALIZED MANCUBUS BUG
			// this class inherits from FBD_CurbstompedMarine,
			// which has specific methods for 
			// Pain.Kick, Pain.ExplosiveImpact and Pain.Trample
			// that cycle back to Spawn.
			// Since this sufferer does not actually count as *dead*,
			// pain states bring him back to writhing in agony.
			// even raising him from a charred skeleton.
			
			// I solve this by creating a couple specialized classes 
			//  (FatalizedMancubusCorpse, CharredMancubus)
			//	 that have those pain states removed
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("FatalizedMancubusCorpse",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}

ACTOR FatalizedMancubusCorpse: DeadMancubusBugFixBase {
	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
			FATF 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
			FATF E 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			FATF E -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}		
}
		
		
		
		

Actor DyingFatso01: FBD_NoGutsFatso
{
	Scale 1.0 
	Health 100 
	Radius 28
	Height 56
	-CLIENTSIDEONLY
	States
	{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
			TNT1 A 0 // for descendants to move their former spawn stuff here (not to repeat when Stay repeats from pain)
			XFT1 A 1 A_PlaySound("fatso/pain", CHAN_VOICE)
			XFT1 EEEEEEEEEEEEEEEE 3 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 50))
			
			XFT1 A 3 A_PlaySound("fatso/pain", CHAN_VOICE)
			XFT1 EEEEEEEEEEEEEEEE 3 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 50))			
			
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			
			XFT1 A 3 A_PlaySound("fatso/pain", CHAN_VOICE)
			XFT1 EEEEEEEEEEEEEEEE 3 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 50))
			
			XFT1 A 3 A_PlaySound("fatso/pain", CHAN_VOICE)
			XFT1 EEEEEEEEEEEEEEEE 3 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 50))
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Scream
			XFT1 BC 4
			TNT1 A 0 A_SpawnItemEx("DeadFatsoNoArm",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Death:
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_PlaySound("fatso/pain", CHAN_VOICE)
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 55, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathMancubusArm", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))
			XFT2 AAAAAAA 2 A_CustomMissile ("Brutal_LiquidBlood2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 50))
			TNT1 A 0 A_SpawnItemEx("DyingFatso02",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}		
			
			
			
Actor DyingFatso02: DyingFatso01
{
	+NOPAIN //***Che: otherwise may fall into ancestor's pain state meaning his left arm suddenly grows back
	Scale 1.0 
	Health 100 States
	{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:

			XFT2 AAAAAAAAAAAAAAAAAAAAAAAAAAAA 2 A_CustomMissile ("Brutal_LiquidBlood2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 50))
			
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Scream
			XFT2 BC 4
			TNT1 A 0 A_SpawnItemEx("FuckedFatso1",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Death:
			TNT1 A 0
			TNT1 A 0 A_SpawnItem("MancubusHeadExplode", 0, 50)
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 55, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			XFT3 AAA 2 A_CustomMissile ("Brutal_LiquidBlood2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 50))
			TNT1 A 0 A_SpawnItemEx("DyingFatso03",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}			
			
			
			
			
		
Actor DyingFatso03: DyingFatso02
{
	Scale 1.0 
	Health 100 
	States
	{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
			XFT3 AAAAAAAAAAAAAAAAAAAAAAAAAAAA 2 A_CustomMissile ("Brutal_LiquidBlood2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 50))
			
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Scream
			XFT3 B 4
			TNT1 A 0 A_SpawnItemEx("FuckedFatso2",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Death:
			TNT1 A 0
			TNT1 A 0 A_SpawnItem("RipGuts", 0, 40)
			TNT1 AAA 0 A_CustomMissile ("MuchBlood2", 55, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeath3", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath4", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathMancubusTorso", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 160))
			XFT4 AAAAAABBBC 2 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 50))
			TNT1 A 0 A_SpawnItemEx("DeadFatLegStumps",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}						