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

//***Che: WARNING: the baron's tracer pointer is reserved for barrel matchmaking! 
//  (see the ACS script "FBD_CallingTheBaronAFaggot")


ACTOR FBD_Baron : ZandronumBaronOfHell 17625
{
    //$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 BaronofHell2: FBD_Baron Replaces BaronofHell {} in Doom_Replacements.txt
	
	//$Sprite BAROA1
	
	//***Che
	Tag "$BARONOFHELL"
	Obituary "$BARONOFHELL_O"
	
	var int user_head_tid;
	var int user_head_type; // 2, noble headbox
	//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
	var int user_head_scale;
	var int user_head_rel;
	var int user_head_xyzf;
	
	var int user_bleeding_angle;
	
	var int user_spread; // for fan and barrage attacks, stores delta angle calculated via ACS
	
	Scale 1.1
	damagefactor "Crush", 10.0
	damagefactor "GibRemoving", 0.0
	Game Doom
    GibHealth 25
	Health 1200
	PainChance "Saw", 100
	PainChance "Cut", 100
	PainChance "Kick", 255 PainChance "Leg", 255
	PainChance "LowKick", 200 PainChance "HangingHook", 0
	damagefactor "TeleportRemover", 0.0
	
	//***Che: making this damage type inflict no damage by default, now only barons are susceptible
	DamageFactor "CallingTheBaronAFaggot", 1.0
	PainChance "CallingTheBaronAFaggot", 255 // hit by a marker missile launched by an explosive barrel
	damagefactor "Avoid", 0.0
	damagefactor "SSG", 0.2
	+QUICKTORETALIATE
	PainChance "Explosive", 255
	damagefactor "DontCallTheBaron", 0.0
	DamageFactor "CauseSplash", 0.0 DamageFactor "CauseObjectsToSplashSlime", 0.0 DamageFactor "CauseObjectsToSplashNukage", 0.0
	DamageFactor "CauseObjectsToSplashBlood", 0.0 DamageFactor "CauseObjectsToSplashLava", 0.0
	PainSound "PSXDPN"
	damagefactor "Fatality", 3.0
	damagefactor "Blood", 0.0 damagefactor "BlueBlood", 0.0 damagefactor "GreenBlood", 0.0
    BloodType "Green_Blood", "GreenFBD_SawBlood", "GreenFBD_SawBlood"
	BloodColor "DarkGreen"
	//Obituary "%o was brutalized by a Baron of Hell."
	
	//***Che:  there is a comment in BD22 that these can break monster closets (where?)
	// but I am leaving them because chebskies-EDAY was tested with this.
	MaxStepHeight 24
	MaxDropOffHeight 32
	
	+DONTHURTSPECIES
	DeathHeight 12 //***Che otherwise viles won't raise him // 0
	Radius 16
	// Height is inherited from the ancestral class = 64
	BurnHeight 12 //***Che otherwise viles won't raise him //0
	Speed 6

	PainChance "Head", 120
	PainChance "HeadPlasma", 120
	PainChance "HeadStun", 255 // balanced by him flying into rage after the 1..2s stun
	PainChance "Decaptate", 128 // the same state as headstun
	PainChance 25
	//Tag "Baron of Hell"
	DropItem "DemonRuneMix", 5
	
	PainChance "Argent", 255
	DamageFactor "Argent", 1.0
	
	PainChance "Bullet792", 100 // machineguns and snip[er rifles not aimed
	PainChance "SniperBullet", 120 // sniper rifle aimed	
	
	damagefactor "Killme", 1.0 // AOE inflicted by captured marines
	PainChance "Killme", 255	
	
	Species "Bruisers" //*Che various shenanigans depen on this
	
	PainChance "Ice", 128
	
	States
	{
	
		Pain.Ice:
			"----" A 20 A_Pain
			Goto See

		WaitTargetsFatalityOut:
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 57)
			BARO A 1 A_Jump(256, "WTF1", "WTF2", "WTF3", "RetreatContinue")
			Wait
		WTF1:
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 59)
			TNT1 A 0 A_PlaySound("baron/sight", CHAN_VOICE)
			BTS3 ABC 1 
			TNT1 A 0 A_FaceTarget
			BTS3 D 4
			BTS3 CBA 1
			Goto See2
		WTF2:
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 57)
			TNT1 A 0 A_PlaySound("baron/sight", CHAN_VOICE)
			BARO AAA 12 A_SetAngle(angle + Random(-50,50))
			Goto See2
		WTF3:
			BARO H 3 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, -4, 61)
			TNT1 A 0 A_PlaySound("baron/sight", CHAN_VOICE)
			BARO HHHH 9 A_SetAngle(angle + Random(-30,30))
			Goto See2
//		ReplaceVanilla:
//			TNT1 A 0
//			TNT1 A 0 A_GiveInventory("IAmClassicMonster", 1)
//			Goto Stand
/*			
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			TNT1 A 0 A_SpawnItemEx ("VanillaBaronOfHell",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG | SXF_CLEARCALLERTID,tid)
			TNT1 A 10 
			TNT1 A 1 A_BossDeath
			TNT1 A 1 A_Die("Vanish")
			Stop
*/			
		
		Death.Vanish:
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without a *large* margin scripts run ownerless
			Stop
			
		ReplaceForBoss1:
			TNT1 A 0
			//***Che: A_NoBlocking makes it drop items! Which we do not want in this case. Replacing with resetting flags manually:
			//TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_ChangeFlag("SOLID", 0)
			TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			//***Che: passing TID to the failchance parameter. Ingenious!
			//TNT1 A 0 A_SpawnItemEx ("FBD_BaronBoss1",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,tid)
			TNT1 A 0 A_SpawnItemEx ("FBD_BaronBoss1",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG | SXF_TRANSFERPOINTERS | SXF_TRANSFERSPECIAL | SXF_CLEARCALLERSPECIAL | SXF_CLEARCALLERTID  ,0, tid)
			TNT1 A 10 
			TNT1 A 1 A_BossDeath
			TNT1 A 0 A_Fall
			Stop	
			
		ReplaceForBoss2:
			TNT1 A 0
			//***Che: A_NoBlocking makes it drop items! Which we do not want in this case. Replacing with resetting flags manually:
			//TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_ChangeFlag("SOLID", 0)
			TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			//TNT1 A 0 A_SpawnItemEx ("FBD_BaronBoss2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,tid)
			TNT1 A 0 A_SpawnItemEx ("FBD_BaronBoss2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG | SXF_TRANSFERPOINTERS | SXF_TRANSFERSPECIAL | SXF_CLEARCALLERSPECIAL | SXF_CLEARCALLERTID  ,0, tid)
			TNT1 A 10 
			TNT1 A 1 A_BossDeath
			Stop

		PotPourriSwap:
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
		PotPourriWait:	
			KYPP B 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 ("BaronPotpourriSwapper",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:
			BARO B 0
			//TNT1 A 0 A_SetUserVar("user_head_type", 2) // noble headbox
			//***Che: more thorough checking!
			//TNT1 A 0 A_JumpIf(x == 304, "ReplaceForBoss1")
			TNT1 A 0 A_JumpIf(x == 304 && y == 2864, "ReplaceForBoss1")
			//TNT1 A 0 A_JumpIf(x == 528, "ReplaceForBoss2")
			TNT1 A 0 A_JumpIf(x == 528 && y == 2864, "ReplaceForBoss2")

			
			TNT1 A 0 A_JumpIf(CallAcs("GetPotPourri"), "PotPourriSwap")
		PotPourriCancel:
			

			// Also replaces BDCHeckClassicMonsters with a different mechanism
			// The slaughter-aware blood checks the parent monster and goes low-res automatically
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunMonster", 2) // noble headbox, 1.0 default scale (using pre-baked 1.1 scale)
			TNT1 A 0 A_GiveInventory("TargetIsABaronOfHell")
			TNT1 A 0 A_GiveInventory("TargetIsABruiser")
			
			//BARO B 1 // slaughtermap init takes 5 tics
			
			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("StandaloneGreenRezSfx",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0) 
			BOSS O 8
			BOSS NMLKJI 8
			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", 2004) // see _mob_list.xlsx
			Stop
			
		FallbackRezSuccess:
			TNT1 A 0 A_SpawnItemEx("StandaloneGreenRezSfx",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, "StandSfestExtreme") // extreme slaughtermap optimization
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, 0, 61)
			BARO BBBBBBB 10 A_Look
			"----" A 0 A_JumpIf(!user_head_tid, "StandSfest")
			Loop
			
		StandSfest:
			"----" AA 10 A_Look
			Loop			
/*			
		StandSfestExtreme: // no headbox created until sees the player!	
			BARO BBBBBBB 15 A_Look
			Loop
*/			
		See:
			BARO 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) // 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_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 A_JumpIfInventory("IAmClassicMonster", 1, "VanillaSee")
			//TNT1 A 0 A_CheckSight("SeeNeverSeen")
			TNT1 A 0 A_JumpIfInventory("HasExplosiveBarrel", 1, "MissileBarrel")
			BARO A 1
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 59)
			BTS3 ABC 1 
			TNT1 A 0 A_FaceTarget
			BTS3 D 4
			BTS3 CBA 1
			TNT1 A 0 HealThing(200)
			Goto See2
			
		ForgetFaster:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("EnemyMemory", 5)
			Goto See2
		
		See2:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "CurbstompMarine")
			TNT1 A 0 A_JumpIfInventory("ZombiemanFatality", 1, "FatalityZombieman")
			TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "FatalitySergeant")
			TNT1 A 0 A_JumpIfInventory("DemonFatality", 1, "FatalityDemon")
			TNT1 A 0 A_JumpIfInventory("ImpFatality3", 1, "FatalityImp")
			TNT1 A 0 A_JumpIfInventory("HasExplosiveBarrel", 1, "MissileBarrel")

		See4:
			TNT1 A 0
			//TNT1 A 0 A_JumpIfInventory("IAmClassicMonster", 1, "VanillaSee")
			TNT1 A 0 A_GiveInventory("EnemyMemory", 1)
			TNT1 A 0 A_JumpIfInventory("EnemyMemory", 20, "ForgetTarget")
			BARO A 0 A_CheckSight("SEE3")
			
