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





ACTOR RevenantPotpourriChecker: AbstractPotpourriChecker
{
	Radius 12
	Height 60
}

Actor RevenantBossCubeSpawner: AbstractBossCubeSpawner
{
	Radius 12
	Height 60	
	States
	{
		DoSummon:	
			TNT1 A 0 A_GiveInventory("SummonsCount", 1, AAPTR_TRACER)
			TNT1 A 0 A_SpawnItemEx("TeleportationFog")
			TNT1 A 1 A_SpawnItemEx("FBD_Revenant",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0,user_stid)
			Stop
	}
}

ACTOR FBD_Revenant: ZandronumRevenant 17851
{
	//$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 Revenant1: FBD_Revenant Replaces Revenant {} in Doom_Replacements.txt
	
	//$Sprite SKELB1E1
	
	//***Che
	var int user_head_tid;
	var int user_head_rel;
	var int user_head_scale;
	var int user_head_xyzf; /* 
		a packed value: 
		bits 0..7 =x+128, clamped to -128..127
		bits 8..15 =y+128, clamped to -128..127
		bits 16..23 =z, clamped to 1..255
		bit 29 is a command to assume an unique TID, used in monster-on-monster headshotting
		A zero value is a command to terminate
	*/	
	var int user_head_type; // 4, revenant 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_angle;

	
	
	GibHealth 45
	Health 300
	Monster
	MeleeThreshold 120
	+FLOORCLIP
    damagefactor "Crush", 10.0
    damagefactor "Plasma", 0.5
	damagefactor "SSG", 4.0
	damagefactor "GibRemoving", 0.0
	damagefactor "Avoid", 0.0 damagefactor "HangingHook", 0
	PainChance "Kick", 255
    BloodType "RevenantBloodz", "RevenantBloodzSaw", "RevenantBloodzSaw" // smart z-aware blood
	 // that inflicts extra damage if we are hit in the area 40 < z < 48
	SeeSound "skeleton/sight"
	PainSound "REVOUCH"
	DeathSound "skeleton/death"
	ActiveSound "REVIDLE"
	MeleeSound "skeleton/melee"
	HitObituary "$OB_UNDEADHIT"
	damagefactor "TeleportRemover", 0.0
	DamageFactor "CauseSplash", 0.0 DamageFactor "CauseObjectsToSplashSlime", 0.0 DamageFactor "CauseObjectsToSplashNukage", 0.0
	DamageFactor "CauseObjectsToSplashBlood", 0.0 DamageFactor "CauseObjectsToSplashLava", 0.0
	PainChance "HelperMarineFatallity", 255
	
	Tag "$REVENANT" // "Revenant"
	Obituary "$OB_UNDEAD"
	
	DropItem "DemonStrengthRune" 5
	damagefactor "Blood", 0.0 damagefactor "BlueBlood", 0.0 damagefactor "GreenBlood", 0.0
	MaxStepHeight 24
	+DONTHURTSPECIES
	Painchance "Head", 255
	Painchance "HeadStun", 255
	Painchance "HeadPlasma", 255
	Painchance "Decaptate", 255
	Painchance "RevenantHitStomach", 255
	Painchance "RevenantHitLeg", 255
	MaxDropOffHeight 32
	DeathHeight 0
	BurnHeight 0
	Radius 12
	Height 60
	Scale 0.9
	
	MeleeRange 100
	
	PainChance "Argent", 255
	DamageFactor "Argent", 1.0
	
	damagefactor "Killme", 1.0 // AOE inflicted by captured marines
	PainChance "Killme", 255	
	
	Species "Revenants"
	
	DamageFactor "RevenantHitStomach", 1.0
	
	PainChance "Ice", 255
	
	States
	{
		Spawn:
			SKEL B 0 NODELAY A_JumpIf(CallAcs("GetPotPourri"), "PotPourriSwap")
		PotPourriCancel:
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunMonster", 4) // revenant head
			//TNT1 A 0 A_SetUserVar("user_head_type", 4) // revenant head
			//TNT1 A 0 ACS_NamedExecuteAlways("BDCHeckClassicMonsters", 0, 0, 0, 0)//Check if Vanilla Mode is activated
			TNT1 A 0 A_GiveInventory("IsARevenant", 1)
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "FatalityMarine")
			
			TNT1 A 0 A_SetUserVar("user_sleeping", 1)
			SKEL B 10 A_Look
		Stand: //Spawn2:
			TNT1 A 0
			//TNT1 A 0 A_JumpIf(user_serverside_sfchk >= 4, 2) // extreme slaughtermap optimization
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			SKEL BBBBBBB 10 A_Look
			Loop

		Pain.Ice:
			"----" A 20 A_Pain
			Goto See
		WaitTargetsFatalityOut:
			TNT1 A 0 A_PlaySound("REVIDLE", CHAN_VOICE)
			SKEL I 1 A_Jump(256, "WTF1", "WTF2", "WTF3", "WTF3", "Duck")
			Wait
		WTF1:
			// front-only frames, shaking in rage. Only work properly in singleplayer
			SKLA A 2 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, -4, 52)
			SKLA B 2 
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 5, 46)
			SKLA CDCECDCE 2 A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, -4, 52)
			SKLA BA 2 A_FaceTarget
		WTF2:
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 33, 0, 36)
			SKEL ITITITIT 4 A_FaceTarget // lean forward melee frame, left and right alternating
			Goto See
		WTF3:	
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL YYYYYYYY 4 A_FaceTarget
			Goto See