/*			
			// slaughtermap manage
			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_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
			
			// 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_JumpIf(CallAcs("FBD_IsBaronSubscribedToABarrel"), "RetargetToBarrel")
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 57)
			BARO AA 2 A_Chase
			//TNT1 A 0 A_SpawnItemEx("FootSep", 0, 0)
			BARO AAA 2 A_Chase
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, 0, 61)
			BARO BBB 2 A_Chase
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 11, -4, 57)
			BARO CCC 2 A_Chase
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, -4, 61)
			BARO DDD 2 A_Chase
			

			TNT1 A 0 A_JumpIfInTargetInventory("TargetIsACyberdemon", 1, "CheckRetreat")
			TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMastermind", 1, "CheckRetreat")
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "ForgetFaster") //"LookingForPlayer") // "ForgetTarget")
			Loop
			
		SeeNeverSeen:
			TNT1 A 0
			//TNT1 A 0 A_JumpIfInventory("IAmClassicMonster", 1, "VanillaSee")
			BARO A 0 A_CheckSight("SEE3")
/*			
			// slaughtermap manage
			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_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", 12, 0, 57)
			BARO AA 2 A_Chase
			//TNT1 A 0 A_SpawnItemEx("FootSep", 0, 0)
			BARO AAAA 2 A_Chase

			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, 0, 61)
			BARO B 4 A_Chase
			BARO BB 2 A_Chase

			//TNT1 A 0 A_SpawnItemEx("FootSep", 0, 0)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 11, -4, 57)
			BARO CCCC 2 A_Chase
	
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, -4, 61)
			BARO DDDDDD 2 A_Chase

			TNT1 A 0 A_JumpIfInTargetInventory("TargetIsACyberdemon", 1, "CheckRetreat")
			TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMastermind", 1, "CheckRetreat")
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "ForgetFaster") //"LookingForPlayer") // "ForgetTarget")
			Loop	
		See3:
			TNT1 A 0
			//TNT1 A 0 A_SpawnItemEx("FootSep", 0, 0)
			//BARO AABBCCDD 3 A_Chase
			//TNT1 A 0 A_JumpIfInventory("IAmClassicMonster", 1, "VanillaSee")
/*			
			// slaughtermap manage
			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_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
			
			// 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_JumpIf(CallAcs("FBD_IsBaronSubscribedToABarrel"), "RetargetToBarrel")
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 57)
			BARO AA 3 A_Chase
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, 0, 61)
			BARO BB 3 A_Chase
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 11, -4, 57)
			BARO CC 3 A_Chase
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, -4, 61)
			BARO DD 3 A_Chase
			Goto See4
		
		Idle:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "CurbstompMarine")
			TNT1 A 0 A_TakeInventory("ComingTOGetTheBarrel", 1)
			
			//***Che he gets here from A_Chase inside fatalities when no target is available
			TNT1 A 0 A_JumpIfInventory("ZombiemanFatality", 1, "ThrowZombieman") //, "FatalityZombieman")
			TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "ThrowSergeant") //, "FatalitySergeant")
			
			TNT1 A 0 A_JumpIfInventory("ImpFatality3", 1, "FatalityImp")
			TNT1 A 0 A_JumpIfInventory("DemonFatality", 1, "FatalityDemon")			
			TNT1 A 0 A_JumpIfInventory("IAmClassicMonster", 1, "Stand")
		LookingForPlayer:
			TNT1 A 0
			//TNT1 A 0 A_JumpIfInventory("IAmClassicMonster", 1, "VanillaSee")
			
//			TNT1 A 0 A_SetUserVar("user_sleeping", 1)
			
			TNT1 A 0 A_GiveInventory("SKImp", 1)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, 0, 61)
			BARO BBB 10 A_Look
			TNT1 A 0 A_SetAngle(angle - 40)
			BARO BBB 10 A_Look
			TNT1 A 0 A_SetAngle(angle + 40)
			BARO BBB 10 A_Look
			
			//***Che: THE HEAVY MOBS FALLING OFF LEDGES BUG
			// No, you *cannot* use A_Recoil to simulate slow movement
			// A) happily ignores "block monsters"
			// B) happily ignores height difference
			// Result: show up then walk away causin the monster to enter this mode.
			// When you return there's about 90% chance he will be stuck in the deepest pit available.
			// Most notorious for revenants across the entirety of EDAY placed atop cargo containers
			//   (and revenants on high ledges in map 31, Peak of the gods).
			//   They fall off with 100% reliability.
			// Also very prominent on maps generated using Oblige 6.x
			//   where you find most revenants, knights and barons down in lava pits.
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 57)
			BARO A 2 A_Wander // im replacing all 0s with 2s for A_Wander and commenting a_recoil out
			BARO AA 2 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, 0, 61)
			BARO B 2 A_Wander
			BARO BB 2 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 11, -4, 57)
			BARO C 2 A_Wander
			BARO CC 2 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, -4, 61)
			BARO D 2 A_Wander
			BARO DD 2 A_Look
			
			TNT1 A 0 A_jump(128, "LookingForPlayer")
			

			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 57)
			BARO A 2 A_Wander
			BARO AA 2 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, 0, 61)
			BARO B 2 A_Wander
			BARO BB 2 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 11, -4, 57)
			BARO C 2 A_Wander
			BARO CC 2 A_Look

			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, -4, 61)
			BARO D 2 A_Wander
			BARO DD 2 A_Look
			
			Goto LookingForPlayer
			
			
			
		ForgetTarget:
			TNT1 A 0 A_ClearTarget
			TNT1 A 0 A_TakeInventory("EnemyMemory", 25)
			TNT1 A 0 A_GiveInventory("LookingForPlayer", 1)
			Goto LookingForPlayer	
		
			
		RAGE:
			TNT1 A 0
			//TNT1 A 0 A_CheckSight("See")
			TNT1 A 0 A_GiveInventory("Enraged", 1)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 59) // imprecise anyway -- he shakes his head too much to follow
			TNT1 A 0 A_PlaySound("baron/sight", CHAN_VOICE)

			BTS3 ABC 2 
			BTS3 DEDFDEDF 3
			BTS3 CBA 2
			TNT1 A 0 HealThing(200)
			TNT1 A 0 A_ChangeFlag("MISSILEMORE", 1)
			TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 1)
			TNT1 A 0 A_Jump(96, "SpecialAttack")
			Goto See2
		RAGE_NoHeal: // his reaction to a strong hedshot. Without this, two rails to the head fail to kill him
			TNT1 A 0
			//TNT1 A 0 A_CheckSight("See")
			TNT1 A 0 A_GiveInventory("Enraged", 1)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 59) // imprecise anyway -- he shakes his head too much to follow
			TNT1 A 0 A_PlaySound("baron/sight", CHAN_VOICE)

			BTS3 ABC 2 
			BTS3 DEDFDEDF 3
			BTS3 CBA 2
			//TNT1 A 0 HealThing(200)
			TNT1 A 0 A_ChangeFlag("MISSILEMORE", 1)
			TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 1)
			TNT1 A 0 A_Jump(96, "SpecialAttack")
			Goto See2		
		
		Melee:
			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("TargetIsANExplosiveBarrel", 1, "GrabBarrel")
			
			TNT1 A 0 A_JumpIfInTargetInventory("IsLTGPlayer", 1, "LTGCheckM")
		MeleeContinueAfterLTGCheck:	

			// Kinslayer check:	
			TNT1 A 0 A_JumpIfInTargetInventory("TargetIsABruiser", 1, 2)
			TNT1 A 0 A_JumpIf(true, 2)
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_InfightFriendlyFireOn")
			
			//TNT1 A 0 A_JumpIfInventory("IAmClassicMonster", 1, "VanillaAttack")
			
			TNT1 A 0 A_JumpIfInTargetInventory("TargetIsACyberdemon", 1, "CheckRetreat")
			TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMastermind", 1, "CheckRetreat")
			TNT1 A 0 A_JumpIfInTargetInventory("IsInATank", 1, "LeapBackAndSpray")
			
			TNT1 A 0 A_JumpIfInTargetInventory("GoFatality", 1, "WaitTargetsFatalityOut")
			
		ClawRight:	
			TNT1 A 0
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_JumpIfInventory("MeleeHitSuccess", 1, 2)
			TNT1 A 0 A_JumpIfInventory("MeleeMiss", 3, "LeapBackAndSpray")
			TNT1 A 0 A_TakeInventory("MeleeHitSuccess", 1)
			TNT1 A 0 A_CustomMissile("BaronAttackOnBarrel",10,0,0,0)
			BARO E 1 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 7, 55)
			TNT1 A 0 A_JumpIfInventory("HasExplosiveBarrel", 1, "MissileBarrel")
			BARO E 6
			TNT1 A 0 A_PlaySound("weapons/gswing", CHAN_WEAPON)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, 4, 55)
			BARO F 6 A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, -7, 48)
			BARO G 6 A_CustomMissile("BaronAttack",10,0,0,0)
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "CurbstompMarine")
			TNT1 A 0 A_JumpIfInventory("ZombiemanFatality", 1, "FatalityZombieman")
			TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "FatalitySergeant")
			TNT1 A 0 A_JumpIfInventory("DemonFatality", 1, "FatalityDemon")
			TNT1 A 0 A_JumpIfInventory("ImpFatality3", 1, "FatalityImp")
			
			TNT1 A 0 A_JumpIfCloser(70, 1) // otherwise, strikes from too long a range
			// like in that TF2 lore about trolldier's shovel being five meters long
			Goto See2
			
			// slow this meatgrinder a tiny bit
			BARO D 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, -4, 61)
			TNT1 A 0 A_Chase("", "") // stop kicking that dead horse (this jumps to Idle if target is ded)
			TNT1 A 0 A_JumpIfInventory("MeleeHitSuccess", 1, 1)
			Goto See2
			TNT1 A 0 A_JumpIfInTargetInventory("GoFatality", 1, "WaitTargetsFatalityOut")
			TNT1 A 0 A_Recoil(-3)
		ClawLeft:
			TNT1 A 0
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_JumpIfInventory("MeleeHitSuccess", 1, 2)
			TNT1 A 0 A_JumpIfInventory("MeleeMiss", 3, "LeapBackAndSpray")
			TNT1 A 0 A_TakeInventory("MeleeHitSuccess", 1)
			TNT1 A 0 A_CustomMissile("BaronAttackOnBarrel",10,0,0,0)
			BARO X 1 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, -7, 55)
			TNT1 A 0 A_JumpIfInventory("HasExplosiveBarrel", 1, "MissileBarrel")
			BARO X 6 A_FaceTarget
			TNT1 A 0 A_PlaySound("weapons/gswing", CHAN_WEAPON)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, -4, 55)
			BARO Y 6 A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, 7, 48)
			BARO Z 6 A_CustomMissile("BaronAttack",10,0,0,0)
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "CurbstompMarine")
			TNT1 A 0 A_JumpIfInventory("ZombiemanFatality", 1, "FatalityZombieman")
			TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "FatalitySergeant")
			TNT1 A 0 A_JumpIfInventory("DemonFatality", 1, "FatalityDemon")
			TNT1 A 0 A_JumpIfInventory("ImpFatality3", 1, "FatalityImp")
			
			TNT1 A 0 A_JumpIfCloser(70, 1) // otherwise, strikes from too long a range
			Goto See2
			BARO B 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, 0, 61)
			TNT1 A 0 A_Chase("", "") // stop kicking that dead horse (this jumps to Idle if target is ded)
			TNT1 A 0 A_JumpIfInventory("MeleeHitSuccess", 1, 1)
			Goto See2
			TNT1 A 0 A_JumpIfInTargetInventory("GoFatality", 1, "WaitTargetsFatalityOut")
			TNT1 A 0 A_Recoil(-3)
			Goto ClawRight
			
		RetargetToBarrel:
			// ACS scripts store the barrel in our tracer pointer.
			// Swindle the pointers to change the target to barrel
			// (target goes to tracer while tracer (the barrel) replaces the target
			"----" A 0 A_RearrangePointers(AAPTR_TRACER, AAPTR_DEFAULT, AAPTR_TARGET)
			Goto See
		
		GrabBarrel:
			TNT1 A 0 A_FaceTarget
			BARO E 7 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 7, 55)
			BARO F 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, 4, 55)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, -7, 48)
//TNT1 A 0 ACS_NamedExecuteWithResult("FBD_LogTargetsClass")
			BARO G 6 A_CustomMissile("FBD_BaronAttackOnBarrel",10,0,0,0)
			BARO GGGGG 3 A_JumpIfInventory("HasExplosiveBarrel", 1, "GrabbedBarrel")
			Goto Idle
			
		GrabbedBarrel:
			// restore our old target saved in our tracer and clear the tracer
			"----" A 0 A_ClearTarget
			"----" A 0 A_RearrangePointers(AAPTR_TRACER, AAPTR_DEFAULT, AAPTR_NULL)
//TNT1 A 0 ACS_NamedExecuteWithResult("FBD_LogTargetsClass")			
			Goto MissileBarrel
			
		LeapBackAndSpray:		
			TNT1 A 0
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 A_TakeInventory("MeleeMiss", 10)
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 ThrustThingZ(0,20,0,1)
			TNT1 A 0 A_Recoil(6)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15,  -6, 52)
			BARO R 4
			BARO RRRRRRRRRRRRRRRR 4 A_CheckFloor ("SpecialAttackContinue") 
			Goto SpecialAttackContinue	
		Dodge:
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 ThrustThingZ(0,20,0,1)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15,  -6, 52)
			BARO R 1 A_Jump(256, "DodgeLeft", "DodgeRight")
			Wait
		DodgeLeft:
			TNT1 A 0 A_SetAngle(angle + 80)
			TNT1 A 0 A_Recoil(5)
			TNT1 A 0 A_SetAngle(angle - 80)
			BARO R 4 A_TakeInventory("DuckYouFool", 1) 
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15,  -6, 52)
			BARO RRRRRRR 2 A_CheckFloor ("SpecialAttackContinue")
			TNT1 A 0 A_FaceTarget
			BARO RRRRRRRRRRRRR 2 A_CheckFloor ("SpecialAttackContinue")
			TNT1 A 0 A_FaceTarget
			Goto SpecialAttackContinue				
		DodgeRight:
			TNT1 A 0 A_SetAngle(angle - 80)
			TNT1 A 0 A_Recoil(5)
			TNT1 A 0 A_SetAngle(angle + 80)
			BARO R 4 A_TakeInventory("DuckYouFool", 1)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15,  -6, 52)			
			BARO RRRRRRR 2 A_CheckFloor ("SpecialAttackContinue")
			TNT1 A 0 A_FaceTarget
			BARO RRRRRRRRRRRRR 2 A_CheckFloor ("SpecialAttackContinue")
			TNT1 A 0 A_FaceTarget
			Goto SpecialAttackContinue	
/*			
		VanillaSee:
			//BOSS AABBCCDD 3 A_Chase
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 57)
			BARO AA 3 A_Chase
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, 0, 61)
			BARO BB 3 A_Chase
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 11, -4, 57)
			BARO CC 3 A_Chase
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, -4, 61)
			BARO DD 3 A_Chase
			Loop
		VanillaAttack:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 7, 55)
			BOSS E 8 A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, 4, 55)
			BOSS F 8 A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, -7, 48)
			BOSS G 8 A_BruisAttack
			Goto VanillaSee
*/	
	
	
		
		Missile:
			BARO A 1
/*			
			// 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)	
*/
			// Kinslayer check:	
			TNT1 A 0 A_JumpIfInTargetInventory("TargetIsABruiser", 1, 2)
			TNT1 A 0 A_JumpIf(true, 2)
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_InfightFriendlyFireOn")
		
			//TNT1 A 0 A_JumpIfInventory("IAmClassicMonster", 1, "VanillaAttack")
			
			TNT1 A 0 A_TakeInventory("EnemyMemory", 30)
			TNT1 A 0 A_JumpIfInTargetInventory("TargetIsACyberdemon", 1, "CheckRetreat")
			TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMastermind", 1, "CheckRetreat")
			TNT1 A 0 A_JumpIfInTargetInventory("IsInATank", 1, "CheckRetreat")
			TNT1 A 0 A_JumpIfInTargetInventory("GoFatality", 1, "CheckRetreat")
			TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAGreatTerribleBoss", 1, "CheckRetreat")
			TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAnExplosiveBarrel", 1, "See2")
			TNT1 A 0 A_TakeInventory("StopKickingMyBallsMotherFucker", 1)
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "CurbstompMarine")
			TNT1 A 0 A_JumpIfInventory("ZombiemanFatality", 1, "FatalityZombieman")
			TNT1 A 0 A_JumpIfInTargetInventory ("TypeZombieman", 1, "See2")
			TNT1 A 0 A_JumpIfInTargetInventory ("TypeSergeant", 1, "See2") 
			
			//TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 0, 5)
			//TNT1 A 0 A_TakeInventory("CantFire", 1)
			//TNT1 A 0 A_CustomMissile("MonsterTargetCheck", 34, 0, 0, 0) 
			//TNT1 A 0 A_CustomMissile("MonsterTargetCheckFaster", 34, 0, 0, 0)  
			
			TNT1 A 0 A_JumpIfInTargetInventory("IsLTGPlayer", 1, "LTGCheck")
		MissileContinueAfterLTGCheck:			
			
			TNT1 A 0 A_FaceTarget
			//TNT1 A 0 A_JumpIfInventory("CantFire",1, "See4")
			
			TNT1 A 0 A_Jump (64, "SpecialAttack")
			
			
			//***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
			
		MissileContinue:
			TNT1 A 0
//			TNT1 A 0 A_JumpIfInventory("IAmSfestMonster", 1, "MissileContinueSFest")		
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 7, 55)
			BARO E 5 
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 78, 40, random (0, 360), CMF_AIMDIRECTION, random (70, 110))
			TNT1 A 0 A_CustomMissile ("BallGettingReadyGreen", 79, 40, random (0, 140), 2, random (0, 160))
			
			//***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
			
			BARO E 2 
			
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 78, 40, random (0, 360), CMF_AIMDIRECTION, random (70, 110))
			TNT1 A 0 A_CustomMissile ("BallGettingReadyGreen", 79, 40, random (0, 140), 2, random (0, 160))
			
			//***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
			
			BARO E 2 
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 78, 40, random (0, 360), CMF_AIMDIRECTION, random (70, 110))
			TNT1 A 0 A_CustomMissile ("BallGettingReadyGreen", 79, 40, random (0, 140), 2, random (0, 160))
			
			//***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
			
			BARO E 2 
			
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 78, 40, random (0, 360), CMF_AIMDIRECTION, random (70, 110))
			TNT1 A 0 A_CustomMissile ("BallGettingReadyGreen", 79, 40, random (0, 140), 2, random (0, 160))
			
			//***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
			
			BARO E 2 
				
			//***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 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, 4, 55)
			BARO F 3 		
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, -7, 48)
			BARO G 8 A_CustomMissile("BaronBall", 36, 0, angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			//BARO G 8 A_CustomMissile("FBD_ThrowedZombieMan2", 36, 0, 0, 1)
			TNT1 A 0 A_TakeInventory("ComingToGetTheBarrel", 1)
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "ForgetTarget")
			Goto See2
/*
		MissileContinueSfest:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 7, 55)
			BARO E 13 
				
			//***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 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, 4, 55)
			BARO F 3 		
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, -7, 48)
			BARO G 8 A_CustomMissile("BaronBallSfest", 36, 0, angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			//BARO G 8 A_CustomMissile("FBD_ThrowedZombieMan2", 36, 0, 0, 1)
			//TNT1 A 0 A_TakeInventory("ComingToGetTheBarrel", 1)
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "ForgetTarget")
			Goto See2
*/			

		SpecialAttack:
			
			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_JumpIfInventory("IAmClassicMonster", 1, "VanillaAttack")
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, -6, 52)
			BARO R 3 A_FaceTarget
			
			
			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_JumpIfCloser(500, 2)
			TNT1 A 0 A_Jump(128, "SpecialAttackBurst")
		SpecialAttackContinue:
			TNT1 A 0 A_JumpIf(CallAcs("GetNoTraget"), "See") // An archvile may cause dodging
			// because archviles headshot bruisers. But since archviles are not targetable,
			// that only leads to attack animation dry-firing.
			
//			TNT1 A 0 A_JumpIfInventory("IAmSfestMonster", 1, "SpecialAttackContinueSFest")
			
			BARO Q 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 3, 58)
			BARO P 2 //A_FaceTarget
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 78, 40, random (0, 360), 2, random (70, 110))
			TNT1 A 0 A_CustomMissile ("BallGettingReadyGreen", 79, 40, random (0, 140), 2, random (0, 160))
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 78, -40, random (0, 360), 2, random (70, 110))
			TNT1 A 0 A_CustomMissile ("BallGettingReadyGreen", 79, -40, random (0, 140), 2, random (0, 160))
			BARO P 2
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 78, 40, random (0, 360), 2, random (70, 110))
			TNT1 A 0 A_CustomMissile ("BallGettingReadyGreen", 79, 40, random (0, 140), 2, random (0, 160))
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 78, -40, random (0, 360), 2, random (70, 110))
			TNT1 A 0 A_CustomMissile ("BallGettingReadyGreen", 79, -40, random (0, 140), 2, random (0, 160))
			BARO P 2
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 78, 40, random (0, 360), 2, random (70, 110))
			TNT1 A 0 A_CustomMissile ("BallGettingReadyGreen", 79, 40, random (0, 140), 2, random (0, 160))
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 78, -40, random (0, 360), 2, random (70, 110))
			TNT1 A 0 A_CustomMissile ("BallGettingReadyGreen", 79, -40, random (0, 140), 2, random (0, 160))
			BARO P 2
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 78, 40, random (0, 360), 2, random (70, 110))
			TNT1 A 0 A_CustomMissile ("BallGettingReadyGreen", 79, 40, random (0, 140), 2, random (0, 160))
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 78, -40, random (0, 360), 2, random (70, 110))
			TNT1 A 0 A_CustomMissile ("BallGettingReadyGreen", 79, -40, random (0, 140), 2, random (0, 160))
			BARO P 2
			
			
			BARO Q 4
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 58, 30, random (0, 360), 2, random (70, 110))
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 58, -30, random (0, 360), 2, random (70, 110))

			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
			
			BARO Q 4 
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 48, 30, random (0, 360), 2, random (70, 110))
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 48, -30, random (0, 360), 2, random (70, 110))
			
			
//			TNT1 A 0 A_JumpIfCloser(768, "SpecialAttackCloseRange")
			TNT1 A 0 A_SetUserVar("user_spread", CallAcs("CalcBarrageSpreadFromDistanceToTarget", 900, 500, 256, 768)) 
				// arc near, arc far, threshold near, threshold far
				// degree percent, degree percent, map units, map units
				// return value is fixed degrees
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, -6, 52)
			TNT1 A 0 A_CustomMissile("BaronBall", 36, 15, angle + 0.0000152587890625 * user_spread, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH) 
			TNT1 A 0 A_CustomMissile("BaronBall", 36, 15, angle - 0.0000152587890625 * user_spread, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			BARO R 8 A_CustomMissile("BaronBall", 36, 15, angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			
			//TNT1 A 0 A_TakeInventory("ComingToGetTheBarrel", 1)
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "LookingForPlayer")//"ForgetTarget")
			Goto See2
/*			
		SpecialAttackContinueSFest:
			BARO Q 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 3, 58)
			BARO P 10
			BARO Q 4

			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
			
			BARO Q 4
			TNT1 A 0 A_JumpIfCloser(768, "SpecialAttackCloseRangeSFest")
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, -6, 52)
			TNT1 A 0 A_CustomMissile("BaronBallSfest", 36, 15, 5 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH) 
			TNT1 A 0 A_CustomMissile("BaronBallSfest", 36, 15, -5 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			BARO R 8 A_CustomMissile("BaronBallSfest", 36, 15, angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			
			//TNT1 A 0 A_TakeInventory("ComingToGetTheBarrel", 1)
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "LookingForPlayer")//"ForgetTarget")
			Goto See2
			
			
		SpecialAttackCloseRange:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, -6, 52)
			TNT1 A 0 A_CustomMissile("BaronBall", 36, 15, 9 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH) 
			TNT1 A 0 A_CustomMissile("BaronBall", 36, 15, -9 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			BARO R 8 A_CustomMissile("BaronBall", 36, 15, angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			
			//TNT1 A 0 A_TakeInventory("ComingToGetTheBarrel", 1)
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"),  "LookingForPlayer")//"ForgetTarget")
			Goto See2 
		SpecialAttackCloseRangeSfest:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, -6, 52)
			TNT1 A 0 A_CustomMissile("BaronBallSfest", 36, 15, 9 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH) 
			TNT1 A 0 A_CustomMissile("BaronBallSfest", 36, 15, -9 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			BARO R 8 A_CustomMissile("BaronBallSfest", 36, 15, angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			
			//TNT1 A 0 A_TakeInventory("ComingToGetTheBarrel", 1)
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"),  "LookingForPlayer")//"ForgetTarget")
			Goto See2 			
*/
		SpecialAttackBurst:
			TNT1 A 0
//			TNT1 A 0 A_JumpIfInventory("IAmSfestMonster", 1, "SpecialAttackBurstSFest")
			
			//***Che X, Y, Z are a simple re-mirror for attack with his left hand
			// the beginning mirrors his basic attack -- just mirrored	
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, -7, 55)
			BARO X 2 
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 78, -40, random (0, 360), 2, random (70, 110))
			TNT1 A 0 A_CustomMissile ("BallGettingReadyGreen", 79, -40, random (0, 140), 2, random (0, 160))
			
			//***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
			
			BARO X 2 
			
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 78, -40, random (0, 360), 2, random (70, 110))
			TNT1 A 0 A_CustomMissile ("BallGettingReadyGreen", 79, -40, random (0, 140), 2, random (0, 160))
			
			//***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
			
			BARO X 2 
			TNT1 A 0 bright A_CustomMissile ("SmallGreenFlameTrails", 78, -40, random (0, 360), 2, random (70, 110))
			TNT1 A 0 A_CustomMissile ("BallGettingReadyGreen", 79, -40, random (0, 140), 2, random (0, 160))
			
			//***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 bright A_CustomMissile ("SmallGreenFlameTrails", 78, -40, random (0, 360), 2, random (70, 110))
			TNT1 A 0 A_CustomMissile ("BallGettingReadyGreen", 79, -40, random (0, 140), 2, random (0, 160))
			
			BARO X 4 
				
				//***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 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, -4, 55)
			BARO Y 3 		
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, 7, 48)
			BARO Z 4 A_CustomMissile("BaronBall", 36, 0, angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)

			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 7, 55)
			BARO E 4
				//***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 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, 4, 55)
			BARO F 4 		
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, -7, 48)
			BARO G 4 A_CustomMissile("BaronBall", 52, 0, random (-2, 2) + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH, random (-2, 2))
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, -7, 55)
			BARO X 4

				//***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 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, -4, 55)
			BARO Y 4
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, 7, 48)
			BARO Z 8 A_CustomMissile("BaronBall", 52, 0, random (-4, 4) + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH, random (-4, 4))
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			
			Goto See2