/*			
		ReplaceVanilla:
			//***Che: deprecated.  See TNT1 A 0 A_JumpIfInventory("IAmClassicMonster"
			//TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
			//TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			//TNT1 A 0 A_SpawnItemEx ("VanillaRevenant",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
			//Stop
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("IAmClassicMonster", 1)
			Goto Stand
*/			
			
		Idle: 
			//***Che  invulnerable revenant fix
			//***Che  A_Chase("", "") *may* jump here from inside fatality if the monster has no target
		
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "FatalityMarine")	
			TNT1 A 0 A_JumpIfInventory("ZombiemanFatality", 1, "ThrowZombieman")
			TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "ThrowSergeant")
			TNT1 A 0 A_JumpIfInventory("ImpFatality", 1, "ThrowImp")
		
		LookingForPlayer: //***Che: why the fug does he he have TWO "LookingForPlayer" states defined in different places in code?
			// P.S. seems like I deleted the wron one considering he stops chasing awful quick
		
			
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "FatalityMarine")		
			TNT1 A 0 A_JumpIfInventory("ZombiemanFatality", 1, "FatalityZombieman")
			TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "FatalitySergeant")
			TNT1 A 0 A_JumpIfInventory("ImpFatality", 1, "FatalityImp")
			
		
			TNT1 A 0 A_GiveInventory("SKImp", 1)
			TNT1 A 0 A_TakeInventory("EnemyMemory", 1)
			
			TNT1 A 0 A_SetUserVar("user_sleeping", 1)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			
			SKEL BBB 10 A_Look
			TNT1 A 0 A_SetAngle(angle - 40)
			SKEL BBB 10 A_Look
			TNT1 A 0 A_SetAngle(angle + 40)
			
			SKEL 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", 23, -9, 52)
			SKEL A 2 A_Wander // im replacing all 0s with 2s for A_Wander and commenting a_recoil out
			SKEL AA 2 A_Look
			//TNT1 A 0 A_Recoil(-2)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			SKEL B 2 A_Wander
			SKEL BB 2 A_Look
			//TNT1 A 0 A_Recoil(-2)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",  3,  2, 59)
			SKEL C 2 A_Wander
			SKEL CC 2 A_Look
			//TNT1 A 0 A_Recoil(-2)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 23,  9, 52)
			SKEL D 2 A_Wander
			SKEL DD 2 A_Look
			//TNT1 A 0 A_Recoil(-2)
			
			
			
			TNT1 A 0 A_jump(128, "LookingForPlayer")
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 23, -9, 52)
			SKEL A 2 A_Wander
			SKEL AA 2 A_Look
			//TNT1 A 0 A_Recoil(-2)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			SKEL B 2 A_Wander
			SKEL BB 2 A_Look
			//TNT1 A 0 A_Recoil(-2)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",  3,  2, 59)
			SKEL C 2 A_Wander
			SKEL CC 2 A_Look
			//TNT1 A 0 A_Recoil(-2)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 23,  9, 52)
			SKEL D 2 A_Wander
			SKEL DD 2 A_Look
			//TNT1 A 0 A_Recoil(-2)
			
			TNT1 A 0 A_JumpIfInventory("Enemymemory", 1, "LookingForPlayer") //Goto LookingForPlayer
			
		ForgetTarget:
			TNT1 A 0 A_ClearTarget
			TNT1 A 0 A_TakeInventory("EnemyMemory", 25)
			TNT1 A 0 A_GiveInventory("LookingForPlayer", 1)
			TNT1 A 0 A_SetUserVar("user_sleeping", 1)
			Goto LookingForPlayer
			
		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 ("RevenantPotpourriSwapper",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		

/*
		VanillaSee:
		
			TNT1 A 0
			// slaughtermap manage
			TNT1 A 0 A_JumpIf(!user_sleeping, 3) // forgo the expensive sight check if already awake
			TNT1 A 0 A_CheckSight(2)
			TNT1 A 0 A_SetUserVar("user_sleeping", 0)
			TNT1 A 0 A_JumpIf(user_serverside_sfchk != -1, 3) // -1 means ACS commands us to do the radiusgive
			// A_RadiusGive is:
			//  1. serverside-only: the call is skipped on the client; only if a player is involved, a network command to update his item count is sent, otherwise the item count only increases on the server
			//  2. iterates over all actors in an infinitely tall square column checking their flags and coordinates
			//  3. performs expensive precision radius calculation (using a square root) unless RGF_CUBE is given (which results in cheaper delta per-coordinate comparison)
			//  4. performs expensive sight check, for each thing that passes flag and radius checks, unless RGF_NOSIGHT is given
			TNT1 A 0 A_RadiusGive("SfestCounterServerside", 500, RGF_MONSTERS | RGF_CUBE | RGF_NOSIGHT, 1)			
			TNT1 A 0 A_SetUserVar("user_serverside_sfchk", 1) // reply that we did the deed
	
		
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 23, -9, 52)
			SKEL AA 2 A_Chase
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			SKEL BB 2 A_Chase
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",  3,  2, 59)
			SKEL CC 2 A_Chase
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 23,  9, 52)
			SKEL DD 2 A_Chase
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14,  3, 57)
			SKEL EE 2 A_Chase
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",  3, -2, 59)
			SKEL FF 2 A_Chase
			Loop
		VanillaMelee:
			TNT1 A 0
			SKEL G 1 A_FaceTarget
			SKEL G 6 A_SkelWhoosh
			SKEL H 6 A_FaceTarget
			SKEL I 6 A_SkelFist
			Goto VanillaSee
		VanillaMissile:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL J 0 BRIGHT A_FaceTarget 
			SKEL J 10 BRIGHT A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-18,  3, 52)
			SKEL K 10 A_SkelMissile
			SKEL K 10 A_FaceTarget
			Goto VanillaSee	
		VanillaMissileSFest:
			TNT1 A 0

		
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL J 0 BRIGHT A_FaceTarget 
			SKEL J 10 BRIGHT A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-18,  3, 52)
			SKEL K 10 A_CustomMissile("RevenantFirebalSFest",50,10,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			SKEL K 10 A_FaceTarget
			Goto VanillaSee	
*/			
			
		See:
			SKEL A 0
			//TNT1 A 0 A_JumpIfInventory("IAmClassicMonster", 1, "VanillaSee")
			SKEL A 0 A_TakeInventory("EnemyMemory", 10)

		SeeContinue: //LookingForPlayer:	
			
			// ***Che: invulnerable revenant fix
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "FatalityMarine")		
			TNT1 A 0 A_JumpIfInventory("ZombiemanFatality", 1, "FatalityZombieman")
			TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "FatalitySergeant")
			TNT1 A 0 A_JumpIfInventory("ImpFatality", 1, "FatalityImp")
			
			//TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "FatalityMarine")
	
			TNT1 A 0 A_JumpIf(!user_sleeping, 3) // forgo the expensive sight check if already awake
			TNT1 A 0 A_CheckSight(2)
			TNT1 A 0 A_SetUserVar("user_sleeping", 0)
			TNT1 A 0 A_JumpIf(user_serverside_sfchk != -1, 3) // -1 means ACS commands us to do the radiusgive
			// A_RadiusGive is:
			//  1. serverside-only: the call is skipped on the client; only if a player is involved, a network command to update his item count is sent, otherwise the item count only increases on the server
			//  2. iterates over all actors in an infinitely tall square column checking their flags and coordinates
			//  3. performs expensive precision radius calculation (using a square root) unless RGF_CUBE is given (which results in cheaper delta per-coordinate comparison)
			//  4. performs expensive sight check, for each thing that passes flag and radius checks, unless RGF_NOSIGHT is given
			TNT1 A 0 A_RadiusGive("SfestCounterServerside", 500, RGF_MONSTERS | RGF_CUBE | RGF_NOSIGHT, 1)			
			TNT1 A 0 A_SetUserVar("user_serverside_sfchk", 1) // reply that we did the deed		
		
			TNT1 A 0 A_JumpIfInventory("EnemyMemory", 35, "ForgetTarget") // 35, not 15. His animation is very short, this translates into 24 seconds (8 if you are invisible)
			TNT1 A 0 A_GiveInventory("EnemyMemory", 1)
			
			TNT1 A 0 A_TakeInventory("DuckYouFool", 1)
			
			//TNT1 A 0 A_SpawnItemEx("FootSep", 0, 0, 20, 0, 0)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 23, -9, 52)
			SKEL AA 2 A_Chase
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			SKEL BB 2 A_Chase
			
			TNT1 A 0 A_JumpIfInventory("DuckYouFool", 1, "Duck")
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",  3,  2, 59)
			SKEL CC 2 A_Chase
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 23,  9, 52)
			SKEL DD 2 A_Chase
			
			TNT1 A 0 A_JumpIfInventory("DuckYouFool", 1, "Duck")
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14,  3, 57)
			SKEL EE 2 A_Chase
				
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",  3, -2, 59)
			SKEL FF 2 A_Chase
			
			TNT1 A 0 A_JumpIfInventory("DuckYouFool", 1, "Duck")
			
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "ForgetFaster")//"LookingForPlayer") //"ForgetTarget")
			TNT1 A 0 A_CheckSight("ForgetFaster")//"LookingForPlayer")
			Loop //Goto See
		ForgetFaster:	
			TNT1 A 0 
			TNT1 A 0 A_GiveInventory("EnemyMemory", 3)
			Goto SeeContinue
		Melee:
			"----" A 0
			"----" A 0 A_TakeInventory("DuckYouFool", 1)
			"----" A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "FatalityMarine")
			
			// slaughtermap manage - warming the headbox up
			"----" A 0 A_JumpIf(!user_sleeping, 4) // forgo the expensive sight check if already awake
			"----" A 0 A_JumpIfInTargetInventory("IsPlayer", 1, 2) // bypass the sight check 
			"----" A 0 A_CheckSight(2) // out of sight of any player, AND attacking another monster, keep slumbering
			"----" A 0 A_SetUserVar("user_sleeping", 0)	

			"----" A 0 A_JumpIf(CallAcs("FBD_CheckSurpsisedAtLTGPlayerBeingNaked"), "LTGCatCall") 

			"----" A 0 A_JumpIfInTargetInventory("GoFatality", 1, "WaitTargetsFatalityOut")
			
			// Kinslayer check:	
			"----" A 0 A_JumpIf(!CheckClass("FBD_Revenant", AAPTR_TARGET, true), 2)
			"----" A 0 ACS_NamedExecuteWithResult("FBD_InfightFriendlyFireOn")
			
			// thefug? "----" A 0 A_JumpIfInventory("IAmSfestMonster", 1, 2)
			//"----" A 0 A_JumpIfInventory("IAmClassicMonster", 1, "VanillaMelee")
			//"----" A 0 A_Jump(128, "PunchLeft")
			"----" A 1 A_Jump(256, "PunchLeft", "PunchRight") // elemenant support
			Wait
			
		PunchRight:	
			TNT1 A 0 A_JumpIfInventory("MeleeHitSuccess", 1, 2)
			TNT1 A 0 A_JumpIfInventory("MeleeMiss", 4, "LeapBackAndSpray")
			//TNT1 A 0 A_JumpIfInventory("MeleeMiss", 2, "See") // causes him to freeze
			TNT1 A 0 A_TakeInventory("MeleeHitSuccess", 1)
			
			TNT1 A 0 A_FaceTarget
			
			TNT1 A 0 A_JumpIfInTargetInventory("IsInATank", 1, "LeapBackAndSpray")
			
			TNT1 A 0 ThrustThingZ(0,20,0,1)
			SKEL G 1 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-32,-10, 45)
			TNT1 A 0 A_Recoil(-3)
			
			SKEL G 4 A_PlaySound("skeleton/swing", CHAN_WEAPON)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 11, -3, 54)
			SKEL H 4 A_FaceTarget
			
			TNT1 A 0 A_CustomMissile("RevenantAttack",10,0,0,2)
			TNT1 A 0 A_CustomMissile("RevenantAttack",50,0,0,2)
			SKEL I 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 33, -5, 36)
			TNT1 A 0 A_JumpIfInventory("ZombiemanFatality", 1, "FatalityZombieman")
			TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "FatalitySergeant")
			TNT1 A 0 A_JumpIfInventory("ImpFatality", 1, "FatalityImp")
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "FatalityMarine")
			
			TNT1 A 0 A_JumpIfInTargetInventory("GoFatality", 1, "WaitTargetsFatalityOut")
			
			TNT1 A 0 A_JumpIfCloser(96, 1) // otherwise, strikes from too long a range
			Goto SeeContinue
			TNT1 A 0 A_Chase("", "") // stop kicking that dead horse (this jumps to Idle if target is ded)
			
		PunchLeft:	
			TNT1 A 0 A_JumpIfInventory("MeleeHitSuccess", 1, 2)
			TNT1 A 0 A_JumpIfInventory("MeleeMiss", 4, "LeapBackAndSpray")
			//TNT1 A 0 A_JumpIfInventory("MeleeMiss", 2, "See")
			TNT1 A 0 A_TakeInventory("MeleeHitSuccess", 1)
			
			TNT1 A 0 A_FaceTarget
			
			TNT1 A 0 A_JumpIfInTargetInventory("IsInATank", 1, "LeapBackAndSpray")
			
			TNT1 A 0 ThrustThingZ(0,20,0,1)
			SKEL R 1 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-32, 10, 45)
			TNT1 A 0 A_Recoil(-3)
			
			SKEL R 4 A_PlaySound("skeleton/swing", CHAN_WEAPON)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 11,  3, 54)
			SKEL S 4 A_FaceTarget
			
			TNT1 A 0 A_CustomMissile("RevenantAttack",10,0,0,2)
			TNT1 A 0 A_CustomMissile("RevenantAttack",50,0,0,2)
			SKEL T 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 33,  5, 36)
			TNT1 A 0 A_JumpIfInventory("ZombiemanFatality", 1, "FatalityZombieman")
			TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "FatalitySergeant")
			TNT1 A 0 A_JumpIfInventory("ImpFatality", 1, "FatalityImp")
			
			TNT1 A 0 A_JumpIfInTargetInventory("GoFatality", 1, "WaitTargetsFatalityOut")
			
			TNT1 A 0 A_JumpIfCloser(96, 1) // otherwise, strikes from too long a range
			Goto SeeContinue
			TNT1 A 0 // an empty frame to jump to
			TNT1 A 0 A_Chase("", "") // stop kicking that dead horse (this jumps to Idle if target is ded)
			Goto PunchRight
		LeapBackAndSpray:		
			TNT1 A 0
			TNT1 A 0 A_TakeInventory("MeleeMiss", 10)
			TNT1 A 0 A_FaceTarget
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL Y 6 // the duck frame (firing frame with fire retouched out)
			
			TNT1 A 0 ThrustThingZ(0,20,0,1)
			TNT1 A 0 A_Recoil(12)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-18,  3, 52)
			SKEL K 4
			SKEL KKKK 4 A_CheckFloor ("SpecialAttackContinue") // the "leaning back after a missile attack" frame
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL YYYYYYYYYYYYY 4 A_CheckFloor ("SpecialAttackContinue")  // the duck frame
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL Y 4
			
			//Goto SpecialAttackContinue
			"----" A 1 A_Jump(256, "SpecialAttackContinue")
			Wait
			
		Duck:
			TNT1 A 0
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			// z  36 from sprite instead of height = 60 - headbox height = 18 - 1 = 41
			//SKEL I 5 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 33, -5, 36)
			//SKEL I 10 A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 40)
			SKEL Y 10 A_FaceTarget
			
			TNT1 A 0 ThrustThingZ(0,20,0,1)
			TNT1 A 0 A_Recoil(12)
			TNT1 A 0 A_TakeInventory("DuckYouFool", 1)
			
			// the right punch forward finishing frame
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 33, -5, 36)
			SKEL IIIII 4 A_CheckFloor ("Missile") 

			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL YYYYYYYYYYYYY 4 A_CheckFloor ("Missile") 
			//Goto Missile
			"----" A 1 A_Jump(256, "Missile") // inheritance support (see elemenants)
			Wait
		Missile:
			TNT1 A 0
			TNT1 A 0 A_TakeInventory("DuckYouFool", 1)
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "FatalityMarine")
			
			// 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_CheckSurpsisedAtLTGPlayerBeingNaked"), "LTGCatCall") 

			// Kinslayer check:	
			TNT1 A 0 A_JumpIf(!CheckClass("FBD_Revenant", AAPTR_TARGET, true), 2)
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_InfightFriendlyFireOn")
			
			//TNT1 A 0 A_JumpIfInventory("IAmClassicMonster", 1, "VanillaMissile")
			//TNT1 A 0 A_JumpIfInventory("IAmSfestMonster", 1, "MissileSfest")			

			TNT1 A 0 A_TakeInventory("MeleeHitSuccess", 10)
			TNT1 A 0 A_TakeInventory("MeleeMiss", 10)
			SKEL K 0 A_FaceTarget
			TNT1 A 0 A_Jump (64, "SpecialAttack")
			TNT1 A 0 A_Jump (128, "Missile2")
		
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 ACS_NamedExecuteWithResult("FBD_FaceTargetIfCanSeeIt")
			SKEL B 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			TNT1 A 0 A_CustomMissile("FBD_RevenantBall",50,10,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_PlaySOund("RLANSHOT", CHAN_WEAPON)

			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)			
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 ACS_NamedExecuteWithResult("FBD_FaceTargetIfCanSeeIt")
			
			SKEL J 6 BRIGHT ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL K 10 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-18,  3, 52)
			
			Goto See
			
		Missile2:	
		
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 ACS_NamedExecuteWithResult("FBD_FaceTargetIfCanSeeIt")
			SKEL B 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			TNT1 A 0 A_CustomMissile("FBD_RevenantBall",50,-10,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_PlaySOund("RLANSHOT", CHAN_WEAPON)
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 ACS_NamedExecuteWithResult("FBD_FaceTargetIfCanSeeIt")
			SKEL J 6 BRIGHT ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL K 10 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-18,  3, 52)
			Goto See
/*			
		MissileSfest:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "FatalityMarine")
			TNT1 A 0 A_JumpIfInventory("IAmClassicMonster", 1, "VanillaMissileSfest")
			TNT1 A 0 A_TakeInventory("MeleeHitSuccess", 10)
			TNT1 A 0 A_TakeInventory("MeleeMiss", 10)
			SKEL K 0 A_FaceTarget
			TNT1 A 0 A_Jump (64, "SpecialAttack")
			TNT1 A 0 A_Jump (128, "Missile2Sfest")
			
				//no LOS check: meaningles, fireballs are dumb here
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_FaceTarget
			SKEL B 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			TNT1 A 0 A_CustomMissile("RevenantFirebalSFest",50,10,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_PlaySOund("RLANSHOT", CHAN_WEAPON)
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_FaceTarget
			SKEL J 6 BRIGHT ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL K 10 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-18,  3, 52)
			Goto See
			
		Missile2Sfest:	
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_FaceTarget
			SKEL B 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			TNT1 A 0 A_CustomMissile("RevenantFirebalSFest",50,-10,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_PlaySOund("RLANSHOT", CHAN_WEAPON)
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_FaceTarget			
			SKEL J 6 BRIGHT ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL K 10 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-18,  3, 52)
			Goto See			
*/
		SpecialAttack:
			
			TNT1 A 0 A_PlaySound("skeleton/sight", CHAN_VOICE)
			TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, "SpecialAttackScreechingAtPlayer")
		SpecialAttackScreechingAtMonster:
			TNT1 A 0 
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 33, 0, 36)
			SKEL ITITIT 4 A_FaceTarget // lean forward melee frame, left and right alternating
			//Goto SpecialAttackContinue
			"----" A 1 A_Jump(256, "SpecialAttackContinue")
			Wait
		SpecialAttackScreechingAtPlayer:	
			// front-only frames, shaking in rage. Only work properly in singleplayer
			SKLA A 2 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, -4, 52)
			SKLA B 2 
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 5, 46)
			SKLA C 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
			
			SKLA DCECDCE 2 //A_FaceTarget
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, -4, 52)
			SKLA BA 2 A_FaceTarget
			"----" A 1 A_Jump(256, "SpecialAttackContinue")
			Wait
			
		SpecialAttackContinue:  // LeapBackAndSpray jumps here	
			TNT1 A 0
			"----" A 0 A_SetUserVar("user_angle", angle * 100.0) // CHF_DONTMOVE fucks the angle up
			TNT1 A 0 A_Chase("", "", CHF_DONTMOVE) // don't try attacking if no target (jumps to idle)
			"----" A 0 A_SetAngle("user_angle", angle * 0.01)
			
			TNT1 A 0 A_JumpIfInTargetInventory("GoFatality", 1, "WaitTargetsFatalityOut")
			//TNT1 A 0 A_JumpIfInventory("IAmSfestMonster", 1, "SpecialAttackContinueSfest")			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 ACS_NamedExecuteWithResult("FBD_FaceTargetIfCanSeeIt") // the new mechanism, subject to load balancing (max 100 checks per tic, after that nothing happens). Also checks for invisible players and spectres
				/*
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 3)
				TNT1 A 0 A_JumpIfTargetInLOS(1)
				Goto SaFire1
				TNT1 A 0 A_FaceTarget
				*/
			SKEL B 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			TNT1 A 0 A_CustomMissile("RevenantUnguidedRocket",50,10,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_PlaySOund("RLANSHOT", CHAN_WEAPON)
			SKEL J 6 BRIGHT ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL K 10 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-18,  3, 52)
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 ACS_NamedExecuteWithResult("FBD_FaceTargetIfCanSeeIt")
			SKEL B 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			TNT1 A 0 A_CustomMissile("RevenantUnguidedRocket",50,-10,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_PlaySOund("RLANSHOT", CHAN_WEAPON)
			SKEL J 6 BRIGHT ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL K 10 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-18,  3, 52)
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 ACS_NamedExecuteWithResult("FBD_FaceTargetIfCanSeeIt")
			SKEL B 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			TNT1 A 0 A_CustomMissile("RevenantUnguidedRocket",50,10,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_PlaySOund("RLANSHOT", CHAN_WEAPON)
			SKEL J 6 BRIGHT ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL K 10 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-18,  3, 52)
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 ACS_NamedExecuteWithResult("FBD_FaceTargetIfCanSeeIt")
			SKEL B 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			TNT1 A 0 A_CustomMissile("RevenantUnguidedRocket",50,-10,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_PlaySOund("RLANSHOT", CHAN_WEAPON)
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 ACS_NamedExecuteWithResult("FBD_FaceTargetIfCanSeeIt")
			SKEL J 6 BRIGHT ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL K 10 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-18,  3, 52)
			Goto see