/*			
		SpecialAttackBurstSfest:
			
			//***Che X, Y, Z are a simple re-mirror for attack with his left hand
			// the beginning mirrors his basic attack -- just mirrored	
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, -7, 55)
			BARO X 10 
				//***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
			BARO Y 3 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, -4, 55)		
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, 7, 48)
			BARO Z 4 A_CustomMissile("BaronBallSfest", 36, 0, angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			BARO E 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 7, 55)
				//***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
			BARO F 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, 4, 55)		
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, -7, 48)
			BARO G 4 A_CustomMissile("BaronBallSfest", 52, 0, random (-2, 2) + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH, random (-2, 2))
			BARO X 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, -7, 55)

				//***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
			BARO Y 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, -4, 55)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, 7, 48)
			BARO Z 8 A_CustomMissile("BaronBallSfest", 52, 0, random (-4, 4) + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH, random (-4, 4))
			
			Goto See2			
*/		
		CheckRetreat:
			TNT1 A 0
			TNT1 A 0 A_JumpIfCloser(600, "Retreat")
			
			
			
			// so he does actual high damage against cyberdemons, masterminds and tanks
			Goto SpecialAttackBurst //SpecialAttack //Missile+5
		
		Retreat:
			TNT1 A 0
			//TNT1 A 0 A_SpawnItemEx("FootSep", 0, 0)
			TNT1 A 0 A_FaceTarget
		
			TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAGreatTerribleBoss", 1, "Dodge")
			TNT1 A 0 A_JumpIfInTargetInventory("GoFatality", 1, "WaitTargetsFatalityOut")
			
		RetreatContinue:
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 13, -4, 61)
			BARO DDDD 2 A_Recoil(2)

			TNT1 A 0 A_FaceTarget
			
			TNT1 A 0 A_JumpIfTargetInLOS(1)
			Goto See2
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 11, -4, 57)
			BARO CCCC 2 A_Recoil(1)
			
			TNT1 A 0 A_JumpIfTargetInLOS(1)
			Goto See2
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, 0, 61)
			BARO BBBB 2 A_Recoil(1)
			
			TNT1 A 0 A_JumpIfTargetInLOS(1)
			Goto See2
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 57)
			BARO AAAA 2 A_Recoil(1)
			
			//Goto Missile+5
			TNT1 A 0 A_JumpIfTargetInLOS("SpecialAttackBurst")//"SpecialAttack")
			//"MissilePlus5") // without a LOS check, a baron 
			//  retreating	from a cyberdemon, while on high ground, keeps shooting the ground
			//  because he immediately loses the LOS to the cyber due to cliff edge.
			// Which looks hilariously stupid
			
			Goto See2

/*			
		//***Che I replaced this with a much more reliable code
		Pain.CallingTheBaronAFaggot:  // hit by a marker missile launched by an explosive barrel
			TNT1 A 0
			TNT1 A 0 HealThing(1)
			TNT1 A 0 A_GiveInventory("ComingToGetTheBarrel", 1)
			TNT1 A 0
			Goto See2
*/			
		
		MissileBarrel:
			BOBA A 0
			

			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 48)
			
			//***Che and then hold that barrel in his pocket, yea.
			//BOBA A 1 A_Chase("","") // may jump to Idle on losing target
			BOBA A 0 A_ChangeFlag("NOPAIN", 1)
			BOBA AB 4
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 58)
			BOBA C 4
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 48)
			BOBA D 1
			TNT1 A 0 A_PlaySound("baron/sight", CHAN_VOICE)
			
		WaitingToThrow:
			TNT1 A 0
			TNT1 A 0 
			BOBA D 8 A_SpawnItem("BaronHoldingBarrel", 0, 76,0) // barrel hitbox, 8 tics lifetime
			//TNT1 A 0 A_CheckSight("WaitingToThrow")
			TNT1 A 0 A_JumpIf(!CallAcs("FBD_IsMyTargetABarrel"), 2)
			TNT1 A 0 A_ClearTarget // should not happen, was targeting another barrel!
			TNT1 A 0 A_JumpIfTargetInLOS("ThrowBarrel")

			//***Che eventually he gets tired of holding it and throws it wherever
			TNT1 A 0 A_GiveInventory("EnemyMemory", 1)
			TNT1 A 0 A_JumpIfInventory("EnemyMemory", 30, "ThrowBarrel")
			TNT1 A 0 A_JumpIf(CallAcs("GetNoTarget"), "WithBarrelLookFOrTheplayer")			
			Loop
			
		ThrowBarrel:	
			TNT1 A 0 A_TakeInventory("EnemyMemory", 30)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 48)
			BOBA E 8 A_SpawnItem("BaronHoldingBarrel", 0, 76,0)
			BOBA D 8 A_SpawnItem("BaronHoldingBarrel", 0, 76,0)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 3, 58)
			BARO P 2 A_FaceTarget
			// this fires it even if no target!