/*			
		SpecialAttackContinueSFest:
				//***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
			SKEL B 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			TNT1 A 0 A_CustomMissile("RevenantMissileSfest",50,10,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_PlaySOund("RLANSHOT", CHAN_WEAPON)
			SKEL J 6 BRIGHT ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL K 10 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-18,  3, 52)
				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
			SKEL B 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			TNT1 A 0 A_CustomMissile("RevenantMissileSfest",50,-10,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_PlaySOund("RLANSHOT", CHAN_WEAPON)
			SKEL J 6 BRIGHT ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44) 
			SKEL K 10 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-18,  3, 52)
				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
			SKEL B 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57) 
			TNT1 A 0 A_CustomMissile("RevenantMissileSfest",50,10,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_PlaySOund("RLANSHOT", CHAN_WEAPON)
			SKEL J 6 BRIGHT ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL K 10 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-18,  3, 52)
				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
			SKEL B 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57)
			TNT1 A 0 A_CustomMissile("RevenantMissileSfest",50,-10,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			TNT1 A 0 A_PlaySOund("RLANSHOT", CHAN_WEAPON)
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			
				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
			SKEL J 6 BRIGHT ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL K 10 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-18,  3, 52)
			Goto see
*/			
		Pain:
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "FatalityMarine")
			
			TNT1 A 0 A_JumpIfInventory("DamagePoint1", 5, "ExplodeInHalf")
			SKEL L 5 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-32,  4, 45)
			SKEL L 5 A_Pain
			Goto See
			
		Pain.Argent:
			
			TNT1 A 0
			//TNT1 A 0 A_ClearTarget
			TNT1 A 0 HealThing(50)
			TNT1 A 0 ACS_NamedExecuteWithResult("DisplayArgentDischarge", 10, 60, 0)	
			
			SKEL L 5 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-32,  4, 45)
			SKEL LLL 8 A_Pain
			//Goto SpecialAttackContinue // results in furious spraying in a random direction if target is out of sight
			"----" A 1 A_Jump(256, "SpecialAttackContinue")
			Wait
			
		Pain.Head:
		Pain.Decaptate:
		Pain.HeadPlasma:
		Pain.HeadStun:
			TNT1 A 0 A_JumpIfInventory("Curbstomp_Marine", 1, "FatalityMarine")
			SKEL L 2 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-32,  4, 45)
			SKEL L 2 A_Pain
			Goto See	
			
		Pain.SHotgun:
		Pain.SSG:
		Pain.Cut:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("DamagePoint1", 1, "ExplodeInHalf")
			SKEL L 5 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-32,  4, 45)
			SKEL L 5 A_Pain
			Goto See	
			
		Pain.RevenantHitStomach:
			TNT1 A 0
			SKEL L 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-32,  4, 45)
			TNT1 A 0 A_GiveInventory("DamagePoint1")
			TNT1 A 0 A_JumpIfInventory("DamagePoint1", 5, "ExplodeInHalf")
			SKEL L 1 A_Pain
			Goto Pain
			
		Pain.RevenantHitLeg:
			SKEL L 1 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-32,  4, 45)
			TNT1 A 0 A_GiveInventory("DamagePoint2")
			SKEL L 1 A_Pain
			TNT1 A 0 A_JumpIfInventory("DamagePoint2", 7, "GotLegRemoved")
			Goto See	

		Pain.Kick:
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_Recoil(6)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",-32,  4, 45)
			SKEL L 6 A_Pain  
			SKEL L 6
			Goto See
			
			
		FatalityMarine:
			TNT1 A 0
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 A_GiveInventory("GoFatality", 1) // most demons stop attacking a target that has this
			
			TNT1 A 0 A_PlaySound("BIGSCRE", CHAN_WEAPON) // it's not the revenant screaming, it's the marine he is ripping apart screaming
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			REFP A 30
			EXPL A 0 Radius_Quake (2, 24, 0, 15, 0)
			TNT1 AAA 0 A_CustomMissile ("Brains1", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("XDeath1", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeath2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_PlaySound("XDeath1", CHAN_WEAPON) // the splat cuts marine screaming off
			REFP BCDE 8
			REFP F 40
			REFP GHI 4
			TNT1 A 0 A_PlaySound("XDeath1") // no need to bother, run this one in parallel
			REFP J 20


			TNT1 A 0 A_TakeInventory("Curbstomp_Marine",1)
			TNT1 A 0 A_TakeInventory("GoFatality", 1)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			TNT1 A 0 A_SpawnItem ("MarineFatalizedByRevenant", 1)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57, 1) // force create
			Goto See



		FatalityZombieman:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_GiveInventory("GoFatality", 1) // most demons stop attacking a target that has this
			SKF1 A 1 A_Chase("","") // this JUMPS TO THE IDLE STATE if he fails to acquire a target! And Zandronum doesn't know the CHF_DONTIDLE flag
			SKF1 ABC 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, 60)
			SKF1 D 12

			SKF1 EFG 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, -60)
			SKF1 H 12


			SKF1 ABC 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, 60)
			SKF1 D 12
			SKF1 EFG 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, -60)
			SKF1 H 12
			SKF1 ABC 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, 60)
			SKF1 D 12
			SKF1 EFG 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, -60)
			SKF1 H 12 A_FaceTarget
			SKF1 I 1 A_Chase("","")
		ThrowZombieman:	
			SKF1 I 10 A_FaceTarget
			TNT1 A 0 A_TakeInventory("ZombieManFatality",1)
			TNT1 A 0 A_TakeInventory("GoFatality", 1)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
			//TNT1 A 0 A_CustomMissile("FBD_ThrowedZombieMan2", 64, 0, 0, 0) 
			TNT1 A 0 A_CustomMissile("FBD_ThrowedZombieMan2",64,0,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
			SKEL HI 4
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57, 1) // force create
			Goto See
			

		FatalitySergeant:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_GiveInventory("GoFatality", 1) // most demons stop attacking a target that has this
			SKF2 A 1 A_Chase("","") // this JUMPS TO THE IDLE STATE if he fails to acquire a target! And Zandronum doesn't know the CHF_DONTIDLE flag
			SKF2 ABC 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, 60)
			SKF2 D 12

			SKF2 EFG 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, -60)
			SKF2 H 12


			SKF2 ABC 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, 60)
			SKF2 D 12
			SKF2 EFG 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, -60)
			SKF2 H 12
			SKF2 ABC 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, 60)
			SKF2 D 12
			SKF2 EFG 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, -60)
			SKF2 H 12 A_FaceTarget
			SKF2 I 1 A_Chase("","")
		ThrowSergeant:	
			SKF2 I 10 A_FaceTarget
			TNT1 A 0 A_TakeInventory("SergeantFatality",1)
			TNT1 A 0 A_TakeInventory("GoFatality", 1)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
			//TNT1 A 0 A_CustomMissile("FBD_FBD_ThrowedSergeant2", 64, 0, 0, 0)
			TNT1 A 0 A_CustomMissile("FBD_FBD_ThrowedSergeant2",64,0,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)		   

			SKEL HI 4
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57, 1) // force create
			Goto See
			
		FatalityImp:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_GiveInventory("GoFatality", 1) // most demons stop attacking a target that has this
			SKF3 A 1 A_Chase("","")  // this JUMPS TO THE IDLE STATE if he fails to acquire a target! And Zandronum doesn't know the CHF_DONTIDLE flag
			SKF3 ABC 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, 60)
			SKF3 D 12

			SKF3 EFG 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, -60)
			SKF3 H 12


			SKF3 ABC 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, 60)
			SKF3 D 12
			SKF3 EFG 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, -60)
			SKF3 H 12
			SKF3 ABC 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, 60)
			SKF3 D 12
			SKF3 EFG 4 A_FaceTarget
			TNT1 A 0 A_PlaySound("grunt/pain", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("CLAP", CHAN_BODY)
			TNT1 A 0 A_SpawnItemEx("MuchBlood2", 0, -60)
			SKF3 H 12 A_FaceTarget

			//***Che: found it! This is what was causing him to change his state
			// because when he loses his target, A_Chase performs a jump to his idle state!
			// ..resulting in an invulnerable revenant :(...
			SKF3 I 1 A_Chase("","")
		ThrowImp:
			SKF3 I 10 A_FaceTarget
			TNT1 A 0 A_TakeInventory("ImpFatality",1)
			TNT1 A 0 A_TakeInventory("GoFatality", 1)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
			//TNT1 A 0 A_CustomMissile("FBD_ThrowedImp2", 64, 0, 0, 0) 
			TNT1 A 0 A_CustomMissile("FBD_ThrowedImp2",64,0,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)		   
			SKEL HI 4
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 14, -3, 57, 1) // force create
			Goto See		
		
		Death.Deletus:
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			TNT1 A 0 A_NoBlocking
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			SKEL LM 7
			SKEL N 7 A_Scream
			SKEL O 7
			SKEL P 7
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadSkeleton",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop

		Death.Fatality:
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_JumpIfIntargetInventory("FistsSelected", 1, 1)
			Goto Death
			TNT1 A 0 A_FaceTarget
			//TNT1 AA 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 AAA 0 A_SpawnItemEx("ArmorShardFatalityBonus", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 10, 15, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_GiveToTarget("GoFatality", 1)
			TNT1 A 0 A_Jump(128,5)
			TNT1 A 0 A_GiveToTarget("RevenantFatality", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, scripts runs ownerless
			Stop
			TNT1 AAAAAAA 0
			TNT1 A 0 A_GiveToTarget("RevenantFatality2", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, scripts runs ownerless
			Stop
			
		Death.HelperMarineFatallity:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 1 A_Pain
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_GiveToTarget("RevenantFatality", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop	

		//***Che:
		Death.HeadPlasma:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_CustomMissile ("XDeathBurnedSkull", 72, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			REVH AAAAAA 4 A_CustomMissile ("ExplosionSmoke", 70, 0, random (0, 360), 2, random (0, 360))
			REVH B 8 A_NoBlocking
			TNT1 A 0 A_XScream
			REVH CD 8
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadSkeletonNoHead",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 10 A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop
			
		Death.Psionic:
		Death.HeadStun:
		
		Death.Minorhead:
		Death.Head:
			TNT1 A 0 A_JumpIfInTargetInventory("HasPlasmaWeapon", 1, "Death.Plasma")
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 AAAAA 0 A_CustomMissile ("Xdeath1", 72, 0, random (0, 360), 2, random (0, 160))
			
			TNT1 A 0 A_CustomMissile ("RevenantHeadsplosion", 70, 0, angle, CMF_TRACKOWNER | CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (70, 90))
	//        TNT1 AAAA 0 A_CustomMissile ("SmallLSPart1", 70, 0, random (0, 360), 2, random (0, 360))
	//		TNT1 AAAA 0 A_CustomMissile ("SmallLSPart3", 70, 0, random (0, 360), 2, random (0, 360))
	//		TNT1 AAA 0 A_CustomMissile ("LSpart1", 72, 0, random (0, 360), 2, random (0, 160))
	//        TNT1 A 0 A_CustomMissile ("LSpart3", 72, 0, random (0, 360), 2, random (0, 160))
	//        TNT1 AA 0 A_CustomMissile ("LSpart2", 72, 0, random (0, 360), 2, random (0, 160))
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			
			REVH A 24
			REVH B 8 A_NoBlocking
			TNT1 A 0 A_XScream
			REVH CD 8
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadSkeletonNoHead",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop
			
		Death.Decaptate:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 AAAAAAAA 0 A_CustomMissile ("Xdeath1", 72, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathRevenantHead", 64, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))
			REVH A 24
			REVH B 8 A_NoBlocking
			REVH CD 8
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadSkeletonNoHead",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop	

		Death.Shotgun:
			TNT1 A 0
			TNT1 A 0 A_JumpIfCloser(200, "Death.SSG")
			Goto Death
		
		Death.SniperBullet:
		Death.Bullet792:		
		Death.Minigun:
			TNT1 A 0
			TNT1 A 0 A_Jump(100, "SpecialDeath")
			Goto Death
		
		//***Che:
		Death.FriendlyExplosion:
		
		Death.ExplosiveImpact:
			TNT1 A 0
			TNT1 A 0 A_JumpIfHealthLower(-40, "XDeath")
			Goto SpecialDeath
		
		Death.Cut:
		Death.Saw:
		SpecialDeath:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 30, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("RevenantDust", 30, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAAA 0 A_CustomMissile ("RevenantDust2", 30, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 37, 0, random (0, 360), 2, random (30, 150))
			TNT1 AA 0 A_CustomMissile ("BigLSPart1", 37, 0, random (0, 360), 2, random (30, 150))
			TNT1 AA 0 A_CustomMissile ("BigLSPart2", 37, 0, random (0, 360), 2, random (30, 150))
			TNT1 AAAAAAA 0 A_CustomMissile ("RevenantPiece", 37, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 A 0 A_Jump(64, "Death.Rare")
			Goto Death.Rare
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Scream
			
			SKEX A 100 A_SpawnItemEx("RevenantUSpawner", 0, 0, 40, random(-3,3), random(-3,3), 1, 0, SXF_NOCHECKPOSITION | SXF_CLEARCALLERTID, 0, tid )
			SKEX BCDE 6
			//TNT1 A 0 A_SpawnItem ("XFBD_DeadSkeleton", 1) // oops, this was causing them multiplying
			TNT1 A 0 A_SpawnItemEx("XFBD_DeadSkeleton22Still", 0,0,0, 0,0,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop
			
		Death.SSG:
		Death.ExtremePunches:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			REDX A 1
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_PlaySound("misc/xdeath4", CHAN_VOICE)
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 60, 0, random (0, 360), 2, random (0, 360))
			TNT1 AA 0 A_CustomMissile ("XDeath2b", 60, 0, random (0, 360), 2, random (0, 360))
			TNT1 AA 0 A_CustomMissile ("XDeath3b", 60, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 0 A_SpawnItem("MuchBlood2", 0, 50)
			TNT1 AAA 0 A_CustomMissile ("RevenantDust", 30, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAAA 0 A_CustomMissile ("RevenantDust2", 30, 0, random (0, 360), 2, random (0, 360))
			TNT1 AA 0 A_CustomMissile ("BigLSPart1", 37, 0, random (0, 360), 2, random (30, 150))
			TNT1 AA 0 A_CustomMissile ("BigLSPart2", 37, 0, random (0, 360), 2, random (30, 150))
			TNT1 AAAAAAA 0 A_CustomMissile ("RevenantPiece", 37, 0, random (0, 360), 2, random (30, 150))
			TNT1 A 0 A_SpawnItem ("XFBD_DeadSkeleton22", 1) // legs only, begin with one cycle of walking animation. NOT raiseable!
			TNT1 A 0 A_SpawnItem("HellishMissileLauncher", 0, 40)
			REDX ABCDEFGHIJK 3
			TNT1 A 0 A_SpawnItem("GrowingBloodPool")
			
			REDX K -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
		Death.Railgun:	
		
		Death.Blast: // heavy machinegun; autocannon
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")	
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("RevenantDust", 30, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAAA 0 A_CustomMissile ("RevenantDust2", 30, 0, random (0, 360), 2, random (0, 360))
			TNT1 AA 0 A_CustomMissile ("XDeath2b", 16, 0, random (0, 360), 2, random (30, 150))
			TNT1 AAAA 0 A_CustomMissile ("RevenantPiece", 37, 0, random (0, 360), 2, random (30, 150))
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SKL4 A 6
			SKL4 BBBBBBBBBBBB 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 110))
			SKL4 CD 4 A_CustomMissile ("Brutal_LiquidBlood", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 110))
			TNT1 A 0 A_SpawnItemEx ("BlastedFBD_DeadSkeleton",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop
			
		Death.SuperPlasma:
		Death.Plasma: 
		Death.Plasma2:
		Death.Electric:
		
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedSkull", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			EXPL AAAA 0 A_CustomMissile ("ExplosionSmoke", 32, 0, random (0, 360), 2, random (0, 360))
			RVDP ABCDEFG 5 BRIGHT A_SpawnItem("BlueFlare3",0,30)
			//***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)
			//RVDP GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG 10 A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			RVDP G -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.Fire:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			SKEL LM 4
			SKEL N 4 A_Scream
			SKEL O 4 A_NoBlocking
			SKEL P 1
			TNT1 A 0 A_Playsound("props/redfire")
			CARB NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN 2 A_CustomMissile ("FlameTrails", 25, 0, random (0, 360), 2, random (70, 130))
			CARB NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN 10 A_CustomMissile ("PlasmaSmoke", 25, 0, random (0, 360), 2, random (70, 130))
			CARB N -1 //***Che: Gibbed monsters -- ONLY the gibbed monsters -- may use this
				//   to auto-respawn on nightmare and be raised by viles.
				// Employing this on a destructible corpse results in that corpse
				//   respawning on nightmare as a corpse (or worse, as a burning hollering demon)
				// If a monster's death state spawns a destructible corpse,
				//   the respawning/raising is relegated to that corpse
				//   and the monster MUST use Stop instead
			Stop

		XDeath:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_PlaySound("misc/xdeath4", CHAN_VOICE)
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 //A_Scream
			TNT1 A 0 A_SpawnItem("HellishMissileLauncher")
			
			TNT1 A 0 A_CustomMissile ("XDeathRevenantHead", 52, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
/*			
			TNT1 A 0 A_SpawnItemEx(SkeletonMeatsplosion",0,0,30, velx,vely,velz0, 0,SXF_NOCHECKPOSITION | SXF_TRANSFERTRANSLATION | SXF_ABSOLUTEVELOCITY,0)
			TNT1 A 0 A_SpawnItem("MuchBlood2", 0, 50)
			
			TNT1 AAAAA 0 A_CustomMissile ("RevenantDust", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 AAAAAA 0 A_CustomMissile ("RevenantDust2", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 67, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 AA 0 A_CustomMissile ("RevenantArm", 57, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 AA 0 A_CustomMissile ("MetalShard1", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 160))
			TNT1 AA 0 A_CustomMissile ("MetalShard2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 160))
			TNT1 AA 0 A_CustomMissile ("MetalShard3", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 160))
			
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("XDeath2b", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("XDeath3b", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 AAAAA 0 A_CustomMissile ("RevenantBonesFast", 57, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 AAAAA 0 A_CustomMissile ("RevenantPiece", 57, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 A 0 A_CustomMissile ("RevenantTorso5", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
*/			
			//REDX ABCDEFGHIJK 3
			//TNT1 A 0 A_SpawnItem("GrowingBloodPool")
			TNT1 A -1 //REDX K -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
			
		ExplodeInHalf:
			TNT1 A 0
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			TNT1 A 0 A_Die("Rare") //***Che I've learned this lesson.
				// One simply does NOT walk into Mordor... I mean, a death state.
				// Bad things happen. The game engine gets confused.
				// May have worked before my modifications as this death state had zero length,
				//   but with my new 30-tic delay, this became necessary.
		Death.Rare:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")	
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Scream
			
			//***Che half revenant is a full fledged monster. This is not the end!
			//***Che had to use trickery because half revenant's radius is larger!
			//  If you just naively spawn him in place, he'd likely not spawn at all
			//  or (with SXF_NOCHECKPOSITION) get stuck in map geometry or other actors.
			//  RevenantUSpawner pretends to be a flying half-corpse while using an ACS script
			//    to fumble around for a suitable position for spawning actual FBD_RevenantU.
			SKEX A 0 A_SpawnItemEx("RevenantUSpawner", 0, 0, 40, random(-3,3), random(-3,3), 1, 0, SXF_NOCHECKPOSITION | SXF_CLEARCALLERTID, 0, tid )
			
			TNT1 A 0 A_CustomMissile ("RoamingLegs", 0, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop
		Raise:
			TNT1 A 0
			//TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII") // should not have a headbox by now -- but what if?
			//TNT1 A 0 A_SetUserVar("user_head_type", 4) // revenant head
			TNT1 A 0 A_SpawnItemEx("StandaloneRezSfx",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunMonster", 4)  // revenant head
			SKEL Q 5 
			SKEL PONML 5
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_CustomizeOnRez") // it runs OnRezMapScript
				// if the map prpvides one
			Goto See
			
		FallbackRaise: // we were put into this state by the superarchvile AOE raising, our height is hopelessly kaput and we have to spawn a substitute
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_ChangeFlag("COUNTKILL", 0)
			"----" A 0 A_ChangeFlag("SHOOTABLE", 0)
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2013) // see _mob_list.xlsx
			Stop
			
		FallbackRezSuccess:
			TNT1 A 0 A_SpawnItemEx("StandaloneRezSfx",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30
			Stop			
			
		Pain.KillMe:
		Pain.Taunt:
			"----" A 0
			"----" A 0 HealThing(1)
			//Goto Missile
			"----" A 1 A_Jump(256, "Missile") // inheritance support (see elemenants)
			Wait
		Death.KillMe:
		Death.Taunt:
			//TNT1 A 0 A_ChangeFlag("SOLID", 0)
			//TNT1 A 0 A_SpawnItem("Revenant")
			//Stop
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 A_PlaySound("skeleton/sight", CHAN_VOICE)
			SKLA DCECDCE 2 // shake in rage
			Goto Death.Decaptate // die from a stroke (head falls off)
		
		Death.Ice:
		Death.Freeze:
		Death.Frost:
			TNT1 A 0
			TNT1 A 0 A_StopSound(CHAN_VOICE)
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")	
			//TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			//TNT1 A 0 A_ChangeFlag("SOLID", 0)
			TNT1 A 0 A_NoBlocking // in my version, freeze death is permanent
			TNT1 A 0 A_SpawnItemEx ("FrozenRevenant",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop
			
		Death.Massacre:
			Goto Death
			
		LTGCatCall:
			TNT1 A 0 A_JumpIfInventory("AlreadyPerformedLTGCatCall", 1, "LTGOgle")
			TNT1 A 0 A_GiveInventory("AlreadyPerformedLTGCatCall", 1)
			
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_Jump(256, "LTGCatCall1", "LTGCatCall2")
			Goto LTGCatCall1			
			
		LTGCatCall1:
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 10, -6, 44)
			SKEL YYYY Random(22,30) A_PlaySound("skeleton/catcall", CHAN_VOICE)
			Goto See	

		LTGCatCall2:
			// front-only frames, shaking in rage. Only work properly in singleplayer
			SKLA A 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, -4, 52)
			SKLA B 8 
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 5, 46)
			SKLA CCCCC Random(22,30) A_PlaySound("skeleton/catcall", CHAN_VOICE)
			Goto See
		LTGOgle:
			TNT1 A 0 A_FaceTarget
			
			TNT1 A 0 A_PlaySound("skeleton/catcall", CHAN_VOICE)
			SKLA A 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, -4, 52)
			SKLA B Random(30,90)
			Goto See

		Death.RVFT: // revenant punch from infighting
			TNT1 A 0 A_Jump(32, "Death.Decaptate", "Death.Decaptate", "SpecialDeath")
			Goto Death
	}
}


Actor RevenantRaisedByVile: FBD_Revenant 
{
	// a separate actor in case the raising fails due to insufficient space.
	// if the corpse itself played the raising animation, then spawning failed would look like a game bug.	
	SpawnID 0
	States
	{
		Spawn:
			SKEL B 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 4) // revenant head
			
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)

			TNT1 A 0 A_GiveInventory("IsARevenant", 1)

			SKEL Q 5 
			SKEL PONML 5			
			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 Revenant1_PP: FBD_Revenant
{
	States
	{
		PotPourriSwap:
			TNT1 A 0
			Goto PotPourriCancel		
	}
}


Actor FBD_WoundedNotDeadSkeleton: RevenantRaisedByVile {
	Health 50
}

ACTOR RoamingLegs
{
    Radius 8
    Height 32
    Speed 5
	Health 80
	BloodType "RevenantBlood"
	+SHOOTABLE
    +FLOORCLIP
    +LOOKALLAROUND
    States
    {
		Spawn:
			Goto See
		See:
			DKEL A 0
			DKEL AABBCCDD 2 A_Wander
			DKEL A 0
			DKEL AABBCCDD 2 A_Wander
			DKEL A 0
			DKEL AABBCCDD 2 A_Wander
			DKEL A 0
			DKEL AABBCCDD 2 A_Wander
			DKEL A 0
			DKEL AABBCCDD 2 A_Wander
			DKEL A 0
			DKEL AABBCCDD 2 A_Wander
			DKEL A 0
			DKEL AABBCCDD 2 A_Wander
			DKEL A 0
			DKEL AABBCCDD 2 A_Wander
			DKEL A 0
			DKEL AABBCCDD 2 A_Wander
			DKEL A 0
			DKEL AABBCCDD 2 A_Wander
			DKEL A 0
			DKEL AABBCCDD 2 A_Wander
			Goto Death
		Death:
			TNT1 A 0 A_NoBlocking
			DKEL EFGHI 4
			TNT1 A 0 A_SpawnItemEx("XFBD_DeadSkeleton",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION | SXF_TRANSFERTRANSLATION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		Death.SniperBullet:
		Death.Bullet792:			
		Death.Shotgun:
		Death.Minigun:
		XDeath:
			TNT1 AAAA 0 A_CustomMissile ("RevenantBones", 37, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 AAAAAAA 0 A_CustomMissile ("RevenantPiece", 37, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	   Crush:
			TNT1 A 0
			TNT1 AAAA 0 A_SpawnItemEx ("BodyRemovalThing",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 1 A_XScream
			Stop
	}
}


//***Che: *smart* revenant fireball, for extra pain (also making it a fireball again)

ACTOR FBD_RevenantBall Replaces RevenantTracer
{
	Game Doom
	SpawnID 53
	Radius 10
	Height 4
	Speed 10
	FastSpeed 10
	Damage (random(40,40))
	PROJECTILE
	+THRUGHOST
	+SEEKERMISSILE
	
	-NOBLOCKMAP // without this, A_RadiusGive does not see them and so declumping doesn't work. 
			//BUT THE PERFORMANCE PRICE, OH THE PRICE
	
	//Scale 0.5
	Scale 1.0
    damagetype "Explosives"
	SeeSound "skeleton/attack"
	DeathSound "skeleton/tracex"
	
	//var int user_animphase;
	//var int user_wobble_angle;
	//var int user_wobble_pitch;
	
	var int user_declump_commanded;
	var int user_steering_commanded;
	var int user_item_no;
	var int user_reset_cooldown;
	
	+BRIGHT
	
	States
	{
	
	
//***Che	
//	Spawn:
//	    FATB AA 1 BRIGHT A_SpawnItem("YellowFlareSmall",0,0)
//		TNT1 A 0 A_SpawnItemEx("OldschoolRocketSmokeTrail2", 0, 0, 0, 0, 0, 0, 0, 128) 
//		TNT1 A 0 A_CustomMissile ("OldschoolRocketSmokeTrail2", 2, 0, random (160, 210), 2, random (-30, 30))
//		TNT1 A 0 A_SeekerMissile (4,8, SMF_LOOK)
//		Loop
//		
//		
//	SpawnUnderwater:
//		FATB A 1 BRIGHT A_SpawnItem("RedFlareSmall",0,0)
//		TNT1 A 0 A_CustomMissile ("BUBULZ", 0, 0, random (0, 360), 2, random (0, 180))
//		FATB B 1 BRIGHT A_SpawnItem("RedFlareSmall",0,0)
//		TNT1 A 0 A_CustomMissile ("BUBULZ", 0, 0, random (0, 360), 2, random (0, 180))
//		TNT1 A 0 A_SeekerMissile (4,8)
//		Goto Spawn

// BDv21 overrides FATBA with a rocket sprite.
//   I had to rip original FATBA from Doom2 and include it 
//   as FATBC -- to avoid overriding revenant missile volley
//   where missiles are perfectly fine

		//***Che: why this circus show with pointer swindling, you may ask.
		// Since A_JumpIfTargetInLOS supports checking for tracer directly 
		
		// Buuuut, A_JumpIfInTargetInventory doesn't!
		// We may try, checking target's target -- but there is no guarantee
		//   the revenant who launched us hadn't been killed
		//   and hadn't switched target.
		// So, basically, checking for player being invisible
		//   would have been unreliable, prone to failure.
		//   This coding horror below, full of chulhacks... Is robust.
		
		
		Spawn:
			// this script is CLIENTSIDE meaning the server will tell the client to run it
			// this script has built-in load balancing, it requests for expensive vfx to spawn the trails,
			// every 32 on success, 32..63 on failure tics 
			// script terminates when the activator (this actor) loses it MISSILE flag (meaning it hit)
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("RevenantFireballTrails", 0) // 0 standard revenant fireball
			TNT1 A 0 ACS_NamedExecuteWithResult("RFDeclumpManageServerside")
			
		FlyTargetless:
			FATB CB 2
			"----" A 0 A_SeekerMissile (8,16, SMF_LOOK | SMF_PRECISE) // can acqire a tracer
			"----" A 0 A_CheckFlag("SOLID", "AcquiredTarget", AAPTR_TRACER)
			Loop
			
		AcquiredTarget:	
			"----" A 0 A_JumpIf(CallAcs("FBD_TracerIsInvisible"), "ConfusedWobble")
		Fly:	
			"----" A 0 A_JumpIfTargetInLOS("Home", 0, JLOSF_PROJECTILE | JLOSF_DEADNOJUMP, 0, 0)
			FATB CBCB 2 // only resume homing after 8 tics of losing LOS
			
			// If we *do* have a target but it is out of sight, we fly in a straight line doing nothing
			// But if we don't have a target, we fly in a straight line searching for a new target!
			"----" A 0 A_JumpIf(CallAcs("GetNoTracer"), "FlyTargetless")
			Loop
		Home:
			"----" A 0 A_SeekerMissile (8,16, SMF_PRECISE) // no delay between sight checking and turning
			"----" A 0 A_JumpIf(user_steering_commanded, "PerformDeclump")
			"----" A 0 A_JumpIf(user_declump_commanded, "CheckDeClump")			
			FATB CB 2
			Goto Fly

		ConfusedWobble:
			FATB CB 2
			"----" A 0 A_Jump(64, "FlyAtInvisible")
			"----" A 0 A_SetAngle(angle + 1.0 * CallACS("FBD_PseudoRandom", -5, 5))
			"----" A 0 A_ChangeVelocity(momx, momy, momz + 0.1 * CallACS("FBD_PseudoRandom", z - floorz > 32 ? -3 : 0, ceilingz - z > 32 ? 3 : 0), CVF_REPLACE)
			Loop
			
		FlyAtInvisible:
			// jump if closer than 600 map units to our tracer
			FATB CB 2
			"----" A 0 A_JumpIf(!CallAcs("FBD_TracerIsInvisible"), "Fly") // start flying normally immediately as player's invisibility runs out
			"----" A 0 A_SeekerMissile (8,16, SMF_PRECISE) // very weakened turning
			"----" A 0 A_SetAngle(angle + 0.1 * CallACS("FBD_PseudoRandom", -30, 30))
			"----" A 0 A_ChangeVelocity(momx, momy, momz + 0.01 * CallACS("FBD_PseudoRandom", z - floorz > 48 ? -20 : 0, ceilingz - z > 48 ? 20 : 0), CVF_REPLACE)
			"----" A 0 A_Jump(32, "FlyStraight")
			"----" A 0 A_JumpIfTargetInLOS("ConfusedWobble", 0, JLOSF_PROJECTILE | JLOSF_CLOSENOSIGHT, 0, 600)
			Loop
			
		FlyStraight: 
			// the first 12 tics, do not home
			// never retargets if the original target is lost
			FATB CBCBCB 2		
			"----" A 0 A_CheckFlag("SOLID", "AcquiredTarget", AAPTR_TRACER)
			Loop
			
		CheckDeClump:	
			TNT1 A 0
			TNT1 A 0 A_SetUserVar("user_declump_commanded", 0) // is set to 1 by a serverside-only ACS scrpt, according the load balancer
			TNT1 A 0 A_JumpIf(!CallAcs("GetIsZandronum"), "CheckDeClumpGZDoom") // GZDoom iterates over *all* missiles in the map including blood and flame particles every time you invoke A_RadiusGive with RGF_MISSILES. On a slaughtermap, it's a killer!
			// 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 BRIGHT A_RadiusGive("RFDeClumpCountServerside", 32, RGF_OBJECTS | RGF_MISSILES |  RGF_CUBE | RGF_NOSIGHT, 1)	
			FATB CB 2
			Goto Home
			
		CheckDeClumpGZDoom:	
			TNT1 A 0 A_JumpIf(!CallAcs("FBD_RequestExoticManeuver", 1, 2, 2), 2)
			TNT1 A 0 BRIGHT A_RadiusGive("RFDeClumpCountServerside", 32, RGF_MISSILES | RGF_CUBE | RGF_NOSIGHT, 50)	
			FATB CB 2
			Goto Home			

		PerformDeclump:
			TNT1 A 0
			TNT1 A 0 A_SetUserVar("user_steering_commanded", 0)
			
			// change direction, then fly in a straight line for one second
			"----" A 0 A_SetAngle(angle + 1.0 * CallACS("FBD_PseudoRandom", -6, 6))
			"----" A 0 A_ChangeVelocity(momx, momy, 0.01 * CallACS("FBD_PseudoRandom", z - floorz > 48 ? -20 : 5, ceilingz - z > 48 ? 20 : -5), CVF_REPLACE)
			FATB CBCBCBCBCBCBCBCB 2
			Goto AcquiredTarget
		
		Crash:
		Xdeath:	
		Death:
			TNT1 A 0
			TNT1 A 0 Bright A_Explode(7, 120, 1)
			Goto Explodez
		Explodez:	
			EXPL A 0 Radius_Quake (6, 54, 0, 15, 0)
			TNT1 A 0 A_SpawnItem("WhiteShockwaveSmall")
			EXPL A 0 A_CustomMissile ("ExplosionSmoke", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 0 A_SpawnItemEx ("UnderwaterExplosion",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItemEx ("DetectFloorCrater",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItemEx ("DetectCeilCrater",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItemEx ("ExplosionFlareSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 AAA 0 A_CustomMissile ("BDExplosionparticles", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 AA 0 A_CustomMissile ("BDExplosionparticles2", 0, 0, random (0, 360), 2, random (0, 90))
			EXPL A 0
			TNT1 AAAA 0 A_CustomMissile ("SmallExplosionFlames", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0
			Stop
	}
}



ACTOR FastRevenantBall: FBD_RevenantBall
//***Che a base for player's rev. launcher missiles
{
	Speed 30
	FastSpeed 30
	// since it is three times faster it must seek at three times the frequency (actually, four)
	States {
		Spawn:
			// this script is CLIENTSIDE meaning the server will tell the client to run it
			// this script has built-in load balancing, it requests for expensive vfx to spawn the trails,
			// every 32 on success, 32..63 on failure tics 
			// script terminates when the activator (this actor) loses it MISSILE flag (meaning it hit)
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("RevenantFireballTrails", 0) // 0 standard revenant fireball
			TNT1 A 0 ACS_NamedExecuteWithResult("RFDeclumpManageServerside")
			
		FlyTargetless:
			"----" A 0 A_JumpIf(!CallAcs("GetIsZandronum"), "FlyTargetlessGZDoom") // GZDoom iterates over *all* missiles in the map including blood and flame particles every time you invoke A_RadiusGive with RGF_MISSILES. On a slaughtermap, it's a killer!
			FATB C 1
			"----" A 0 A_SeekerMissile (8,16, SMF_LOOK | SMF_PRECISE) // can acqire a tracer
			"----" A 0 A_CheckFlag("SOLID", "AcquiredTarget", AAPTR_TRACER)
			FATB C 1
			"----" A 0 A_SeekerMissile (8,16, SMF_LOOK | SMF_PRECISE) // can acqire a tracer
			"----" A 0 A_CheckFlag("SOLID", "AcquiredTarget", AAPTR_TRACER)
			FATB B 1
			"----" A 0 A_SeekerMissile (8,16, SMF_LOOK | SMF_PRECISE) // can acqire a tracer
			"----" A 0 A_CheckFlag("SOLID", "AcquiredTarget", AAPTR_TRACER)
			FATB B 1
			"----" A 0 A_SeekerMissile (8,16, SMF_LOOK | SMF_PRECISE) // can acqire a tracer
			"----" A 0 A_CheckFlag("SOLID", "AcquiredTarget", AAPTR_TRACER)
			// player's are much more agressive in declumping (the demon eletech gun alt fire fires packs of clumped fireballs) 
			"----" A 0 A_RadiusGive("RFDeClumpCountServerside", 32, RGF_MISSILES | RGF_CUBE | RGF_NOSIGHT, 1)
			"----" A 0 A_JumpIf(user_steering_commanded, "PerformDeclump")
			Loop
			
		FlyTargetlessGZDoom:
			FATB C 1
			"----" A 0 A_SeekerMissile (8,16, SMF_LOOK | SMF_PRECISE) // can acqire a tracer
			"----" A 0 A_CheckFlag("SOLID", "AcquiredTarget", AAPTR_TRACER)
			FATB C 1
			"----" A 0 A_SeekerMissile (8,16, SMF_LOOK | SMF_PRECISE) // can acqire a tracer
			"----" A 0 A_CheckFlag("SOLID", "AcquiredTarget", AAPTR_TRACER)
			FATB B 1
			"----" A 0 A_SeekerMissile (8,16, SMF_LOOK | SMF_PRECISE) // can acqire a tracer
			"----" A 0 A_CheckFlag("SOLID", "AcquiredTarget", AAPTR_TRACER)
			FATB B 1
			"----" A 0 A_SeekerMissile (8,16, SMF_LOOK | SMF_PRECISE) // can acqire a tracer
			"----" A 0 A_CheckFlag("SOLID", "AcquiredTarget", AAPTR_TRACER)
			// player's are much more agressive in declumping (the demon eletech gun alt fire fires packs of clumped fireballs) 
			"----" A 0 A_JumpIf(!CallAcs("FBD_RequestExoticManeuver", 1, 2, 2), 2)
			"----" A 0 A_RadiusGive("RFDeClumpCountServerside", 32, RGF_MISSILES | RGF_CUBE | RGF_NOSIGHT, 50)
			"----" A 0 A_JumpIf(user_steering_commanded, "PerformDeclump")
			Loop			
			
		AcquiredTarget:	
			"----" A 0 A_JumpIf(CallAcs("FBD_TracerIsInvisible"), "ConfusedWobble")
		Fly:	
			"----" A 0 A_JumpIfTargetInLOS("Home", 0, JLOSF_PROJECTILE | JLOSF_DEADNOJUMP, 0, 0)
			FATB CCB 1 // only resume homing after 3 tics of losing LOS
			
			// If we *do* have a target but it is out of sight, we fly in a straight line doing nothing
			// But if we don't have a target, we fly in a straight line searching for a new target!
			"----" A 0 A_JumpIf(CallAcs("GetNoTracer"), "FlyTargetless")
			Loop
		Home:
			"----" A 0 A_JumpIf(user_steering_commanded, "PerformDeclump")
			"----" A 0 A_JumpIf(!CallAcs("GetIsZandronum"), "HomeGZDoom") // GZDoom iterates over *all* missiles in the map including blood and flame particles every time you invoke A_RadiusGive with RGF_MISSILES. On a slaughtermap, it's a killer!
			"----" A 0 A_RadiusGive("RFDeClumpCountServerside", 32, RGF_MISSILES | RGF_CUBE | RGF_NOSIGHT, 1)		
			FATB CCBB 1 A_SeekerMissile (8,16, SMF_PRECISE) // no delay between sight checking and turning
			Goto Fly
			
		HomeGZDoom:
			"----" A 0 A_JumpIf(!CallAcs("FBD_RequestExoticManeuver", 1, 2, 2), 2)
			"----" A 0 A_RadiusGive("RFDeClumpCountServerside", 32, RGF_MISSILES | RGF_CUBE | RGF_NOSIGHT, 50)		
			FATB CCBB 1 A_SeekerMissile (8,16, SMF_PRECISE) // no delay between sight checking and turning
			Goto Fly

		ConfusedWobble:
			FATB C 1
			"----" A 0 A_Jump(64, "FlyAtInvisible")
			"----" A 0 A_SetAngle(angle + 1.0 * CallACS("FBD_PseudoRandom", -5, 5))
			"----" A 0 A_ChangeVelocity(momx, momy, momz + 0.1 * CallACS("FBD_PseudoRandom", z - floorz > 32 ? -3 : 0, ceilingz - z > 32 ? 3 : 0), CVF_REPLACE)
			FATB C 1
			"----" A 0 A_Jump(64, "FlyAtInvisible")
			"----" A 0 A_SetAngle(angle + 1.0 * CallACS("FBD_PseudoRandom", -5, 5))
			"----" A 0 A_ChangeVelocity(momx, momy, momz + 0.1 * CallACS("FBD_PseudoRandom", z - floorz > 32 ? -3 : 0, ceilingz - z > 32 ? 3 : 0), CVF_REPLACE)
			FATB B 1
			"----" A 0 A_Jump(64, "FlyAtInvisible")
			"----" A 0 A_SetAngle(angle + 1.0 * CallACS("FBD_PseudoRandom", -5, 5))
			"----" A 0 A_ChangeVelocity(momx, momy, momz + 0.1 * CallACS("FBD_PseudoRandom", z - floorz > 32 ? -3 : 0, ceilingz - z > 32 ? 3 : 0), CVF_REPLACE)
			FATB B 1
			"----" A 0 A_Jump(64, "FlyAtInvisible")
			"----" A 0 A_SetAngle(angle + 1.0 * CallACS("FBD_PseudoRandom", -5, 5))
			"----" A 0 A_ChangeVelocity(momx, momy, momz + 0.1 * CallACS("FBD_PseudoRandom", z - floorz > 32 ? -3 : 0, ceilingz - z > 32 ? 3 : 0), CVF_REPLACE)
			Loop
			
		FlyAtInvisible:
			// jump if closer than 600 map units to our tracer
			FATB C 1
			"----" A 0 A_JumpIf(!CallAcs("FBD_TracerIsInvisible"), "Fly") // start flying normally immediately as player's invisibility runs out
			"----" A 0 A_SeekerMissile (8,16, SMF_PRECISE) // very weakened turning
			"----" A 0 A_SetAngle(angle + 0.1 * CallACS("FBD_PseudoRandom", -30, 30))
			"----" A 0 A_ChangeVelocity(momx, momy, momz + 0.01 * CallACS("FBD_PseudoRandom", z - floorz > 48 ? -20 : 0, ceilingz - z > 48 ? 20 : 0), CVF_REPLACE)
			"----" A 0 A_Jump(32, "FlyStraight")
			"----" A 0 A_JumpIfTargetInLOS("ConfusedWobble", 0, JLOSF_PROJECTILE | JLOSF_CLOSENOSIGHT, 0, 600)
			FATB C 1
			"----" A 0 A_JumpIf(!CallAcs("FBD_TracerIsInvisible"), "Fly") // start flying normally immediately as player's invisibility runs out
			"----" A 0 A_SeekerMissile (8,16, SMF_PRECISE) // very weakened turning
			"----" A 0 A_SetAngle(angle + 0.1 * CallACS("FBD_PseudoRandom", -30, 30))
			"----" A 0 A_ChangeVelocity(momx, momy, momz + 0.01 * CallACS("FBD_PseudoRandom", z - floorz > 48 ? -20 : 0, ceilingz - z > 48 ? 20 : 0), CVF_REPLACE)
			"----" A 0 A_Jump(32, "FlyStraight")
			"----" A 0 A_JumpIfTargetInLOS("ConfusedWobble", 0, JLOSF_PROJECTILE | JLOSF_CLOSENOSIGHT, 0, 600)
			FATB B 1
			"----" A 0 A_JumpIf(!CallAcs("FBD_TracerIsInvisible"), "Fly") // start flying normally immediately as player's invisibility runs out
			"----" A 0 A_SeekerMissile (8,16, SMF_PRECISE) // very weakened turning
			"----" A 0 A_SetAngle(angle + 0.1 * CallACS("FBD_PseudoRandom", -30, 30))
			"----" A 0 A_ChangeVelocity(momx, momy, momz + 0.01 * CallACS("FBD_PseudoRandom", z - floorz > 48 ? -20 : 0, ceilingz - z > 48 ? 20 : 0), CVF_REPLACE)
			"----" A 0 A_Jump(32, "FlyStraight")
			"----" A 0 A_JumpIfTargetInLOS("ConfusedWobble", 0, JLOSF_PROJECTILE | JLOSF_CLOSENOSIGHT, 0, 600)
			FATB B 1
			"----" A 0 A_JumpIf(!CallAcs("FBD_TracerIsInvisible"), "Fly") // start flying normally immediately as player's invisibility runs out
			"----" A 0 A_SeekerMissile (8,16, SMF_PRECISE) // very weakened turning
			"----" A 0 A_SetAngle(angle + 0.1 * CallACS("FBD_PseudoRandom", -30, 30))
			"----" A 0 A_ChangeVelocity(momx, momy, momz + 0.01 * CallACS("FBD_PseudoRandom", z - floorz > 48 ? -20 : 0, ceilingz - z > 48 ? 20 : 0), CVF_REPLACE)
			"----" A 0 A_Jump(32, "FlyStraight")
			"----" A 0 A_JumpIfTargetInLOS("ConfusedWobble", 0, JLOSF_PROJECTILE | JLOSF_CLOSENOSIGHT, 0, 600)
			Loop
			
		FlyStraight: 
			// the first 4 tics, do not home
			// never retargets if the original target is lost

			"----" A 0
			"----" A 0 A_JumpIf(!CallAcs("GetIsZandronum"), "FlyStraightGZDoom") // GZDoom iterates over *all* missiles in the map including blood and flame particles every time you invoke A_RadiusGive with RGF_MISSILES. On a slaughtermap, it's a killer!
			
		FlyStraightZandronum:	
			FATB CB 2		
			"----" A 0 A_CheckFlag("SOLID", "AcquiredTarget", AAPTR_TRACER)
			"----" A 0 A_JumpIf(user_steering_commanded, "PerformDeclump")
			
			"----" A 0 A_RadiusGive("RFDeClumpCountServerside", 32, RGF_MISSILES | RGF_CUBE | RGF_NOSIGHT, 1)	
			Loop

		FlyStraightGZDoom:
			FATB CB 2		
			"----" A 0 A_CheckFlag("SOLID", "AcquiredTarget", AAPTR_TRACER)
			"----" A 0 A_JumpIf(user_steering_commanded, "PerformDeclump")
			
			"----" A 0 A_JumpIf(!CallAcs("FBD_RequestExoticManeuver", 1, 2, 2), 2)
			"----" A 0 A_RadiusGive("RFDeClumpCountServerside", 32, RGF_MISSILES | RGF_CUBE | RGF_NOSIGHT, 50)
			"----" A 0 // <- an empty frame to jump to
			Loop
			
	}
}

/*
ACTOR RevenantFirebalSFest// : FBD_RevenantBall{ // does NOT have a dynamic light assigned in GLDEFS
{
	
	// the key difference: does NOT perform line of sight checks, homes always like the classical fireball.
	// the only concession is checking if the tracer (the actors it is aimed at) is invisible, once per second
	
	Game Doom
	SpawnID 53
	Radius 10
	Height 4
	Speed 10
	FastSpeed 10
	Damage (random(40,40))
	PROJECTILE
	+THRUGHOST
	+SEEKERMISSILE
	-NOBLOCKMAP // without this, A_RadiusGive does not see them. BUT THE PERFORMANCE PRICE, OH THE PRICE
	//Scale 0.5
	Scale 1.0
    damagetype "Explosives"
	SeeSound "skeleton/attack"
	DeathSound "skeleton/tracex"
	
	var int user_animphase;
	var int user_wobble_angle;
	var int user_wobble_pitch;
	var int user_declump_commanded;
	var int user_steering_commanded;
	var int user_item_no;	
	

	States {
		Spawn:
			TNT1 A 0 
			// store a copy of target(the revenant) in the master
			TNT1 A 0 A_RearrangePointers (AAPTR_DEFAULT, AAPTR_TARGET, AAPTR_DEFAULT, PTROP_NOSAFEGUARDS) 
			TNT1 A 0 ACS_NamedExecuteAlways("RFDeclumpManageServerside", 0) // runs until we disappear
			Goto Fly

		RestorePointersAndFly:
			// unless we restore pointers before moving on, any monster hit by accident would
			// aggro at the revenant's enemy this fireball is aimed at instead of the revenant
			TNT1 A 0
			// move target from master to its rightful place
			TNT1 A 0 A_RearrangePointers (AAPTR_MASTER, AAPTR_DEFAULT, AAPTR_DEFAULT, PTROP_NOSAFEGUARDS)
			FATB BBCCBBCCBBCCBBCC 2 BRIGHT A_SeekerMissile (4,8, SMF_LOOK | SMF_PRECISE) // one second
		Fly:	
			
			// overwrite target with tracer, allows checking LOS and inventory on tracer
			TNT1 A 0 A_RearrangePointers (AAPTR_TRACER, AAPTR_DEFAULT, AAPTR_DEFAULT, PTROP_NOSAFEGUARDS)
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "RestorePointersAndSpiralOutOfControl")
			TNT1 A 0 A_JumpIf(user_steering_commanded, "PerformDeclump")
			TNT1 A 0 A_JumpIf(user_declump_commanded, "CheckDeClump")
			Goto RestorePointersAndFly
		CheckDeClump:	
			TNT1 A 0
			TNT1 A 0 A_SetUserVar("user_declump_commanded", 0)
			// 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 BRIGHT A_RadiusGive("RFDeClumpCountServerside", 32, RGF_OBJECTS | RGF_MISSILES | RGF_MONSTERS | RGF_CUBE | RGF_NOSIGHT, 1)
			
			Goto RestorePointersAndFly
		PerformDeclump: 	
			TNT1 A 0
			TNT1 A 0 A_SetUserVar("user_steering_commanded", 0)
			// move target from master to its rightful place
			TNT1 A 0 A_RearrangePointers (AAPTR_MASTER, AAPTR_DEFAULT, AAPTR_DEFAULT, PTROP_NOSAFEGUARDS)			
			TNT1 A 0 A_SetAngle(angle + 1.0 * user_wobble_angle)
			TNT1 A 0 A_ChangeVelocity(momx, momy, momz + 0.1 * user_wobble_pitch, CVF_REPLACE)
			FATB CCBBCCBBCCBBCCBB 2 BRIGHT // fly in a straight line for one second
			//KYDB GGGGGGGGGGGGGGGG 2 BRIGHT
			TNT1 A 0 A_SetUserVar("user_wobble_angle", 0)
			TNT1 A 0 A_SetUserVar("user_wobble_pitch", 0)
			Goto Fly
		
		
		// the sfest projectile does NOT check if player became visible again -- its wobbling is permanent
		// nor does it try changing targets
		RestorePointersAndSpiralOutOfControl:
			TNT1 A 0
			// move target from master to its rightful place and clear master
			TNT1 A 0 A_RearrangePointers (AAPTR_MASTER, AAPTR_NULL, AAPTR_DEFAULT, PTROP_NOSAFEGUARDS)
		HomeAtInvisible:	
			// the main animated sprite
			
			TNT1 A 0 A_SetUserVar("user_animphase", user_animphase + 1)
			TNT1 A 0 A_JumpIf(user_animphase < 4, 2)
			TNT1 A 0 A_SetUserVar("user_animphase", 0)
			TNT1 A 0 A_JumpIf(user_animphase < 2, 2)
			FATB C 2 BRIGHT
			TNT1 A 0 A_JumpIf(user_animphase >= 2, 2)
			FATB B 2 BRIGHT
			
			// the behavior
			TNT1 A 0 A_Jump(192, "wobble")
			TNT1 A 0 A_SetUserVar("user_wobble_pitch", user_wobble_pitch / 2)
			TNT1 A 0 A_SeekerMissile (4,8, SMF_PRECISE) // note the look flag is omitted
			
			Loop
		Wobble:
			TNT1 A 0 A_SetUserVar("user_wobble_angle", user_wobble_angle + Random(-3, 3))
			TNT1 A 0 A_SetUserVar("user_wobble_pitch", user_wobble_pitch + Random(-3, 3))
			
			// diminishes slowly approaching zero, to avoid runaway effect
			TNT1 A 0 A_JumpIf(user_wobble_pitch < 1, 2)
			TNT1 A 0 A_SetUserVar("user_wobble_pitch", user_wobble_pitch - 1)
			TNT1 A 0 A_JumpIf(user_wobble_pitch > -1, 2)
			TNT1 A 0 A_SetUserVar("user_wobble_pitch", user_wobble_pitch + 1)
			
			TNT1 A 0 A_SetAngle(angle + user_wobble_angle)
			TNT1 A 0 A_ChangeVelocity(momx, momy, momz + 0.1 * user_wobble_pitch, CVF_REPLACE)
			Goto HomeAtInvisible			
		Death:
		XDeath:
		Crash:
			TNT1 A 0
			TNT1 A 0 A_Explode(7, 120, 1)
			TNT1 A 0 A_RearrangePointers (AAPTR_DEFAULT, AAPTR_NULL, AAPTR_DEFAULT, 0) // clear the master field
			//FBXP A 8 Bright
			//FBXP B 6 Bright
			//FBXP C 4 Bright
			TNT1 A 0 A_SetScale(0.7)
			TNT1 A 0 A_FadeOut(0.2)
			FRPR ABCDEFGH 2 BRIGHT
			Stop
	}
}
*/


ACTOR RevenantUnguidedRocket: FBD_RevenantBall
{
	Speed 20
	FastSpeed 30
	//Scale 0.5
	States
	{

//***Che: Oopsie... restoring what i just overrode!
//	Spawn:
//		FATB AA 1 BRIGHT A_SpawnItem("YellowFlareSmall",0,0)
//		TNT1 A 0 A_SpawnItemEx("OldschoolRocketSmokeTrail2", 0, 0, 0, 0, 0, 0, 0, 128) 
//		TNT1 A 0 A_CustomMissile ("OldschoolRocketSmokeTrail2", 2, 0, random (160, 210), 2, random (-30, 30))
//		Loop

		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("RevenantRocketTrails")
		Fly:
			FATB V 1 // my new sprite
			Loop
	}
}

/*
ACTOR RevenantMissileSfest: RevenantUnguidedRocket {
	States {
		Spawn:
			FATB AAAAAAA 1 BRIGHT
			Loop
		Death:
		XDeath:
		Crash:
			TNT1 A 0
			TNT1 A 0 A_Explode(7, 120, 1)			
			//FBXP A 8 Bright
			//FBXP B 6 Bright
			//FBXP C 4 Bright
			TNT1 A 0 A_SetScale(0.7)
			TNT1 A 0 A_FadeOut(0.2)
			FRPR ABCDEFGH 2 BRIGHT
			Stop		
	}
}
*/


//***Che: removed in BD v 21, bringing this cut content back
// P.S Ewww, they look like shit :(
ACTOR RevenantProjectileTrails: FlameTrails
{

    //Scale 0.1
	Scale 0.15
	States
	{
		Spawn:
			TNT1 A 0 NODELAY A_Warp(AAPTR_DEFAULT, 0,0,5) // fireball sprite's center is 3 pixels above its origin but FRPR is perfectly centered. We need to move 3 map units up.
			TNT1 A 0 A_Jump(192, "Spawn2", "Spawn3", "Spawn4")
			Goto Fly
		Spawn2:
			TNT1 A 0
			TNT1 A 0 A_SetScale(0.1, -0.1)
			Goto Fly
		Spawn3:
			TNT1 A 0
			TNT1 A 0 A_SetScale(-0.1, 0.1)
			Goto Fly
		Spawn4:
			TNT1 A 0
			TNT1 A 0 A_SetScale(-0.1, -0.1)
			Goto Fly
		Fly:
			TNT1 A 2
			FRPR BCDEFGH 1 BRIGHT
			Stop
	}
}




Actor FBD_DeadSkeleton: FBD_CurbstompedMarine
{
    Radius 12 //***Che: cannot afford, need be no less than monster's -- otherwise, raising failures! //4
    Height 18
    Scale 1.0
    +SHOOTABLE
    +NOTELEPORT
    +MOVEWITHSECTOR
    +CORPSE
	+FLOORCLIP
	-SOLID
	+NORADIUSDMG
	damagefactor "Crusher", 50.0
    Mass 1000
    Health 200
    damagefactor "Blood", 0.0
    damagefactor "Trample", 0.0
	damagefactor "Saw", 0.3
	bloodtype "RevenantBlood", "RevenantBloodSaw", "RevenantBloodSaw"
	States
		{
		Raise:
			// note: the frame letter of the "----" (keep previous) sprite is ignored
			"----" A 0
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_NoBlocking // the raising code deep in C++ makes it solid

			"----" A 0 A_JumpIf(!CallAcs("EnoughSpaceToRezNormally", 2013), "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 ("RevenantRaisedByVile",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, 13, 0, 0) //"RevenantRaisedByVile"
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2013) // 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
			SKEL Q 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
			SKEL Q 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "Death.Burn")
			SKEL Q -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		Death.SniperBullet:
		Death.Bullet792:			
		Death.Minigun: 
		Death.Cut: 
		Death: 
		Death.Saw: 
		Death.Shotgun: 
		Death.SSG: 
		Death.Blast:
			TNT1 A 0 A_NoBlocking
			TNT1 AAAA 0 A_CustomMissile ("RevenantBones", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 AAA 0 A_CustomMissile ("RevenantPiece", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 A 0 A_CustomMissile ("RevenantTorso5", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 AA 0 A_CustomMissile ("RevenantArm", 7, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 A 0 A_CustomMissile ("XDeathHalfSkeleton", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			// XDeathHalfSkeleton is a gib, not a corpse
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop

		Death.flames:
		Death.burn:
		Death.Plasma: 
		Death.Plasma2:
		Death.Electric:
		Death.Bfg10k: //***Che changed damage type from extreme to custom		
			TNT1 A 0
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedSkull", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			EXPL AAAAAA 0 A_CustomMissile ("ExplosionSmoke", 32, 0, random (0, 360), 2, random (0, 360))
			//***Che detaching smoke emittinf from burned corpses
			// because archvile would otherwise only rez the corpse after it stopped smoking
			TNT1 A 0 A_SpawnItemEx("FBD_CorpseSmoke",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0,0)
			//CARB NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN 10 A_CustomMissile ("SmallSmoke", 1, 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)
			CARB N -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)	
			Stop
			
		Death.Cut:
		Death.Saw:
			TNT1 A 0
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 7, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 AAA 0 A_CustomMissile ("RevenantBones", 7, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 AA 0 A_CustomMissile ("RevenantArm", 7, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 A 0 A_CustomMissile ("XDeathHalfSkeleton", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_SpawnItemEx ("XFBD_DeadSkeleton",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,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
	}
}

Actor NotFBD_DeadSkeleton: FBD_DeadSkeleton 

{
	Health 50 
	damagefactor "Kick", 50.0
	-THRUACTORS
	-CORPSE // this one is not raiseable anyway because viles require current frame dutation of -1
	Radius  12 //***Che: cannot afford, need be no less than monster's otherwise raising failures! //1
	States{
		Spawn:
			SKEL Q 500
			SKEL PONML 5
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_fall
			TNT1 A 0 A_SpawnItemEx("FBD_WoundedNotDeadSkeleton", 0,0,0, 0,0,0, 0,0,0) // 50 health //("Revenant1", 3)
			TNT1 A 1
			TNT1 A 0 // A_SpawnItem("KillMe") //***Che wtf d00d
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}


Actor FBD_DeadSkeletonNoHead: FBD_DeadSkeleton
{
	Health 200 
	+SHOOTABLE
	Radius  12 //***Che: cannot afford, need be no less than monster's otherwise raising failures! //4
	Height 18
	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
			REVH 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
			REVH D 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			REVH D -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop			
	}
}

Actor XFBD_DeadSkeleton: FBD_DeadSkeleton //legs only
{
	Health 200 
	States{
		Raise:
			Stop // cancel state
		//***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
			DKEL H 5 A_CheckFloor("Slide")
			Loop
		Slide:
			DKEL I 5
			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
			DKEL I 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "Death")
			DKEL I -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		Death.SniperBullet:
		Death.Bullet792:			
		Death.Minigun: 
		Death.Cut: 
		Death: 
		Death.Saw: 
		Death.Shotgun: 
		Death.SSG: 
		Death.Blast:
			TNT1 A 0 A_NoBlocking
			TNT1 AAAA 0 A_CustomMissile ("RevenantBones", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 AAA 0 A_CustomMissile ("RevenantPiece", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 A 0 A_CustomMissile ("RevenantTorso5", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150)) //actually his hip bone
			
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}
		
Actor XFBD_DeadSkeleton22: XFBD_DeadSkeleton // legs only, begin with one cycle of walking animation
{
	-CORPSE
	-ISMONSTER
	Health 200 
	States{
		Raise:
			Stop // cancel state
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
			DKEL ABCDEF 6
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			DKEL G 6
		StayContinue:
			DKEL 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
			DKEL I 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "Death") //LandOnLava")	
			DKEL I -1 A_ChangeFlag("CORPSE", 0) // do NOT respawn
			Stop
		Death.SniperBullet:
		Death.Bullet792:			
		Death.Minigun: 
		Death.Cut: 
		Death: 
		Death.Saw: 
		Death.Shotgun: 
		Death.SSG: 
		Death.Blast:
			TNT1 A 0 A_NoBlocking
			TNT1 AAAA 0 A_CustomMissile ("RevenantBones", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 AAA 0 A_CustomMissile ("RevenantPiece", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 A 0 A_CustomMissile ("RevenantTorso5", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150)) //actually his hip bone
			
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // do NOT respawn
			Stop
	}
}

Actor XFBD_DeadSkeleton22Still : XFBD_DeadSkeleton22 {
	States
	{
		Spawn:
		Stay:
			DKEL I 1
			Goto Land
	}
}
		

Actor BlastedFBD_DeadSkeleton: FBD_DeadSkeleton //XFBD_DeadSkeleton
	// with a hole in his chest, otherwise all limbs accounted for
{
	Health 200 
	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
			SKL4 E 5 
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Stay") // not until the actor stops sliding		
		Land:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			SKL4 E 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			SKL4 E -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop				
	}
}		
		
//***Che:: this one was missing, DyingRevenant stopping on FRVX C -1 without being raiseable nor destructible
ACTOR FatalizedSkeletonFRVXC: FBD_DeadSkeletonNoHead {
	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
			FRVX C 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
			FRVX C 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			FRVX C -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop	
	}
}		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
ACTOR REvenantAttack: ZandronumBaronBall //BaronBall
{
	Radius 8
	Height 16
	DamageType RVFT
	Projectile 
	+RANDOMIZE
	+FORCEXYBILLBOARD
    +THRUGHOST
	RenderStyle Add
	Alpha 0.6
    Damage (random(15,15))
    Speed 28
	//HitObituary "$OB_IMPHIT"
	SeeSound "none"
	DeathSound "none"
	Decal "none"
	
	//***Che otherwise it was registering a successful punch on hitting adjacent revenant 
	// causing them march forward in an endless punching cycle 
	+MTHRUSPECIES
	
	+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
	
	Species "Revenants"
	
	States
	{
		KinslayerAdjust:
			TNT1 A 0 A_ChangeFlag("MTHRUSPECIES", 0)
			TNT1 A 0 A_ChangeFlag("THRUSPECIES", 0)
			Goto Fly
		Spawn:
			TNT1 A 0 NODELAY A_JumpIfInTargetInventory("IsAKinSlayer", 1, "KinslayerAdjust")
		Fly:		
		//Spawn:
			TNT1 A 2 BRIGHT
			TNT1 A 0 A_GiveInventory("MeleeMiss", 1, AAPTR_TARGET)
			Stop
		Death: // hit a wall
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("MeleeMiss", 1, AAPTR_TARGET)
			Stop
		Crash: // hit a non-bleeding actor
			TNT1 A 0
			TNT1 A 0 A_SpawnItem("HitPuff")
			TNT1 A 0 A_GiveInventory("MeleeMiss", 1, AAPTR_TARGET)
			Stop
		XDeath: // hit a bleeding actor
			TNT1 A 0 BRIGHT
			TNT1 A 1 A_JumpIf(IsPointerEqual(AAPTR_TRACER, AAPTR_MASTER), "Success")
		Failure:	
			// we hit someone but it wasn't our intended target
			TNT1 A 0 A_GiveInventory("MeleeMiss", 1, AAPTR_TARGET)
			TNT1 A 0 A_PlaySound("skeleton/melee", 6)
			EXPL AAA 0 A_CustomMissile ("MeleeSmoke", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 4
			Stop
		Success:
			TNT1 A 0 A_GiveInventory("MeleeHitSuccess", 1, AAPTR_TARGET)
			TNT1 A 0 A_TakeInventory("MeleeMiss", 1, AAPTR_TARGET) // he fires them in pairs,
			  // high and low. One is ought to miss.
			TNT1 A 0 A_PlaySound("skeleton/melee", 6)
			EXPL AAA 0 A_CustomMissile ("MeleeSmoke", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 0 Radius_Quake (2, 6, 0, 5, 0)//(intensity, duration, damrad, tremrad, tid)
			TNT1 A 4
			Stop
			
	}
}












ACTOR RevenantPiece // a small bloodied rotating triangle
{
    Radius 2
    Height 2
    Speed 7
	Mass 3
	BounceFactor 0.4
	BounceCount 4
	+DOOMBOUNCE
    +NOBLOCKMAP
	+MISSILE
    +NOTELEPORT
    +DONTSPLASH
    +MOVEWITHSECTOR
    +CLIENTSIDEONLY
	+THRUACTORS
    Scale 0.4
    States
    {
		Spawn:
			TNT1 A 0
			//***Che: what the fug?
			//TNT1 A 0 Thing_ChangeTID(0,394)
			
			TNT1 A 0 A_Jump(128,9)
			SPIC ABCDEFGH 2
			wait
			SPIC HGFEDCBA 2
			wait
		Death:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInTargetInventory("IAmSfestMonster", 1, "Vanish")
			TNT1 A 0 A_Jump(128,2)
			SPIC A 401
			Stop
			SPIC E 1
			SPIC E 401
			Stop
		Vanish:
			TNT1 A 0
			Stop
    }
}


ACTOR RevenantDust: RevenantPiece // a 2x2 pixel bone-colored square
{
    Speed 10
	BounceFactor 0.3
	Scale 0.6
    States
    {
		Spawn:
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Death")
			SPIC I 5
			Loop
		Death:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInTargetInventory("IAmSfestMonster", 1, "Vanish")
			SPIC I 401
			Stop
    }
}


ACTOR RevenantDust2: RevenantDust
{
    Speed 8
	BounceFactor 0.2
	Scale 0.3
}



actor Bone_DustFBD : FBD_SawBlood
{
	Decal None
	+MISSILE
	
	+PUFFGETSOWNER
	
	PROJECTILE
	states
	{
		Spawn:
			TNT1 A 0 NoDelay A_JumpIf(waterlevel > 1, "Splash")
			
			TNT1 A 0 A_JumpIfInTargetInventory("IAmSfestMonster", 1, "LowBlood")
			
			TNT1 A 0 A_RadiusGive("ChainsawHitRed", 200, RGF_PLAYERS | RGF_MONSTERS , 1)
			TNT1 A 0 A_RadiusGive("PowerBloodOnVisor", 200, RGF_PLAYERS | RGF_MONSTERS , 1)
			TNT1 AAA 0 A_CustomMissile ("RevenantDust", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 AA 0 A_CustomMissile ("RevenantDust2", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 0 A_CustomMissile ("RevenantPiece", 0, 0, random (0, 360), 2, random (30, 150))
			Stop		
		LowBlood:
			TNT1 A 0
			// a rip-off of DirtRicochet
			TNT1 A 0 A_Jump(256, "Spawn1", "Spawn2", "Spawn3", "Spawn4")
		Spawn1:	
			TNT1 A 0 A_SetScale(1, 1)
			SDRT ABCDEFF 1 A_FadeOut(0.1)
			Stop
		Spawn2:
			TNT1 A 0
			TNT1 A 0 A_SetScale(-0.8, -0.8)
			SDRT ABCDEFF 1 A_FadeOut(0.1)
			Stop
		Spawn3:
			TNT1 A 0
			TNT1 A 0 A_SetScale(-0.8, 0.8)
			SDRT ABCDEFF 1 A_FadeOut(0.1)
			Stop
		Spawn4:
			TNT1 A 0
			TNT1 A 0 A_SetScale(-0.9, 0.9)
			SDRT ABCDEFF 1 A_FadeOut(0.1)
			Stop

	}
}

Actor RevenantHeadsplosion: Bone_DustFBD {
	States {
		Spawn:
			
			TNT1 A 0 A_JumpIfInTargetInventory("IAmSfestMonster", 1, "LowBlood")
			
			TNT1 AAAA 0 A_CustomMissile ("SmallLSPart1", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAAA 0 A_CustomMissile ("SmallLSPart3", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("LSpart1", 2, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("LSpart3", 2, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("LSpart2", 2, 0, random (0, 360), 2, random (0, 160))		
			Stop
	}
}


actor RevenantBlood : Blood
{
	Decal BrutalBloodSplat
	 game Doom
	+FORCEXYBILLBOARD
	+GHOST
	+NOBLOCKMAP
	+NOGRAVITY
	+NOCLIP
	-DONTSPLASH
	-ALLOWPARTICLES 
	Speed 0
	+PUFFGETSOWNER
	states
	{
		Spawn:
			TNT1 A 0
			TNT1 AAAAA 0 A_CustomMissile ("BloodTr255", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("RevenantDust", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("RevenantDust2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
			TNT1 A 0 A_CustomMissile ("FBD_FlyingBlood", 7, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 A 0 A_CustomMissile ("RevenantPiece", 7, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 A 0 A_SpawnItem ("SuperGoreMistTiny")
			BLOD BCD 0
			stop

		Splash:
			BLOD A 0
			TNT1 AAA 0 A_CustomMissile ("Underblood1", 7, 0, random (0, 360), 2, random (30, 150))
			stop
	}
}



actor RevenantBloodSaw : RevenantBlood
{
 states
 {
	  Spawn:
			TNT1 A 0
			TNT1 A 0 A_CustomMissile ("BloodmistChainsaw", 0, 0, random (0, 360), 2, random (60, 90))
			TNT1 A 0 A_CustomMissile ("RevenantDust", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 0 A_CustomMissile ("RevenantDust2", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
			TNT1 A 0 A_RadiusGive("ChainsawHitRed", 200, RGF_PLAYERS | RGF_MONSTERS , 1)
			stop
 }
}




ACTOR RevenantBones: RevenantPiece
{
    Speed 9
	BounceFactor 0.3
	Scale 1.0
    States
    {
		Spawn:
			BNP1 ABCDEFGH 4
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Death")
			Loop
		Death:
			TNT1 A 0
			TNT1 A 0 A_QueueCorpse
			BNP1 A -1
			Stop
    }
}


ACTOR RevenantBonesFast: RevenantPiece
{
    Speed 14
	BounceFactor 0.3
	Scale 1.0
    States
    {
		Spawn:
			BNP1 ABCDEFGH 4
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Death")
			Loop
		Death:
			TNT1 A 0
			TNT1 A 0 A_QueueCorpse
			BNP1 A -1
			Stop
    }
}





ACTOR RevenantArm: RevenantPiece
{
    Speed 10
	BounceFactor 0.1
	Scale 1.0
    States
    {
		Spawn:
			BNP2 ABCDEFGH 4
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Death")
			Loop
		Death:
			TNT1 A 0
			TNT1 A 0 A_QueueCorpse
			BNP2 A -1
			Stop
    }
}


ACTOR RevenantTorso5: RevenantPiece //actually his hip bone
{
    Speed 5
	BounceFactor 0.2
	Scale 1.0
    States
    {
		Spawn:
			BNP3 ABCD 8
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Death")
			Loop
		Death:
			TNT1 A 0
			TNT1 A 0 A_QueueCorpse
			BNP3 A -1
			Stop
    }
}


ACTOR RevenantUSpawner
//***Che rationale: FBD_RevenantU has a radius 20 versus revenant's 12, gets stuck in walls or actors a lot
// Only the ACS scripting could save the father of Russian democracy as Ibrahim Ostap Maria Bender Bey would say.
{
    Radius 12
    Height 12
	Mass 8
	BounceType "Doom"
	BounceFactor 0.9
	+ALLOWBOUNCEONACTORS
	+BOUNCEONACTORS
	+BOUNCEONWALLS
	+BOUNCEONFLOORS
	+BOUNCEONCEILINGS
    +NOBLOCKMAP
	+MISSILE
    +NOTELEPORT
    +DONTSPLASH
    +MOVEWITHSECTOR
    DeathSound "misc/xdeath1"
	Decal BrutalBloodSplat
	
    States
    {
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteAlways("FBD_TrySpawningRevenantU") // tries every tic for 3 seconds then forces us into our Death state
		Fly:	
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Death")
			UKEL G 12 // half revenant's pain frame, not used anywhere else
			Loop
		Death:
			TNT1 AA 0 A_CustomMissile ("RevenantArm", 7, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			// instead of GibHalfSkeleton, we *must* drop something raiseable even if we fail to spawn RevenantU.
			TNT1 A 0 A_SpawnItemEx("DeadHalfSkeleton",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			Stop
		Vanish: // state is entered by a command from ACS.
			TNT1 A 0 
			Stop
    }
}

//***Che: 
Actor DeadHalfSkeleton: FBD_DeadSkeleton {
	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
			SKEX 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
			SKEX F 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			SKEX F -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop			
		
		Death.Trample:
	    Death:
		Death.Saw:
		Death.Cut:
		Death.ExplosiveImpact:
		XDeath:
		Death.Burn:
		Death.Flames:
			// a copy of death of GibHalfSkeleton this corpse masquerades as
			TNT1 A 0 A_NoBlocking
			TNT1 AAA 0 A_CustomMissile ("RevenantDust", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 AAAA 0 A_CustomMissile ("RevenantDust2", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 A 0 A_CustomMissile ("XDeathRevenantHead", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 A 0 A_CustomMissile ("RevenantBonesFast", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 AA 0 A_CustomMissile ("RevenantArm", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 AA 0 A_CustomMissile ("MetalShard1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 160))
			TNT1 AA 0 A_CustomMissile ("MetalShard2", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 160))
			TNT1 AA 0 A_CustomMissile ("MetalShard3", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 160))
			TNT1 AAA 0 A_CustomMissile ("RevenantBones", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 AAA 0 A_CustomMissile ("RevenantPiece", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 A 0 A_SpawnItem("HellishMissileLauncher")
			
			
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop			
	}
}


//***Che: there it is, the horrible bug with archviles raising the same half revenant ad infinitum
//  because it did not have methods for reacting to the raised revenant to delete it!
//ACTOR RevenantU
Actor FBD_RevenantU: AbstractCorpse 17852
{
	//$category "FBD Monsters"
	
	Tag "$CHE_HALFREVENANT"

	GibHealth 45
	Health 150
	Monster
	MeleeThreshold 196
	+FLOORCLIP
	+MISSILEMORE
	Speed 6
    damagefactor "Crush", 10.0
    damagefactor "Plasma", 0.5
	damagefactor "MinorHead", 1.2
	damagefactor "Avoid", 0.0
	damagefactor "Head", 1.2
	PainChance "Kick", 255
    BloodType "RevenantBlood"
	SeeSound "skeleton/sight"
	PainSound "skeleton/pain"
	DeathSound "skeleton/death"
	ActiveSound "skeleton/active"
	MeleeSound "skeleton/swing" //"skeleton/melee"
	HitObituary "$OB_UNDEADHIT"
	Obituary "$OB_UNDEAD"
	damagefactor "Blood", 0.0 damagefactor "BlueBlood", 0.0 damagefactor "GreenBlood", 0.0
	MaxStepHeight 24
	+DONTHURTSPECIES
	+NOPAIN
	+LOOKALLAROUND
	
	//***Che: the fug? I witnessed a half revenant kill a fully healthy mastermind because of this
	//+NOTARGET
	
	MaxDropOffHeight 32
	Radius 20 //***Che and herein lies the problem. With revenant's radius = 12, these guys often get stuck in walls!
	Height 40
	
	//***Che
	Species "Revenants"
	

	States
	{
		Spawn:
			UKEL A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster") // no headbox
		Stand:
			UKEL A 6 A_Look 
			Loop
		See:
			TNT1 A 0
			TNT1 A 0 
			UKEL AAABBBCCC 2 A_chase("","")
			UKEL CDDD 2 A_Chase
			Loop
		Missile:
			TNT1 A 0
			//TNT1 A 0 A_JumpIfInventory("IAmSfestMonster", 1, "MissileSfest")
			UKEL E 10 A_FaceTarget
			TNT1 A 0 A_Jump(128, "Missile2")
			UKEL F 10 A_CustomMissile("FBD_RevenantBall",20,15,0,0)
			Goto See
		Missile2:	
			UKEL E 1 A_FaceTarget
			UKEL F 10 A_CustomMissile("FBD_RevenantBall",20,-15,0,0)
			Goto See
/*			
		MissileSfest:
			TNT1 A 0
			UKEL E 10 A_FaceTarget
			TNT1 A 0 A_Jump(128, "Missile2Sfest")
			UKEL F 10 A_CustomMissile("RevenantFirebalSFest",20,15,0,0)
			Goto See
		Missile2Sfest:	
			UKEL E 1 A_FaceTarget
			UKEL F 10 A_CustomMissile("RevenantFirebalSFest",20,-15,0,0)
			Goto See
*/			
		Death:
			TNT1 AAA 0 A_CustomMissile ("RevenantDust", 5, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAAA 0 A_CustomMissile ("RevenantDust2", 5, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 0 A_CustomMissile ("XDeathRevenantHead", 5, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 5, 0, random (0, 360), 2, random (30, 150))
			TNT1 AA 0 A_CustomMissile ("RevenantBones", 5, 0, random (0, 360), 2, random (30, 150))
			TNT1 AA 0 A_CustomMissile ("RevenantArm", 5, 0, random (0, 360), 2, random (30, 150))
			TNT1 AA 0 A_CustomMissile ("MetalShard1", 5, 0, random (0, 360), 2, random (30, 160))
			TNT1 AA 0 A_CustomMissile ("MetalShard2", 5, 0, random (0, 360), 2, random (30, 160))
			TNT1 AA 0 A_CustomMissile ("MetalShard3", 5, 0, random (0, 360), 2, random (30, 160))
			TNT1 AAA 0 A_CustomMissile ("RevenantBones", 5, 0, random (0, 360), 2, random (30, 150))
			TNT1 AAA 0 A_CustomMissile ("RevenantPiece", 5, 0, random (0, 360), 2, random (30, 150))
			TNT1 A 0 A_SpawnItem("HellishMissileLauncher")
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Scream
			
			//***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


		Pain.KillMe:
		Pain.Taunt:
			"----" A 0
			"----" A 0 HealThing(1)
			//Goto Missile
			"----" A 1 A_Jump(256, "Missile") // inheritance support (see elemenants)
			Wait
			
		Death.KillMe:
		Death.Taunt:
			//TNT1 A 0 A_ChangeFlag("SOLID", 0)
			//TNT1 A 0 A_SpawnItem("FBD_RevenantU")
			//Stop
			TNT1 A 0
			Goto Death


		// the same as various corpses
		Raise:
			// note: the frame letter of the "----" (keep previous) sprite is ignored
			"----" A 0
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_NoBlocking // the raising code deep in C++ makes it solid

			"----" A 0 A_JumpIf(!CallAcs("EnoughSpaceToRezNormally", 2013), "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 ("RevenantRaisedByVile",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, 13, 0, 0) //"RevenantRaisedByVile"
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2013) // see _mob_list.xlsx
			Stop
	}
}




actor RevenantBloodz: FBD_SawBlood
{
	Decal None
	+MISSILE
	PROJECTILE
	+PUFFGETSOWNER // the target pointer is set to the monster bleeding
	states
	{
/*
	Idea for future reference (+PUFFGETSOWNER , +SEEKERMISSILE):
	1. write current z to an uservar
	2. Spawn a short-lived marker at 0,0,0, set as tracer.
	3. warp to target's origin, calculate z delta, rewrite the uservar
	4. warp to tracer's origin, proceed as normal using the delta from uservar instead of z - floorz
	
	P.S. I so implemented it! :D
	P.P.S. Learning of immediate ACS calls so deprecated it!

*/  
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(CallAcs("GetZDeltaToTarget") < -48, "HitMetal")
			TNT1 A 0 A_JumpIf(CallAcs("GetZDeltaToTarget") <= -40, "HitGuts")
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
			// There is no need for additional sfest checks: the revenent dust projectiles 
			// inherit our target automatically and can check for IAmSfestMonster in his inventiory
			// on their own
			
			TNT1 AAA 0 A_CustomMissile ("RevenantDust", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 AA 0 A_CustomMissile ("RevenantDust2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 A 0 A_CustomMissile ("RevenantPiece", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			Stop
		HitMetal:
		   TNT1 A 1
		   TNT1 A 0 A_SpawnItem("HitPuff")
		   Stop
		HitGuts:
			TNT1 A 0 A_SpawnItem("Blood")
			
			// inflict extra damage:
			TNT1 A 0 A_SetDamageType("RevenantHitStomach") 
			TNT1 A 0 A_Warp(AAPTR_TARGET, 0,0,5, 0, WARPF_NOCHECKPOSITION)
			TNT1 A 0 A_Explode(3,4)
			TNT1 A 1
			Stop
	}		
}

actor RevenantBloodzSaw: RevenantBloodz
{
	States
	{
		Spawn:
			TNT1 A 0 NODELAY A_JumpIf(CallAcs("GetZDeltaToTarget") < -48, "HitMetal")
			TNT1 A 0 A_JumpIf(CallAcs("GetZDeltaToTarget") < -40, "HitGuts")
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
			// There is no need for additional sfest checks: the revenent dust projectiles 
			// inherit our target automatically and can check for IAmSfestMonster in his inventiory
			// on their own
			
			TNT1 A 0 A_RadiusGive("ChainsawHitRed", 200, RGF_PLAYERS , 1)
			TNT1 AAA 0 A_CustomMissile ("RevenantDust", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 AA 0 A_CustomMissile ("RevenantDust2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 A 0 A_CustomMissile ("RevenantPiece", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			Stop		
		HitGuts:
			TNT1 A 0 A_SpawnItem("Blood")
			
			// inflict extra damage:
			TNT1 A 0 A_SetDamageType("RevenantHitStomach") 
			TNT1 A 0 A_Warp(AAPTR_TARGET, 0,0,5, 0, WARPF_NOCHECKPOSITION)
			TNT1 A 0 A_Explode(3,4)
			
			// makes the chainsaw continue sawing instead of just completing the swing!
			// serverside-only as per how A_RadiusGive operates
			TNT1 A 0 A_RadiusGive("ChainsawHitRed", 200, RGF_PLAYERS , 1)
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
			TNT1 A 0 A_RadiusGive("PowerBloodOnVisor", 200, RGF_PLAYERS , 1)			
			TNT1 A 1
			Stop	
	}
}			

	
		
/*	
		TNT1 A 0
		TNT1 A 0 A_CHangeFlag("FRIENDLY", 0)
		TNT1 A 1
		TNT1 A 0 A_JumpIfInTargetInventory("IAmSfestMonster", 1, 3)
		TNT1 A 0 A_RadiusGive("ChainsawHitRed", 200, RGF_PLAYERS | RGF_MONSTERS , 1)
		TNT1 A 0 A_RadiusGive("PowerBloodOnVisor", 200, RGF_PLAYERS | RGF_MONSTERS , 1)
		TNT1 A 0 A_SpawnItem("Blood")
		TNT1 A 0 A_SpawnItem("RevenantHitStomach")
		Stop
/*		
  SPAWN:
		tnt1 a 1
		TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
		TNT1 A 0 A_JumpIf((z - floorz) > 48, "HitMetal")
		TNT1 A 0 A_JumpIf((z - floorz) > 40, "HitGuts")
		TNT1 A 0 A_JumpIfInTargetInventory("IAmSfestMonster", 1, 3)
		TNT1 A 0 A_RadiusGive("ChainsawHitRed", 200, RGF_PLAYERS | RGF_MONSTERS , 1)
		TNT1 A 0 A_RadiusGive("PowerBloodOnVisor", 200, RGF_PLAYERS | RGF_MONSTERS , 1)
		TNT1 AAA 0 A_CustomMissile ("RevenantDust", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
		TNT1 AA 0 A_CustomMissile ("RevenantDust2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
		TNT1 A 0 A_CustomMissile ("RevenantPiece", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
		Stop
*/		


/*
actor RevenantHitStomach
{
+MISSILE
PROJECTILE
Damagetype "RevenantHitStomach"
Speed 0
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Explode(3,4)
Stop
 }
}
*/

#include RevElemenant.txt