//TNT1 A 0 ACS_NamedExecuteWithResult("FBD_LogTargetsClass")			
			// there IS an arch in archery! Aim higher if you throw far.
			TNT1 A 0 A_CustomMissile("BarrelThrowedByBaron", 46, 0, angle, CMF_AIMDIRECTION | CMF_ABSOLUTEANGLE, CallACS("GetPitchToTarget360i", 0, 46, 0, 0) + 0.015 * CallAcs("GetDistanceToTarget", 500))
			BARO Q 4 A_FaceTarget
			BARO R 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, -6, 52)
			TNT1 A 0 A_TakeInventory("ComingToGetTheBarrel", 1)
			TNT1 A 0 A_TakeInventory("HasExplosiveBarrel", 99)
			BOBA A 0 A_ChangeFlag("NOPAIN", 0)
			Goto See2
		
		WithBarrelLookFOrTheplayer:
			BOBA D 2 A_LookEx(LOF_NOSOUNDCHECK,0,1000,0,360.0,"ThrowBarrel")
			Goto WaitingToThrow
		
		
		Pain:
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "CurbstompMarine")
			BARO H 3 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, -4, 61)
			BARO H 3 A_Pain
			Goto See2
		
		
		Pain.Argent: //***Che // inflicted by ghost souls spammed by super archviles
			TNT1 A 0
			
			//TNT1 A 0 A_ClearTarget
			TNT1 A 0 A_GiveInventory("Enraged", 1)
			TNT1 A 0 A_Pain
			TNT1 A 0 HealThing(200,2000)
			
			TNT1 A 0 A_ChangeFlag("MISSILEMORE", 1)
			TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 1)			
			
			TNT1 A 0 ACS_NamedExecuteWithResult("DisplayArgentDischarge", 20, 60, 0)
			
			BARO H 3 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, -4, 61)
			BARO HH 8 A_Pain
			Goto SpecialAttack // results in furious spraying in a random direction if target is out of sight			
		Pain.Head:
		Pain.HeadPlasma:
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "CurbstompMarine")
			BARO H 3 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, -4, 61)
			BARO H 3 A_Pain
			TNT1 A 0 A_JumpIfInventory ("Headache", 15, "Dodge") //received 300 headshot damage
			Goto See2
		Pain.Decaptate: // head hit with chainsaw or axe	
		Pain.HeadStun: //headshot inflicted > 250 damage && advanced headshot profile chosen in settings
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("Enraged", 1, "Dodge")
			TNT1 A 0 A_JumpIfInventory ("Headache", 15, "Dodge") //received 300 headshot damage
			TNT1 A 0 A_CustomMissile ("MuchBlood2Green", 75, -5, random(0,360), CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (-90, 90))
			
			TNT1 A 0 A_SetUserVar("user_bleeding_angle", random(-110, 110))
			BARO H 3 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, -4, 61)
			
			TNT1 A 0 A_ChangeFlag("MISSILEMORE", 1) // permanent escalation
			
			// the first second
			BARO H 0 A_Pain
			BARO HHHHH 3 A_CustomMissile ("Green_LiquidBlood2", 75, -5, angle + user_bleeding_angle + random (-15, 15), CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (15, 55))
			BARO H 0 A_Pain
			BARO HHHHH 3 A_CustomMissile ("Green_LiquidBlood2", 75, -5, angle + user_bleeding_angle + random (-15, 15), CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (15, 55))
			
			TNT1 A 0 A_Jump(96, "SpecialAttack")
			
			// the second second
			BARO H 0 A_Pain
			BARO HHH 6 A_CustomMissile ("Green_LiquidBlood2", 75, -5, angle + user_bleeding_angle + random (-45, 45), CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (15, 55))
			BARO H 3 A_Pain
			BARO HHH 6 A_CustomMissile ("Green_LiquidBlood2", 75, -5, angle + user_bleeding_angle + random (-45, 45), CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (15, 55))
			
			TNT1 A 0 A_JumpIfInventory("Enraged", 1, "SpecialAttack")
			TNT1 A 0 A_Jump(256, "RAGE_NoHeal")
			Goto RAGE_NoHeal // becomes enraged permanently
		
		Pain.Explosive:
		Pain.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			//TNT1 A 0 A_SpawnItemEx("MuchBlood2Green", 0, 0, 60)
			TNT1 A 0 A_CustomMissile ("MuchBlood2Green", 60, 0, random(0,360), CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (-90, 90))
			TNT1 A 0 ThrustThingZ(0,10,0,1)
			Goto Pain
			
		Death:
			BXDE A  0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			BXDE B  0 A_Scream
			BXDE C  0 A_BossDeath
			BXDE D  0 A_NoBlocking
			TNT1 A 0 A_Jump(128, "Death2")
			KSA8 DEFG 6
			TNT1 A 0 A_SpawnItemEx("FBD_DeadBaronClassic",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem ("GreenGrowingBloodPool")
			TNT1 VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV 2 A_CustomMissile ("Green_LiquidBlood", 20, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, scripts runs ownerless
			Stop
			
		Death2:
			BADD ABCD 6
			TNT1 A 0 A_SpawnItemEx("FBD_DeadBaron",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem ("GreenGrowingBloodPool")
			TNT1 VVVVVVVVVVVVVVVVVV 2 A_CustomMissile ("Green_LiquidBlood", 20, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, scripts runs ownerless
			Stop
			
		Death.Electric:				
			TNT1 A 0
			TNT1 A 0 A_SpawnItem("BarrelExplosionSmokeColumn")
			Goto Death				
		
		//***Che: having this state, he enters it if killed via powerful headshot!
		//XDeath:
		//Death.Extreme:
		XDeath.ExplosiveImpact:
		XDeath.FriendlyExplosion:
		Death.Explosive: // direct hit from a rocket
		Death.Bfg10k: //***Che changed damage type from extreme to custom
		XDeath.Desintegrate:
			BXDE A  0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			BXDE B  0 A_Scream
			BXDE C  0 A_BossDeath
			BXDE D  0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("BaronXDeath", 0, 0, random (0, 360), 2, random (0, 160)) // gore spammer
			TNT1 A 0 A_CustomMissile ("XDeathBaronHead5", 62, 0, random (0, 360), 2, random (0, 160))
			BXDE EFGH 0
			
			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.Desintegrate:
		Death.Saw:
			TNT1 A 0
			TNT1 A 0 A_Scream
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_Stop
			TNT1 A 0 A_NoBlocking
			TNT1 AAAAAA 0 A_CustomMissile ("XDeath1Green", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("MuchBloodGreen", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("BaronOfHellHeadExplode", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("Green_FlyingBlood", 15, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath2bGreen", 65, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath3bGreen", 65, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("GreenGuts", 32, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("GenericBaronGib1b", 45, 0, random (0, 360), 2, random (10, 80))
			TNT1 A 0 A_CustomMissile ("GenericBaronGib2b", 45, 0, random (0, 360), 2, random (10, 80))
			BDSS PQRSTU 6
			TNT1 A 0 A_SpawnItem ("GreenGrowingBloodPool")
			TNT1 A 0 A_BossDeath
			TNT1 A 0 A_SpawnItemEx("FBD_DeadBaronBDSSV", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION | SXF_NOCHECKPOSITION)
			TNT1 VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV 1 A_CustomMissile ("Green_LiquidBlood", 20, 0, random (0, 360), 2, random (30, 110))
			//TNT1 V -1
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, scripts runs ownerless
			Stop	
			
/* //***Che: dafug?		
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_ChangeFLag("NOPAIN", 1)
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			TNT1 A 0 A_Recoil(8)
			BARO H 3
			
			BARO H 3 A_Pain
			TNT1 A 0 A_ChangeFLag("NOPAIN", 0)
			Goto See2
*/
		Pain.Kick:
			TNT1 A 0
			TNT1 A 0 A_ChangeFlag("MISSILEMORE", 1)
			TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 1)
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "CurbstompMarine")
			TNT1 A 0 A_JumpIfInventory("StopKickingMyBallsMotherFucker", 1, "Missile")
			TNT1 A 0 A_GiveInventory("StopKickingMyBallsMotherFucker", 1)
			TNT1 A 0 ThrustThingZ(0,15,0,1)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, 4, 47) 
			// strictly speaking, it's *more* than 15 forward but sticking the headboxes origin 
			//  out of the hitboxes' footprint (here, radius 16) is a *bad* idea.
			//  because it then tends to climb walls!

			BNRJ ABCD 5
			TNT1 A 0 A_Pain
			BNRJ ABCD 5
			TNT1 A 0 A_Pain
			BNRJ ABCD 5
			Goto Missile
			
		//***Che
		Death.FriendlyExplosion:
		Death.ExplosiveImpact:
			TNT1 A 0
			TNT1 A 0 A_JumpIfHealthLower(-150, "XDeath.ExplosiveImpact")
			TNT1 A 0 A_Jump(25, "Death.Minigun")
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 ThrustThingZ(0,35,0,1)
			TNT1 A 0 A_BossDeath
			TNT1 A 0 A_CustomMissile ("XDeathHellKnightLeg", 32, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAAAA 0 A_CustomMissile ("XDeath1Green", 62, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("Muchblood2green", 62, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_Jump(256, "Death.ExplosiveImpact1", "Death.ExplosiveImpact2")
		
		Death.ExplosiveImpact1:	
			BOH3 A  8 A_Scream
			BOH3 B  8 A_NoBlocking
			BOH3 CCCCCC  8 A_CheckFloor("Land1")
			Goto Land1
		
		Land1:
			BOH3 D 1
			TNT1 A 0 A_SpawnItemEx("FBD_DeadBaronBOH3D", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION | SXF_NOCHECKPOSITION)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without a *large* margin scripts run ownerless
			Stop
		
		Death.ExplosiveImpact2:	
			BOH3 E  8 A_Scream
			
			BOH3 F  8 A_NoBlocking
			TNT1 A 0 A_BossDeath
			BOH3 GGGGGG  8 A_CheckFloor("Land2")
			Goto Land2
		
		
		Land2:
			BOH3 H 1
			TNT1 A 0 A_SpawnItemEx("FBD_DeadBaronBOH3H", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION |SXF_NOCHECKPOSITION)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without a *large* margin scripts run ownerless
			Stop

		Death.Cut:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_BossDeath
			TNT1 AA 0 A_CustomMissile ("MuchBlood2Green", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("GreenGuts", 32, 0, random (0, 360), 2, random (0, 160))
			//TNT1 A 0 A_CustomMissile ("XDeathHalfBOH", 32, 0, random (0, 360), 2, random (0, 160))
			NULL A 0 A_SpawnItemEx("FBD_DeadBaronHalfUp", 0, 0, 35, -3.0, 0.1 * random(-10, 10), 2.0, 0, SXF_NOCHECKPOSITION)
			BBO2 AABCD 10
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadBaronHalfDown", 0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			//TNT1 A 0 A_JumpIfInTargetInventory("IAmSfestMonster", 1, "SlaughterBleedOut")
			TNT1 A 0 A_JumpIf(!CallAcs("FBD_RequestExpensiveSfx", 70), "SlaughterBleedOut") 
			TNT1 A 0 A_SpawnItem ("GreenGrowingBloodPool")
			TNT1 VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV 1 A_CustomMissile ("Green_LiquidBlood", 20, 0, random (0, 360), 2, random (30, 110))
			//***Che: the bottom half spawned above handles the rezzing
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, scripts runs ownerless
			Stop
		SlaughterBleedOut:
			TNT1 AAAAAAAAAAAAAA 2 A_CustomMissile ("Green_LiquidBlood", 20, 0, random (0, 360), 2, random (30, 110))
			TNT1 AAAAAAA 4 A_CustomMissile ("Green_LiquidBlood", 20, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, scripts runs ownerless
			Stop

		Death.SniperBullet:
		Death.Bullet792:
		Death.Minigun:
		Death.SSG:
		Death.Railgun:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")			
			TNT1 A 0 A_CustomMissile ("Xdeath3bGreen", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("MuchBloodGreen", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_Jump(128, "Death.Desintegrate")
			TNT1 A 0
			KSA8 A 8
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_BossDeath			
			//TNT1 A 0 A_SpawnItem("DyingBaron1")
			TNT1 A 0 A_SpawnItemEx ("DyingBaron1",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0) // he is solid now
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, scripts runs ownerless
			Stop
			
			
		
		Death.Shotgun: // shotgun and ssg pellets
		Death.SSG: // ssg blast emulation (the central hitscan limited to 300 map units)
			TNT1 A 0
			TNT1 A 0 A_BossDeath
			TNT1 A 0 
			TNT1 A 0 A_JumpIfCloser(300, "Death.Minigun")	
			Goto Death	
			
	
		Death.decaptate:
			TNT1 AAAAA 0 A_CustomMissile ("Xdeath1Green", 62, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))
			TNT1 A 0 A_CustomMissile ("muchblood2green", 62, 0, random (0, 360), 2, random (0, 160))//A_SpawnItem("MuchBlood2Green", 0, 62)
			TNT1 A 0 A_CustomMissile ("XDeathBaronHead5", 62, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			BADH A 9
			BADH B 9
			BADH C 9 A_BossDeath
			BADH D 9 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadBaronNoHead", 0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_JumpIf(!CallAcs("FBD_RequestExpensiveSfx", 70), "SlaughterBleedOut")
			TNT1 A 0 A_SpawnItem ("GreenGrowingBloodPool")
			TNT1 VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV 1 A_CustomMissile ("Green_LiquidBlood", 20, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, scripts runs ownerless
			Stop

		Death.Fatality:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_Pain
			TNT1 A 0 A_JumpIfIntargetInventory("FistsSelected", 1, 1)
			Goto Death.DHFT
			TNT1 A 0 A_JumpIfIntargetInventory("IsPlayer", 1, 1)
			Goto Death.DHFT
			TNT1 A 0 A_FaceTarget
			//TNT1 AAA 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 A_GiveToTarget("GoFatality", 1)
			TNT1 A 0 A_GiveToTarget("BaronFatality", 1)
			TNT1 A 1 A_NoBlocking
			TNT1 A 0 A_BossDeath
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 15, 15, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			// fatalized monsters do not respawn
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, scripts runs ownerless
			Stop
			
		Death.SuperPlasma:
		Death.Plasma: 
		Death.Plasma2:
		XDeath.Electric:
			TNT1 A 0 A_Stop
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_BossDeath
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 AAAA 0 A_CustomMissile ("BluePlasmaFireNonStatic", 42, 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))
			TNT1 AAAAA 0 A_CustomMissile ("PlasmaParticleX", 48, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("BigPlasmaParticleX", 42, 0, random (0, 360), 2, random (0, 360))
			BOSC ABC 7
			TNT1 AAAAA 0 A_CustomMissile ("PlasmaParticleX", 48, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("BigPlasmaParticleX", 42, 0, random (0, 360), 2, random (0, 360))
			BOSC DEF 7
			TNT1 A 0 A_SpawnItem ("GreenGrowingBloodPool")
			
			BOSB E -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.GreenFire: // bruiser missile
			TNT1 A 0 A_Stop
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_BossDeath
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 AAAA 0 A_CustomMissile ("BluePlasmaFireNonStatic", 42, 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))
			TNT1 AAAAA 0 A_CustomMissile ("PlasmaParticleX", 48, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("BigPlasmaParticleX", 42, 0, random (0, 360), 2, random (0, 360))
			BOSC AABBCC 4 A_CustomMissile ("GreenFlameTrailsbIG", 48, random (-10, 10), random (0, 180), 2, random (20, 90))
			TNT1 AAAAA 0 A_CustomMissile ("PlasmaParticleX", 48, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("BigPlasmaParticleX", 42, 0, random (0, 360), 2, random (0, 360))
			BOSC DDEEFF 4 A_CustomMissile ("GreenFlameTrailsbIG", 8, random (-10, 10), random (0, 180), 2, random (20, 90))
			TNT1 A 0 A_SpawnItem ("GreenGrowingBloodPool")
			
			BOSB EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 4 A_CustomMissile ("GreenFlameTrailsbIG", 8, random (-10, 10), random (0, 180), 2, random (20, 90))
			
			BOSB E -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
			
		
		//***Che: other nobles' melee attacks (now possible in FBD)
		Death.HKFT:
		Death.BHFT:
		Death.DHFT:
		Death.CCFT:
			TNT1 A 0
			TNT1 A 0 A_Jump(224, "Death.SSG", "Death.Cut", "Death.Decaptate")
			Goto Death.ExplosiveImpact
			
		Death.Fire:
		Death.Flames: //***Che he was missing this
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_BossDeath
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			BOSB AAAA 2 A_CustomMissile ("FlameTrails", 45, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))
			BOSB BBBB 2 A_CustomMissile ("FlameTrails", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))
			BOSB CCCC 2 A_CustomMissile ("FlameTrails", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))
			BOSB DDDD 2 A_CustomMissile ("FlameTrails", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))
			TNT1 A 0 A_Playsound("props/redfire")
			BOSB EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 2 A_CustomMissile ("FlameTrails", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))
			//***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)
			//BOSB EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 10 A_CustomMissile ("SmallSmoke", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (70, 110))
			
			BOSB E -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.KillMe:
		Pain.Taunt:
			TNT1 A 0
			TNT1 A 0 HealThing(1)
			TNT1 A 0 A_JumpIfInventory("Enraged", 1, "Missile")
			Goto RAGE
			
		Death.KillMe:
		Death.Taunt:
			//TNT1 A 0 A_ChangeFlag("SOLID", 0)
			//TNT1 A 0 A_SpawnItem("BaronOfHell")
			//Stop
			//***Che: NOT spawning a fully healty replacement, with losing tid and special 
			// without triggering the special on death.
			// TRAVESTY!
			// Instead, raging then falling dead from a heart attack
		
		Death.CallingTheBaronAFaggot:
		Death.Avoid:
			TNT1 A 0 
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 A_PlaySound("baron/sight", CHAN_VOICE)
			BTS3 ABC 2 
			BTS3 DEDFDEDF 3 A_CustomMissile ("Green_Blood", 35, 0, random (0, 360), 2, random (0, 160))
			BTS3 CBA 2
			Goto Death
			
		Death.Ice:
		Death.Freeze:
		Death.Frost:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_BossDeath
			//TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			//TNT1 A 0 A_ChangeFlag("SOLID", 0)
			//TNT1 A 0 A_SpawnItem("FrozenBaronOfHell")
			TNT1 A 0 A_NoBlocking // in my version, freeze death is permanent
			TNT1 A 0 A_SpawnItemEx ("FrozenBaronOfHell",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without a *large* margin scripts run ownerless
			Stop
			
		Death.IOS_Frost: // EDAY final boss
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_BossDeath
			TNT1 A 0 A_NoBlocking 
			TNT1 A 0 A_SpawnItemEx ("PermafrostBaronOfHell",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without a *large* margin scripts run ownerless
			Stop			
		
		Death.Massacre:
			Goto Death
		
		Death.Stomp:
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_BossDeath
			BARO JKL 2
			TNT1 AAA 0 bright A_CustomMissile ("GreenSuperGoreSpawner", 5, 0, random (0, 360), 2, random (30, 180))
			TNT1 AAAA 0 bright A_CustomMissile ("XDeath1Green", 5, 0, random (0, 360), 2, random (30, 180))
			TNT1 AA 0 bright A_CustomMissile ("XDeath2bGreen", 55, 0, random (0, 360), 2, random (30, 180))
			TNT1 AA 0 bright A_CustomMissile ("XDeath3bGreen", 55, 0, random (0, 360), 2, random (30, 180))
			TNT1 A 0 A_SpawnItem ("GreenGrowingBloodPool")
			TNT1 A 1
			TNT1 A 1 A_XScream
			GIBS Z 1
			GIBS Z -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 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 AAAA 0 A_SpawnItemEx ("BodyRemovalThing",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 1 A_XScream
			TNT1 A 30 A_ChangeFlag("SHOOTABLE", 0) // give the script time to run
			Stop
			
		CurbstompMarine:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			KNTF A 15
			TNT1 AAAA 0 A_CustomMissile ("XDeath2b", 25, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3b", 25, 0, random (0, 360), 2, random (0, 160))
			 
			KNTF BCD 8 A_CustomMissile ("XDeath1", 50, 0, random (0, 360), 2, random (0, 160))
			EXPL A 0 Radius_Quake (2, 24, 0, 15, 0)
			
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 50, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("mUCHbLOOD3", 50, 0, random (0, 360), 2, random (0, 160))
			KNTF DDDDDDDDDDDDDDDDDDDDDD 3 A_CustomMissile ("Brutal_LiquidBlood3", 25, 0, random (0, 360), 2, random (0, 40))
			TNT1 A 0 A_CustomMissile ("RipGuts", 20, 0, random (0, 360), 2, random (0, 160))
			KNTF EEEFFFGGG 4 A_CustomMissile ("XDeath1", 38, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("RipGuts", 20, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			KNTF GGGGGGGGGGGGGGGGGGGGGG 3 A_CustomMissile ("Brutal_LiquidBlood3", 25, 0, random (0, 360), 2, random (0, 40))
			TNT1 A 0 A_TakeInventory("Curbstomp_Marine",1)
			
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			TNT1 A 0 A_SpawnItemEx ("RappedMarine", 1,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0) // no slaughter optimizations for fatalized players, NOR for monsters fatalized by player
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 57, 1) // force create
			Goto See2


		FatalityZombieman:
			TNT1 A 0
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			3HF1 A 20
			TNT1 A 0 A_PlaySound("grunt/death", CHAN_WEAPON)
			3HF1 BC 5
			TNT1 AA 0 A_CustomMissile ("XDeath1", 55, 0, random (0, 360), 2, random (0, 160))
			3HF1 BCBC 5 A_CustomMissile ("XDeath1", 55, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("MuchBlood", 55, 0, random (0, 360), 2, random (0, 160))
			3HF1 D 10
			3HF1 E 5
			 TNT1 A 0 A_CustomMissile ("XDeathZombieManHead", 65, 0, random (0, 360), CMF_AIMDIRECTION, random (70, 120))
			3HF1 F 30
			3HF1 G 10
			 
			TNT1 A 0 A_TakeInventory("ZombieManFatality",1)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			
			
			3HF1 H 8 A_Chase // can jump to Idle!
		ThrowZombieman:	
			BARO E 8 A_FaceTarget
			
			BARO F 8 A_CustomMissile("FBD_ThrowedZombieMan2", 64, 0, 0, 0) 
			
			BARO G 8
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 57, 1) // force create
			Goto See2
			
		FatalitySergeant:
			TNT1 A 0
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			3HF1 I 15
			TNT1 A 0 A_PlaySound("grunt/death", CHAN_WEAPON)
			3HF1 I 5

			TNT1 AAAA 0 A_CustomMissile ("GreenGuts", 30, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 45, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeath2", 45, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeath3", 55, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_SpawnItem("SergeantFatalizedByBaron")

			3HF1 J 10

			3HF1 KLM 15
			 
			TNT1 A 0 A_TakeInventory("SergeantFatality",1)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			
			
			3HF1 M 1 A_Chase // can jump to Idle!
		ThrowSergeant:	
			BARO E 8 A_FaceTarget
			
			BARO F 8 A_CustomMissile("FBD_FBD_ThrowedSergeantPiece", 64, 0, 0, 0) 
			
			BARO G 8
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 57, 1)
			Goto See2


		FatalityDemon:
			TNT1 A 0
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_PlaySound("demon/pain", CHAN_WEAPON)
			3HF1 N 20
		   
		   TNT1 A 0 A_CustomMissile ("XDeathStomach", 60, 0, random (0, 360), 2, random (0, 160))
		   TNT1 AAA 0 A_CustomMissile ("XDeath1", 45, 0, random (0, 360), 2, random (0, 160))
		   TNT1 AAA 0 A_CustomMissile ("XDeath2", 45, 0, random (0, 360), 2, random (0, 160))
		   TNT1 AAA 0 A_CustomMissile ("XDeath3", 55, 0, random (0, 360), 2, random (0, 160))
	 
		   3HF1 OPQQQ 10 A_CustomMissile ("MuchBlood", 25, 0, random (0, 360), 2, random (0, 160))
		   
			TNT1 A 0 A_SpawnItem ("DeadDemonHalf", 1)
			TNT1 A 0 A_SpawnItem ("GreenGrowingBloodPool")
			 
			TNT1 A 0 A_TakeInventory("DemonFatality",1)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 57, 1)
			Goto See2
			
			
		FatalityImp:
			TNT1 A 0
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_PlaySound("demon/pain", CHAN_WEAPON)
			3HF2 ABABAB 4

			TNT1 AAAAAA 0 A_CustomMissile ("MuchBlood", 40, 0, random (0, 360), 2, random (0, 160)) //A_SpawnItem("MuchBlood", 40)
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 45, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath2", 45, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath3", 55, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("GreenGuts", 42, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			3HF2 CDE 6

			// wtf is this?
			//3HF2 F 1 A_Chase("","")
			
			3HF2 FFF 15
			3HF2 GGHHIJ 3
			TNT1 A 0 A_SpawnItem("FBD_DeadImp_BaronFatality")
			TNT1 A 0 A_TakeInventory("ImpFatality3",1)
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 57, 1)
			Goto See2
			
		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)
			Goto WaitTargetsFatalityOut // has no specific animation, just roar and wander once			
			
		// melee, return to melee
		LTGCheckMExtreme:
			TNT1 A 0 A_JumpIfInTargetInventory("LTGExtreme", 1, 1)
			Goto MeleeContinueAfterLTGCheck
			TNT1 A 0 A_Jump(64, "LTGCheckMB")
			Goto MeleeContinueAfterLTGCheck
		LTGCheckM:
			TNT1 A 0 A_JumpIfInTargetInventory("IsDressed", 1, "LTGCheckMExtreme")
		LTGCheckMB:
			TNT1 A 0 A_JumpIfInventory("AlreadyPerformedLTGCatCall", 1, "MeleeContinueAfterLTGCheck")
			TNT1 A 0 A_GiveInventory("AlreadyPerformedLTGCatCall", 1)			
			Goto WaitTargetsFatalityOut
	}
}


Actor BaronRaisedByVile: FBD_Baron {
	// a separate actor in case the raising fails due to insufficient space.
	States {
		Spawn:
			BARO B 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 2) // noble headbox
			
			//TNT1 A 0 A_SetUserVar("user_head_type", 2) // noble headbox
			TNT1 A 0 A_GiveInventory("TargetIsABaronOfHell")
			TNT1 A 0 A_GiveInventory("TargetIsABruiser")			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			//BOSS O 8
			//BOSS NMLKJI 8 //also serves as slaughter pre init delay
			KSA8 FEDCBA 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 BaronOfHell2_PP: FBD_Baron
{
	States
	{
		PotPourriSwap:
			TNT1 A 0
			Goto PotPourriCancel		
	}
}	

Actor FBD_DeadBaron: FBD_CurbstompedMarine
{
    Radius 16 //***Che otherwise raising failures //12
    Height 12
    Scale 1.2
    +SHOOTABLE
    +NOTELEPORT
    +MOVEWITHSECTOR
    +CORPSE
	-SOLID
	+THRUACTORS
	damagefactor "Crusher", 50.0
    Mass 1000
    Health 200
    damagefactor "Blood", 0.0
    damagefactor "Trample", 0.0
	BloodType "Green_Blood", "GreenFBD_SawBlood", "GreenFBD_SawBlood"
	BloodColor "DarkGreen"
	translation "168:191=112:127", "16:47=123:127"
	States
		{
		//***Che
		Raise:
			// note: the frame letter of the "----" sprite is ignored, using A for convenience
			"----" 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", 2004), "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 ("BaronRaisedByVile",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, 4, 0, 0) //"BaronRaisedByVile"
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2004) // 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
			BADD 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
			BADD F 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			
			//***Che: prevent the game engine from auto-respawning this 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)
			BADD F -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		LandOnLava: // method not used by this class but by descendant half-corpses
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			TNT1 A 0 A_SpawnItemEx ("CharredMeatsplosionGreen",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 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)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	 
		Death.Plasma: 
		Death.Plasma2:
		Death.Electric:
		Death.Flames:
		Death.Burn:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			EXPL AAAAA 0 A_CustomMissile ("ExplosionSmoke", 32, 0, random (0, 360), 2| CMF_TRACKOWNER, random (0, 360))
			
			//***Che: A and B are him standig upright. This is a *corpse*! He cannot just stand up to fall back down charred!
			//BOSB ABCDE 9 A_CustomMissile ("PlasmaSmoke", 24, 0, random (0, 180), 2, random (0, 180))
			BOSB CDEEE 9 A_CustomMissile ("PlasmaSmoke", 24, 0, random (0, 180), 2, random (0, 180))
			BOSB EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 8 A_CustomMissile ("PlasmaSmoke", 16, 0, random (0, 180), 2, random (0, 180))
			
			//***Che: prevent the game engine from auto-respawning this 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)
			BOSB E -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop
			
		Death:
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("XDeath1Green", 25, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath2bGreen", 25, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath3bGreen", 25, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("muchblood2green", 25, 0, random (0, 360), 2, random (0, 160))//A_SpawnItem("MuchBlood2Green", 0, 25)
			TNT1 A 0 A_CustomMissile ("muchblood3green", 25, 0, random (0, 360), 2, random (0, 160))//A_SpawnItem("MuchBlood2Green", 0, 25)
			TNT1 AAAAAA 0 A_CustomMissile ("Xdeath1Green", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("Green_FlyingBlood", 15, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("GreenGuts", 16, 0, random (0, 360), 2, random (0, 160))
			//TNT1 A 0 A_CustomMissile ("XDeathHalfBOH", 16, 0, random (0, 360), 2, random (0, 160))
			NULL A 0 A_SpawnItemEx("FBD_DeadBaronHalfUp", 0, 0, 20, -3.0, 0.1 * random(-10, 10), 2.0, 0, SXF_NOCHECKPOSITION)
			TNT1 AA 0 A_CustomMissile ("XDeathHellKnightLeg", 5, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathOrgan1Green", 15, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathOrgan2Green", 15, 0, random (0, 360), 2, random (0, 160))
			
			//***Che: prevent the game engine from auto-respawning this 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)		
			// dead baron half up is not respawnable, it's legs that should do the respawning
			Stop	
			 
			 
		Death.CrushedBodies:
			TNT1 A 0 A_SetAngle(0)
			TNT1 A 0 bright A_CustomMissile ("GreenSuperGoreSpawner", 1, -40, random (0, 360), 2, random (25, 45))
			TNT1 A 0 bright A_CustomMissile ("GreenSuperGoreSpawner", 1, 40, random (0, 360), 2, random (25, 45))
			TNT1 A 0 A_CustomMissile ("XDeath1Green", 1, random (-30, 30), random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath2bGreen", 1, random (-30, 30), random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath3bGreen", 1, random (-30, 30), random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("GreenBloodMistBig", 1, -40, random (0, 360), 2, random (30, 90))
			TNT1 AA 0 A_CustomMissile ("GreenBloodMistBig", 1, 40, random (0, 360), 2, random (30, 90))
			TNT1 A 0 A_SetAngle(90)
			TNT1 A 0 bright A_CustomMissile ("GreenSuperGoreSpawner", 1, -40, random (0, 360), 2, random (25, 45))
			TNT1 A 0 bright A_CustomMissile ("GreenSuperGoreSpawner", 1, 40, random (0, 360), 2, random (25, 45))
			TNT1 A 0 A_CustomMissile ("XDeath1Green", 1, random (-30, 30), random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath2bGreen", 1, random (-30, 30), random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath3bGreen", 1, random (-30, 30), random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("GreenBloodMistBig", 1, -40, random (0, 360), 2, random (30, 90))
			TNT1 AA 0 A_CustomMissile ("GreenBloodMistBig", 1, 40, random (0, 360), 2, random (30, 90))
			TNT1 A 0 A_NoBlocking
			GIBS Y 1
			
			//***Che: prevent the game engine from auto-respawning this 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)
			GIBS Y -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop
		OnRezSfx:
			// knight, baron, duke, belphegor and cacodemon corpses must replace this method with one that has appropriate blood color
			TNT1 AAA 3 A_CustomMissile ("GreenBloodMistBig", 20, 0, random (0, 360), 2, random (30, 90))
			TNT1 AAAA 3 A_CustomMissile ("GreenBloodMist", 20, 0, random (0, 360), 2, random (30, 90))
			TNT1 AAAAA 3 A_CustomMissile ("GreenBloodMistSmall", 20, 0, random (0, 360), 2, random (30, 90))
			TNT1 A 30
			Stop			
	}
}	



Actor FBD_DeadBaronHalfDown: FBD_DeadBaron
{
	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
			BBO2 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
			BBO2 D 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			
			//***Che: prevent the game engine from auto-respawning this 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)
			BBO2 D -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop

		Death:
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("XDeath1Green", 25, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath2bGreen", 25, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath3bGreen", 25, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("MuchBlood2Green", 25, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("MuchBlood3Green", 25, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathHellKnightLeg", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			//***Che: prevent the game engine from auto-respawning this 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 FBD_DeadBaronHalfUp: FBD_DeadBaron
{
	+THRUACTORS
	-SOLID
	+GHOST
	-CORPSE
	States{
		Raise:
			Stop
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
			BTO2 AAABBB 4 NODELAY A_CustomMissile("Green_Blood",0,0,180,2) // moved here from XDeathHalfBOH
			
			TNT1 A 0 A_PlaySound("misc/xdeath1", CHAN_VOICE)
			TNT1 A 0 A_ChangeFlag("THRUACTORS", 0)
			TNT1 A 0 A_ChangeFlag("SOLID", 1)
			TNT1 A 0 A_ChangeFlag("GHOST", 0)
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			BTO2 B 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
			BTO2 C 6
			BTO2 D 24
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			// the top half is not rezzable
			BTO2 D -1	
			Stop
		Death:
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("XDeath1Green", 5, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath2bGreen", 25, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath3bGreen", 25, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("MuchBlood2Green", 25, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("MuchBlood3Green", 25, 0, random (0, 360), 2, random (0, 160))
			//TNT1 A 0 A_SpawnItem("MuchBlood2Green", 0, 25)
			//TNT1 A 0 A_SpawnItem("MuchBlood3Green", 0, 25)
			TNT1 A 0 A_CustomMissile ("XDeathBaronHead5", 5, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBaronOfHellTorso", 5, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("Xdeath1Green", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 30
			// the top half is not rezzable
			Stop
	}
}

Actor FBD_DeadBaronNoHead: FBD_DeadBaron
{
	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
			BADH 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
			BADH D 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			
			//***Che: prevent the game engine from auto-respawning this 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)
			BADH D -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop
		Death:
			TNT1 A 0 A_CustomMissile ("XDeathBaronOfHellTorso", 2, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathHellKnightLeg", 2, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathOrgan1Green", 4, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathOrgan2Green", 4, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1Green", 12, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath2Green", 12, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("GreenGuts", 16, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath3Green", 12, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath4Green", 12, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2bGreen", 15, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3bGreen", 15, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("GenericBaronGib1b", 25, 0, random (0, 360), 2, random (10, 80))
			TNT1 A 0 A_CustomMissile ("GenericBaronGib2b", 25, 0, random (0, 360), 2, random (10, 80))
			
			//***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 FBD_DeadBaronBOH3D : FBD_DeadBaron
{
	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
			BOH3 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
			BOH3 D 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			
			//***Che: prevent the game engine from auto-respawning this 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)
			BOH3 D -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)	
			Stop
		Death:
			TNT1 A 0 A_CustomMissile ("XDeathHellKnightLeg", 2, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathOrgan1Green", 4, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathOrgan2Green", 4, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1Green", 12, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath2Green", 12, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath3Green", 12, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath4Green", 12, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2bGreen", 15, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3bGreen", 15, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("GenericBaronGib1b", 25, 0, random (0, 360), 2, random (10, 80))
			TNT1 A 0 A_CustomMissile ("GenericBaronGib2b", 25, 0, random (0, 360), 2, random (10, 80))
			TNT1 A 0 A_CustomMissile ("GenericBaronGib1", 25, 0, random (0, 360), 2, random (10, 80))
			TNT1 A 0 A_CustomMissile ("GenericBaronGib2", 25, 0, random (0, 360), 2, random (10, 80))
			TNT1 A 0 A_CustomMissile ("XDeathBaronHead5", 5, 0, random (0, 360), 2, random (10, 80))
			TNT1 AAAA 0 A_CustomMissile ("GreenGuts", 16, 0, random (0, 360), 2, random (0, 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 FBD_DeadBaronBOH3H : FBD_DeadBaronBOH3D
{
	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
			BOH3 H 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
			BOH3 H 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			
			//***Che: prevent the game engine from auto-respawning this 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)
			BOH3 H -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)	
			Stop			
	}
}


Actor FBD_DeadBaronBDSSV : FBD_DeadBaron
{
	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
			BDSS V 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
			BDSS V 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			//***Che: prevent the game engine from auto-respawning this 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)
			BDSS V -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)	
			Stop

			
		Death:
			TNT1 AA 0 A_CustomMissile ("XDeathHellKnightLeg", 2, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathOrgan1Green", 4, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathOrgan2Green", 4, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1Green", 12, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath2Green", 12, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath3Green", 12, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath4Green", 12, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2bGreen", 15, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3bGreen", 15, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("GenericBaronGib1b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 80))
			TNT1 A 0 A_CustomMissile ("GenericBaronGib2b", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 80))
			TNT1 A 0 A_CustomMissile ("GenericBaronGib1", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 80))
			TNT1 A 0 A_CustomMissile ("GenericBaronGib2", 25, 0, random (0, 360), 2, random (10, 80))
			TNT1 AAAA 0 A_CustomMissile ("GreenGuts", 16, 0, random (0, 360), 2, random (0, 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 FBD_DeadBaronClassic: FBD_DeadBaron
{
	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
			KSA8 G 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
			KSA8 G 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			//***Che: prevent the game engine from auto-respawning this 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)
			KSA8 G -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)	
			Stop
		LandOnLava:
			KSA8 GGGGGGGG 10 A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_SpawnItemEx("GoreLandingOnLava", random(-14, 14), random(-14, 14))
			TNT1 A 0 A_NoBlocking
			// charred classic dead bruiser
			//***Che: prevent the game engine from auto-respawning this 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)
			BOSB D -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)	
			Stop
	}
}

/*
//***Che: Wtf is this mistake
ACTOR  : FBD_DeadBaron
{
    Radius 1
    Height 8
    Speed 10
	Mass 8
	BounceFactor 0.3
	+DOOMBOUNCE
    +NOBLOCKMAP
	+MISSILE
    +NOTELEPORT
    +DONTSPLASH
    +MOVEWITHSECTOR
	
    DeathSound "misc/xdeath1"
    States
    {
		Spawn:
			Goto Death
		Death:
			BTO2 AABBCC 4 A_CustomMissile("Green_Blood",0,0,180,2)
			HPLA A 0 A_SpawnItemEx("FBD_DeadBaronHalfUp",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION | SXF_TRANSFERTRANSLATION,0)
			Stop
    }
}
*/
	
	
ACTOR DyingBaron1
{
	Game Doom
	
	var int user_head_tid;
	var int user_head_type; // 13, dead noble's headbox
	var int user_item_no;
//	var int user_sleeping;
//	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

	var int user_head_xyzf;
	var int user_head_rel;
	var int user_head_scale;
	
	// required for the head link to work!
	+ISMONSTER
	
	-COUNTKILL
	
	Radius 16
	Height 60
	Health 100
	damagefactor "Blood", 0.0 damagefactor "BlueBlood", 0.0 damagefactor "GreenBlood", 0.0
    damagefactor "Avoid", 0.0
	damagefactor "KillMe", 0.0
	damagefactor "Minigun", 0.6
	BloodType "Green_Blood", "GreenFBD_SawBlood", "GreenFBD_SawBlood"
	BloodColor "DarkGreen"
	Mass 999999
	//-SOLID // headbox monitors this flag for a fall-back despawn on master's death
	//+SOLID
	-SOLID // upgraded headboxes to be smarter
	+SHOOTABLE
	+FLOORCLIP
	+DONTSPLASH
	+NOPAIN
	Scale 1.1
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_PlaySound ("PSXDPN", CHAN_VOICE)
			//TNT1 A 0 A_SetUserVar("user_head_type", 13) // dead noble's headbox, ignores the SOLID and CORPSE flags.
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunMonster", 2) // noble headbox, 100% default scale
			
			KSA8 BC 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 59, 1)
			TNT1 A 0 A_CustomMissile ("Green_LiquidBlood", 35, 0, random (0, 360), 2, random (30, 110))
			KSA8 BC 6
			TNT1 A 0 A_CustomMissile ("Green_LiquidBlood", 35, 0, random (0, 360), 2, random (30, 110))
			
			TNT1 A 0 A_PlaySound ("PSXDPN", CHAN_VOICE)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 59)
			KSA8 BC 6
			TNT1 A 0 A_CustomMissile ("Green_LiquidBlood", 35, 0, random (0, 360), 2, random (30, 110))
			KSA8 BC 6
			TNT1 A 0 A_CustomMissile ("Green_LiquidBlood", 35, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 0 A_PlaySound ("PSXDPN", CHAN_VOICE)
			KSA8 BC 6
			TNT1 A 0 A_CustomMissile ("Green_LiquidBlood", 35, 0, random (0, 360), 2, random (30, 110))
			KSA8 BC 6
			TNT1 A 0 A_CustomMissile ("Green_LiquidBlood", 35, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 0 A_PlaySound ("PSXDPN", CHAN_VOICE)
			KSA8 BC 6
			TNT1 A 0 A_CustomMissile ("Green_LiquidBlood", 35, 0, random (0, 360), 2, random (30, 110))
			KSA8 BC 6
			TNT1 A 0 A_CustomMissile ("Green_LiquidBlood", 35, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 0 A_PlaySound ("PSXDPN", CHAN_VOICE)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 59)
			KSA8 BC 6
			TNT1 A 0 A_CustomMissile ("Green_LiquidBlood", 35, 0, random (0, 360), 2, random (30, 110))
			KSA8 BC 6
			TNT1 A 0 A_CustomMissile ("Green_LiquidBlood", 35, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 0 A_PlaySound ("PSXDPN", CHAN_VOICE)
			KSA8 BC 6
			TNT1 A 0 A_CustomMissile ("Green_LiquidBlood", 35, 0, random (0, 360), 2, random (30, 110))
			KSA8 BC 6
			TNT1 A 0 A_CustomMissile ("Green_LiquidBlood", 35, 0, random (0, 360), 2, random (30, 110))
			TNT1 A 0 A_PlaySound ("PSXDPN", CHAN_VOICE)
			KSA8 BC 6
			TNT1 A 0 A_CustomMissile ("Green_LiquidBlood", 35, 0, random (0, 360), 2, random (30, 110))
			KSA8 BC 6
			TNT1 A 0 A_CustomMissile ("Green_LiquidBlood", 35, 0, random (0, 360), 2, random (30, 110))
			Goto Death
		
		Death:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_Fall
			TNT1 A 0 A_PlaySound("baron/death", CHAN_VOICE)
			KSA8 DEFG 6
			TNT1 A 0 A_SpawnItemEx("FBD_DeadBaronClassic",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem ("GreenGrowingBloodPool")
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without a *large* margin scripts run ownerless
			Stop
		
		XDeath.HeadPlasma:
		Death.HeadPlasma:
			TNT1 A 0
			TNT1 A 0 A_SpawnItem("BaronOfHellHeadExplodePlasma", 0, 62)
			Goto BeheadedContinue
		XDeath.Head:
		XDeath.HeadStun:
		Death.head:
		Death.HeadStun:
			TNT1 A 0
			TNT1 A 0 A_SpawnItem("BaronOfHellHeadExplode", 0, 62)
		BeheadedContinue:	
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 0, 5, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 AA 0 A_CustomMissile ("BaronHeadPiece", 62, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			BADH A 9
			BADH B 9
			BADH C 9 A_BossDeath
			BADH D  9 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadBaronNoHead", 0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem ("GreenGrowingBloodPool")
			//TNT1 A 0 A_SpawnItem ("FBD_DeadBaronHalfDown", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without a *large* margin scripts run ownerless
			Stop
		
		
		XDeath:
		Death.ExplosiveImpact:
			TNT1 A 0
			TNT1 A 0 A_XScream
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 0, 5, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 AAAA 0 A_CustomMissile ("Muchblood2Green", 15, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("BaronXDeath", 0, 0, random (0, 360), 2, random (0, 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.Shotgun:
		Death.SSG:
			TNT1 A 0
			TNT1 A 0 A_JumpIfCloser(200, "Death.Minigun")
			Goto Death
		Death.SniperBullet:
		Death.Bullet792:			
		Death.Minigun:	
			TNT1 A 0
			TNT1 A 0 A_Scream
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_NoBlocking
			TNT1 AAAAAA 0 A_CustomMissile ("Xdeath1Green", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("Xdeath2bGreen", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("Xdeath3bGreen", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("Muchblood2Green", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("GreenGuts", 32, 0, random (0, 360), 2, random (0, 160))
			//TNT1 A 0 A_CustomMissile ("XDeathHalfBOH", 24, 0, random (0, 360), 2, random (0, 160))
			NULL A 0 A_SpawnItemEx("FBD_DeadBaronHalfUp", 0,0,28, -3.0,0.1 * random(-10, 10),2.0, 0, SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			BBO2 AABCD 10
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadBaronHalfDown", 1,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem ("GreenGrowingBloodPool")
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 0, 5, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, scripts runs ownerless
			Stop	
	}
}	


ACTOR BaronAttack: ZandronumBaronBall //BaronBall
{
	Radius 24
	Height 16
	DamageType BHFT
	Projectile 
	+RANDOMIZE
	+FORCEXYBILLBOARD
    +THRUGHOST
	RenderStyle Add
	Alpha 0.6
    Damage 25
    Speed 28
	//HitObituary "$OB_IMPHIT"
	SeeSound "none"
	DeathSound "none"
	Decal "none"
	States
	{
		Spawn:
			TNT1 A 2 BRIGHT
			TNT1 A 2 //A_PlaySound("weapons/gswing")
			Goto Death
		Crash: // hit a non-bleeding actor
		Death: // hit a wall
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("MeleeMiss", 1, AAPTR_TARGET)
			Stop
		XDeath: // hit a bleeding actor
			TNT1 A 0
			TNT1 A 0 A_PlaySound("cheb/noble_melee_hit") // shred sound
			TNT1 A 0 A_GiveInventory("MeleeHitSuccess", 1, AAPTR_TARGET)
			Stop
	}
}

/*
ACTOR BaronAttackOnbarrel: BaronAttack
{
	DamageType BHFTOnBarrel
    Damage 1
}
*/

ACTOR FBD_BaronAttackOnBarrel // always hits
{
	Projectile
	+NOINTERACTION
	+SEEKERMISSILE
	+THRUGHOST
	+THRUACTORS
	DamageType BHFTOnBarrel
    Damage (Random (0,0))
	
	Radius 1
	Height 1
	Speed 0
	States
	{
		Spawn:
			TNT1 A 1 NODELAY A_Warp(AAPTR_TRACER, 0,0,0,0, WARPF_NOCHECKPOSITION, "Success")
			Stop
		Success:
			TNT1 A 1 A_Explode(2, 5)
			Stop
	}
}

// the explosive barrels shoot these at barons

ACTOR CallingTheBaronAFaggot: FastProjectile
{
	+SEEKERMISSILE // to receive the real target (our target's target) in our tracer pointer
	+HITMASTER // to receive someone we hit in our master pointer on hit
	Radius 16
	Height 16
	DamageType None
    +THRUGHOST
    Damage (random (0, 0))
    Speed 250
	SeeSound "none"
	DeathSound "none"
	Decal "none"
	States
	{
		Spawn:
			TNT1 A 1
			Stop
		Death: // hit map geometry
			TNT1 A 1
			Stop
		Crash: // hit a non-bleeding actor
			TNT1 A 1
			Stop
		XDeath: // hit a bleeding actor
			TNT1 A 1 A_JumpIf(IsPointerEqual(AAPTR_TRACER, AAPTR_MASTER), "Success")
			Stop
		Success:
			// We got the barrel in our target pointer and the baron in out master pointer.
			// Now just to play a matchmaker for these two...
			TNT1 A 1 ACS_NamedExecuteWithResult("FBD_CallingTheBaronAFaggot")
			TNT1 A 30
			Stop
	}
}

/* original BD version for reference
ACTOR CallingTheBaronAFaggot: ZandronumBaronBall //BaronBall
{
	Radius 4
	Height 4
	DamageType CallingTheBaronAFaggot
	Projectile 
	+RANDOMIZE
	+FORCEXYBILLBOARD
    +THRUGHOST
	RenderStyle Add
	Alpha 0.6
    Damage (random (2, 3))
    Speed 32
	SeeSound "none"
	DeathSound "none"
	Decal "none"
	States
	{
		Spawn:
			TNT1 A 6
			Goto Death
		Death:
			TNT1 A 0 BRIGHT
			Stop
	}
}
*/

ACTOR ThrowedBarrel //***Che moved from Melee.txt
{
	Radius 6
	Height 8
	Speed 32
    Fastspeed 32
	Damage 55
	
	//***Che
	//+MISSILE
	Projectile
	-NOGRAVITY
	
	Gravity 0.6
    Scale 1.0
	+FORCEXYBILLBOARD
	DamageType Explosive
	Alpha 1
	DeathSound "Explosion"
	States
	{
		Spawn:
			TBRA A 2
			Loop
			
		Death:
			TNT1 A 0 A_AlertMonsters
			TNT1 A 0 A_SpawnItemEx ("BarrelExplosion",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItemEx ("BarrelKaboom",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 AAAAAAA 0 A_CustomMissile ("ExplosionFlames", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 180))
			TNT1 AAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 180), 2, random (0, 180))
			EXPL A 0 Radius_Quake (2, 24, 0, 15, 0)
			BEXP B 0 BRIGHT A_Scream
			
			//TNT1 AAAAAAA 0 A_CustomMissile ("BarrelParticle", 35, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_PlaySound("FAREXPL", 3)
//KYDB G 0 A_Stop
//KYDB G 90 A_ChangeFlag("NOGRAVITY", 1)
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 4 A_CustomMissile ("ExplosionSmoke", 1, 0, random (0, 360), 2, random (50, 130))
			Stop
		}
}


ACTOR BarrelThrowedByBaron: ThrowedBarrel
{
	Species "Bruisers" // without this, barrel thrown by baron explodes against baron's head	
	+THRUSPECIES // Is cleared after a few tics.
	
	States
	{
		Spawn:
			TBRA A 6
			TNT1 A 0 A_ChangeFlag("THRUSPECIES", 0)
		Fly:	
			TBRA A 2
			Loop	
	}
}




//***Che: I *so* wanted to replace them with my duke of hell :(...
//  Alas, duke has height of 94 while their cubby holes in their E1M8 have height of 88.
// heads would not fit anyway.


// STUB!!! Replace with downscaled Dukes ASAP!

Actor FBD_BaronBoss1: FBD_Baron //BaronofHell2 
{
	//Scale 1.3 //***Che Nuh-huh: headshot dissonance, bro!
	Health 4000
	Speed 12
	PainChance "Head", 70
	PainChance 10
	MaxStepHeight 48
	MaxDropOffHeight 48
	+LOOKALLAROUND
	Translation "16:47=22:47", "48:79=62:79" // a bit darker
	Obituary "%o was brutalized by the Bruiser Brothers."
	States
	{
		Spawn:
			// headboxes won't work without slaughtermap init
			BARO A 1 NODELAY ACS_NamedExecuteWithResult("FBDRunMonster", 2)
			//TNT1 A 0 A_SetUserVar("user_head_type", 2) // noble headbox
			//BARO A 7
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 57, 1) // force create
		LayInWait:	
			TNT1 A 0 A_CheckSight("WAITING")
			TNT1 A 0 ACS_EXecuteAlways(1622) // displays boss title and health until both are dead
				// (see BOSSHEALTH.txt)
			TNT1 A 0 ACS_EXecuteAlways(1623) // performs Thing_ChangeTID (0, 1161);
			TNT1 A 0 A_changeFlag("MISSILEMORE", 1)
			Goto Stand
			
		Waiting:
			BARO A 1
			Goto LayInWait //Spawn	

	}
}


Actor FBD_BaronBoss2: FBD_BaronBoss1
{
	States
	{
		Spawn:
			// headboxes won't work without slaughtermap init
			BARO A 1 NODELAY  ACS_NamedExecuteWithResult("FBDRunMonster", 2) // noble headbox
			BARO A 7
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 57, 1) // force create
		LayInWait:	
			TNT1 A 0 A_CheckSight("WAITING")
			TNT1 A 0 ACS_EXecuteAlways(1624) // performs Thing_ChangeTID (0, 1162);
			TNT1 A 0 A_changeFlag("MISSILEMORE", 1)
			Goto Stand
		Waiting:
			BARO A 1
			Goto LayInWait
				
	}
}

#include Shambler.txt