
//***Che the product of Chebmaster's faltering mind after playing one too many Diablo clones



Actor AbstractElemenant: FBD_Revenant
{
	/*
	//***Che I am not going to go around converting all revenant corpses to support elemenants.
		He never leaves a damageable corpse.
		Basically, any elemenant either breaks in half resulting in a half-elemenant
			or !Asplodes! inflicting his elemental damage in a large radius
			- like element enhanced monsters in Diablo II
	*/
	
	//$category "FBD Monsters"
	SpawnID 0
	States
	{
		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")
			SKEL Q 32
			"----" A 1 A_Jump(256, "AsplodeDown")
			Wait
			
		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	

		Death.FriendlyExplosion:
		Death.ExplosiveImpact:
			TNT1 A 0
			TNT1 A 0 A_JumpIfHealthLower(-40, "XDeath")
			Goto SpecialDeath			
			
		Death.HeadPlasma:
		Death.Psionic:
		Death.HeadStun:
		Death.Minorhead:
		Death.Head:		
		Death.Decaptate:
			TNT1 A 0 
			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))
			REVH A 24
			REVH B 8 A_NoBlocking
			TNT1 A 0 A_XScream
			REVH CD 8
			"----" A 0 A_SpawnItem ("GrowingBloodPool")
			"----" A 32
			"----" A 1 A_Jump(256, "AsplodeDown")
			Wait
		
		Death.Cut:
		Death.Saw:
		SpecialDeath:
		Death.Rare:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")	
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Scream
			SKEL L 1 A_Jump(256, "ActuallyBreakInHalf")
			Wait

		Death.Fatality:
		Death.HelperMarineFatallity:		
		XDeath:
		Death.Bfg10k:
		Death.SuperPlasma:
		Death.Plasma:
		Death.Electric:		
		Death.Plasma2:
		Death.Burn:
		Death.Flames:
		Death.Fire:
		Death.Massacre:
		Death.KillMe:
		Death.Taunt:
		Death.Ice:
		Death.Freeze:
		Death.Frost:
		Death.Railgun:	
		Death.Blast:
		Death.SSG:
		Death.ExtremePunches:
		
			REDX A 1 A_Jump(256, "Asplode")
			Wait
		
		ActuallyBreakInHalf:	// children implement
			"----" A 1
			Loop		
		Asplode: // abstract method, children implement
			"----"  A 1
			Loop
		AsplodeDown: // abstract method, children implement
			"----"  A 1
			Loop
			

	}
}

ACTOR AbstractElemenantU: FBD_RevenantU
{
	States
	{
		Death:
		Death.KillMe:
		Death.Taunt:
		Death.Freeze:
		Death.Ice:
		Death.Frost:
		Death.IOS_Frost:		
			"----" A 1 A_Jump(256, "Asplode")
			Wait
		Asplode: // abstract method, children implement
			"----"  A 1
			Loop		
	}
}

ACTOR AbstractBouncyIgniter 
{
    Radius 4
    Height 4
    Speed 6
	FastSpeed 6 // must NOT be faster, spread too much and become useles as area denial
    Renderstyle Add
	Mass 1
    +NOBLOCKMAP
	+MISSILE
    +NOTELEPORT
    +MOVEWITHSECTOR
    +RIPPER
    +BLOODLESSIMPACT 
	+NODAMAGETHRUST
    +DOOMBOUNCE
	+SKYEXPLODE
    BounceFactor 0.5
	BounceCount 2
	Missileheight 4
}

ACTOR ImmolatorIgniter: AbstractBouncyIgniter // no self-harm lingering hazards
{
	damagetype Flames
	Damage (random (1, 1))
	
	Renderstyle Add
    States
    {
		Spawn:
			FRPU KJ 1 BRIGHT A_SpawnItemEx("RedTinyFlameTrail", 0, 0, 0, 0, 0, 0, 0, 128)
			Loop
		Death:
			TNT1 A 0
			TNT1 A 0 A_CustomMissile("ImmolantBurningStuff", random (-32, 0), random (-32, 32), random (-32, 32), 2 | CMF_TRACKOWNER, random (-32, 32))
			TNT1 A 30
			Stop
    }
}

ACTOR IndiscriminateImmolatorIgniter: ImmolatorIgniter
{
    States
    {
		Death:
			TNT1 A 0
			TNT1 A 0 A_CustomMissile("FlamethrowerBurningStuff", random (-32, 0), random (-32, 32), random (-32, 32), 2 | CMF_TRACKOWNER, random (-32, 32))
			TNT1 A 30
			Stop
    }
}

// ImmolantBurningStuff - see Fire.txt

ACTOR FrostVfx: FBD_CorpseSmoke
{
	-NOGRAVITY
	Gravity 0.15
	PROJECTILE
	+BLOODLESSIMPACT 
	+NODAMAGETHRUST
    +DOOMBOUNCE
	+SKYEXPLODE
	Speed 2
	States
	{
		Spawn:
			TNT1 AAAAA 10 A_CustomMissile ("InvertedSmallSmoke", 15, 0, random (0, 360), 2, random (-90, -45))
			TNT1 A 0 A_JumpIf(!CallAcs("FBD_RequestExpensiveSfx", 1200, -50), "Vanish") // 1200 tics, cap -50 (i.e. 50 with default cap of 100)
			
/*
	Framerate Died.
			TNT1 AAAAAAAAAAAAAAAAAAAA 10 A_CustomMissile ("InvertedSmallSmoke", 15, 0, random (0, 360), 2, random (-90, -45))
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 20 A_CustomMissile ("InvertedSmallSmoke", 15, 0, random (0, 360), 2, random (-90, -45))
*/			
			Stop
		Vanish:
			TNT1 A 1
			Stop
			
	}	
}


ACTOR InvertedSmallSmoke: SmallSmoke {
	XScale 1.2
	YScale -0.8
}



ACTOR FrostSpreader: AbstractBouncyIgniter // invisibal, beotch!
{
	DamageType Ice
	Damage (random (1, 1))
	States
	{
		Spawn:
			TNT1 B 1
			Loop
		Death:
			TNT1 A 0 A_Stop
			TNT1 A 0 A_Explode(5, 120, 0)
			TNT1 A 0 A_CheckFloor("Death_Floor")
			TNT1 A 0 A_CustomMissile ("FrostVfx", 0, 0, 0, 2, random (-40,0))
			TNT1 B 8
			//TNT1 A 0 A_CustomMissile("FrostEffect", 0.0, 0.0, Random(135,225), CMF_AIMDIRECTION | CMF_SAVEPITCH | CMF_TRACKOWNER, - pitch + Random(-45,45)) // angle = 180 +/-45
			TNT1 A 0 A_RadiusGive("FrostAOE", 120, RGF_PLAYERS | RGF_MONSTERS | RGF_OBJECTS)
			TNT1 A 0 A_CustomMissile ("FrostVfx", 0, 0, 0, 2, random (-40,0))
			TNT1 B 8
			//TNT1 A 0 A_CustomMissile("FrostEffect", 0.0, 0.0, Random(135,225), CMF_AIMDIRECTION | CMF_SAVEPITCH | CMF_TRACKOWNER, - pitch + Random(-45,45))
			TNT1 A 0 A_RadiusGive("FrostAOE", 120, RGF_PLAYERS | RGF_MONSTERS | RGF_OBJECTS)
			TNT1 A 0 A_CustomMissile ("FrostVfx", 0, 0, 0, 2, random (-40,0))
			TNT1 B 8
			TNT1 A 0 A_CustomMissile ("FrostVfx", 0, 0, 0, 2, random (-40,0))
			//TNT1 A 0 A_CustomMissile("FrostEffect", 0.0, 0.0, Random(135,225), CMF_AIMDIRECTION | CMF_SAVEPITCH | CMF_TRACKOWNER, - pitch + Random(-45,45))
			TNT1 A 0 A_RadiusGive("FrostAOE", 120, RGF_PLAYERS | RGF_MONSTERS | RGF_OBJECTS)
			TNT1 A 30
			Stop
		Death_Floor:
			TNT1 B 8
			TNT1 A 0 A_CustomMissile ("FrostVfx", 0, 0, 0, 2, random (40,0))
			//TNT1 A 0 A_CustomMissile("FrostEffect", 0.0, 0.0, Random(0,360), CMF_AIMDIRECTION | CMF_SAVEPITCH | CMF_TRACKOWNER, Random(45, 80))
			TNT1 A 0 A_RadiusGive("FrostAOE", 120, RGF_PLAYERS | RGF_MONSTERS | RGF_OBJECTS)
			TNT1 A 0 A_CustomMissile ("FrostVfx", 0, 0, 0, 2, random (40,0))
			TNT1 B 8
			//TNT1 A 0 A_CustomMissile("FrostEffect", 0.0, 0.0, Random(0,360), CMF_AIMDIRECTION | CMF_SAVEPITCH | CMF_TRACKOWNER, Random(45, 80))
			TNT1 A 0 A_RadiusGive("FrostAOE", 120, RGF_PLAYERS | RGF_MONSTERS | RGF_OBJECTS)
			TNT1 B 8
			TNT1 A 0 A_CustomMissile ("FrostVfx", 0, 0, 0, 2, random (40,0))
			//TNT1 A 0 A_CustomMissile("FrostEffect", 0.0, 0.0, Random(0,360), CMF_AIMDIRECTION | CMF_SAVEPITCH | CMF_TRACKOWNER, Random(45, 80))
			TNT1 A 0 A_RadiusGive("FrostAOE", 120, RGF_PLAYERS | RGF_MONSTERS | RGF_OBJECTS)
			TNT1 A 30
			Stop			
	}
}




ACTOR ToxicSpreader: AbstractBouncyIgniter
{
	// yellowish-orange ring of flames EFIR to sickly green
	Translation "208:223=152:157", "236:239=109:109", "160:167=152:159", "224:231=152:152", "48:63=152:156", "0:0=111:111"
	Alpha 0.4
	DeathSound "burn"
	Damagetype Slime
	Damage (random (1, 1))
	+NODAMAGETHRUST
	
	// damageL 1 direct + 5 AOE + 3 x ~10 by toxic effects
	
    States
    {
		Spawn:
			EFIR A 1 BRIGHT A_SpawnItemEx("GreenTinyTransparentFlameTrail", 0, 0, 0, 0, 0, 0, 0, 128)
			Loop
		Death:
			TNT1 A 0 A_Stop
			TNT1 A 0 A_Explode(5, 120, 0)
			TNT1 A 0 A_CheckFloor("Death_Floor")
			TNT1 A 0 A_Stop
			FRPR ABC 3
			//TNT1 A 0 A_CustomMissile("ToxicEffect", 0.0, 0.0, Random(135,225), CMF_AIMDIRECTION | CMF_SAVEPITCH | CMF_TRACKOWNER, - pitch + Random(-45,45)) // angle = 180 +/-45
			// unlike explosions, which are cubic, radiusgive is a sphere + sight check by default
			TNT1 A 0 A_RadiusGive("ToxicDOT", 120, RGF_PLAYERS | RGF_MONSTERS | RGF_OBJECTS)
			FRPR DEF 3
			//TNT1 A 0 A_CustomMissile("ToxicEffect", 0.0, 0.0, Random(135,225), CMF_AIMDIRECTION | CMF_SAVEPITCH | CMF_TRACKOWNER, - pitch + Random(-45,45))
			TNT1 A 0 A_RadiusGive("ToxicDOT", 120, RGF_PLAYERS | RGF_MONSTERS | RGF_OBJECTS)
			FRPR GH 3
			TNT1 A 0 A_RadiusGive("ToxicDOT", 120, RGF_PLAYERS | RGF_MONSTERS | RGF_OBJECTS)
			//TNT1 A 0 A_CustomMissile("ToxicEffect", 0.0, 0.0, Random(135,225), CMF_AIMDIRECTION | CMF_SAVEPITCH | CMF_TRACKOWNER, - pitch + Random(-45,45))
			

			TNT1 A 30
			Stop
		Death_Floor:
			EFIR BCDE 2
			//TNT1 A 0 A_CustomMissile("ToxicEffect", 0.0, 0.0, Random(0,360), CMF_AIMDIRECTION | CMF_SAVEPITCH | CMF_TRACKOWNER, Random(45, 80))
			TNT1 A 0 A_RadiusGive("ToxicDOT", 120, RGF_PLAYERS | RGF_MONSTERS | RGF_OBJECTS)
			EFIR FGHI 2
			//TNT1 A 0 A_CustomMissile("ToxicEffect", 0.0, 0.0, Random(0,360), CMF_AIMDIRECTION | CMF_SAVEPITCH | CMF_TRACKOWNER, Random(45, 80))
			TNT1 A 0 A_RadiusGive("ToxicDOT", 120, RGF_PLAYERS | RGF_MONSTERS | RGF_OBJECTS)
			EFIR JKLM 2
			//TNT1 A 0 A_CustomMissile("ToxicEffect", 0.0, 0.0, Random(0,360), CMF_AIMDIRECTION | CMF_SAVEPITCH | CMF_TRACKOWNER, Random(45, 80))
			TNT1 A 0 A_RadiusGive("ToxicDOT", 120, RGF_PLAYERS | RGF_MONSTERS | RGF_OBJECTS)
			TNT1 A 30
			Stop
			
    }	
}

Actor ToxicAOEAggroer {
	Radius 4
	Height 4
	DamageType "KillMe" // player is immune to this
    +NOGRAVITY
	+NOBLOCKMAP
	+MISSILE
	+NODAMAGETHRUST
	Speed 0
	States 
	{
		Spawn:
		Death:
			TNT1 A 1 NODELAY A_Explode(2, 96, 0) // don't hurt self: 
			Stop
	}
}


ACTOR FrostEffect: FastProjectile // DEPRECATED, replace with FrostAOE
{
	+HITMASTER // to receive someone we hit in our master pointer on hit
	+SEEKERMISSILE
	Speed 30
	Damagetype Ice
	Damage (Random(2,2))
	radius 2
	height 2
	//Missileheight 12
	//Missiletype "BFGBallLazerTrail"	
	States
	{
		Spawn:
			TNT1 A 1 // do nothing during our first tic
			// acquire target with 100% probability in a radius of one block 9128 map units) and steer at it sharply
			TNT1 AA 1 A_SeekerMissile(80, 90, SMF_LOOK, 256, 1)
			Stop
/*
		Death: // hit a wall
		Crash: // hit a non-bleeding actor
			// do nothing but sound
			TNT1 A 0 A_Stop
			
			TNT1 AA 0 A_CustomMissile ("FrostVfx", 0, 0, random(0,360), 2, random (-40,0))
			
			TNT1 A 30
			Stop
*/			
		Death: // hit a wall
		Crash: // hit a non-bleeding actor
			TNT1 AAA 0 A_CustomMissile ("FrostVfx", 0, 0, random(0,360), 2, random (-40,0))
			TNT1 A 30
			Stop
		XDeath: // hit a bleeding actor
			TNT1 A 0 A_Stop
			TNT1 A Random(0,5)
			
			// The deviousness of this ice damage is that the ice chunk *does* block movement 
			// and *does* cause missiles explode as they launch.
			// so, basically, very little damage but haxxx stopping power
			//TNT1 A 0 A_SpawnItemEx("BlockingIceChunk", Random(0, 24),Random(-16, 16),random(0,24),0,0,0, 0,SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunBlockingIceChunk")
			TNT1 AAA 0 A_CustomMissile ("FrostVfx", 0, 0, random(0,360), 2, random (-40,0))
			TNT1 A 30
			Stop
	}
}

ACTOR FrostAOE: CustomInventory 
{
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	inventory.maxamount 1
    States
    {
		Pickup:
			// inventory item's states execute in the context of the actor that item is in the inventory of
			TNT1 A 0
			
			// Framerate Died.
			//TNT1 AAA 0 A_CustomMissile ("FrostVfx", 0, 0, random(0,360), 2, random (-40,0))
			
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunBlockingIceChunk", 1)			
			Stop
    }
}

ACTOR ElectricAOE: CustomInventory 
{
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	inventory.maxamount 1
    States
    {
		Pickup:
			// inventory item's states execute in the context of the actor that item is in the inventory of
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunElectricDmg", 5)			
			Stop
    }
}

ACTOR BlockingIceChunk
{
	Height 24
	Radius 12
	Health 25
	+SHOOTABLE
	+SOLID
	+THRUACTORS
	-COUNTKILL
	-ALLOWPARTICLES	
	-BLOODSPLATTER
	+NOGRAVITY
	Gravity 0.3
	+NOICEDEATH
	BloodType "Ice_Blood", "Ice_Blood", "Ice_Blood"
	DamageFactor "Ice", 0.0
	DamageFactor "Frost", 0.0
	DamageFactor "Ios_Frost", 0.0
	DeathSound "ice/shatter"
	Alpha 0.4
	Scale 0.75 // I fucking took 4 photos of a chunk of quartz the size half of my mouse,
		// propped against said mouse for stability -- then worked them over in The GIMP.
		// If some of them have blue outlines, well, my mouse pad is blue
		// and the quartz is reflective.
		// I first filmed them using my smartphone but then I realized I only have one
		// usb-c cable and that only works for charging. Well, fuck them and their 
		// upgrade races, I said. I then took my trusty camera (bought back in 2006)
		// checked that the AA batteries were all right, made those 4 fucking photos,
		// pulled the SD card out and stuck it into my old laptop because fucking of course
		// my new laptop only accepts micro-SD cards. So fuck them and their upgrade races.
		// I easily copied the jpegs via my file server both are connected to.
		
		// TL;DR: the scale is 0.75 because scaling that shit down to 24 pixeld woulda
		//  turned it into smooth blobs devoid of detail. So I stopped at 32.
		
	var int user_x; // this is TOTALLY manage by the ACS script "FBD_RunBlockingIceChunk"
	var int user_y;
	var int user_z;
		
	States
	{
		Spawn:
			TNT1 A 0 NODELAY A_SetScale(CallAcs("FBD_PseudoRandom", 0, 1) ? -1.0 : 1.0, 1.0)
			TNT1 A 0 A_PlaySound("ice/crackle/short", CHAN_VOICE)
			TNT1 A 0 A_Jump(192, "Spawn2", "Spawn3", "Spawn4")	
			FATB R 1 // use the revenant fireball sprite space here
			Goto BeAnAss
		Spawn2:
			FATB S 1
			Goto BeAnAss
		Spawn3:
			FATB T 1
			Goto BeAnAss
		Spawn4:
			FATB U 1
			Goto BeAnAss
		BeAnAss:
			"----" A 0 A_Warp(AAPTR_TRACER, user_x,user_y,user_z, 0, WARPF_NOCHECKPOSITION)
			"----" A 1 A_FadeIn(0.1)
			"----" A 0 A_Warp(AAPTR_TRACER, user_x,user_y,user_z, 0, WARPF_NOCHECKPOSITION)
			"----" A 1 A_FadeIn(0.1)
			"----" A 0 A_Warp(AAPTR_TRACER, user_x,user_y,user_z, 0, WARPF_NOCHECKPOSITION)
			"----" A 1 A_FadeIn(0.1)
			"----" A 0 A_Warp(AAPTR_TRACER, user_x,user_y,user_z, 0, WARPF_NOCHECKPOSITION)
			"----" A 1 A_FadeIn(0.1)
			"----" A 0 A_Warp(AAPTR_TRACER, user_x,user_y,user_z, 0, WARPF_NOCHECKPOSITION)
		KeepBeingAnAss:
			"----" A 1
			"----" A 0 A_Warp(AAPTR_TRACER, user_x,user_y,user_z, 0, WARPF_NOCHECKPOSITION)//, "KeepBeingAnAss")
			Loop
		Shatter:	
			"----" A 1 A_Die
			Wait // keeping in mind that A_Die does nothing on Zandronum client and executing continues
		Death:
			TNT1 A 0 
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Scream
			TNT1 AAA 0 A_CustomMissile ("XIceChunk1", 48, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XIceChunk2", 48, 0, random (0, 360), 2, random (0, 160))
			Stop
		Death.Fire:
		Death.Flames:
			"----" A 0 A_NoBlocking
			"----" A 0 A_PlaySound("burn", CHAN_VOICE)
			"----" AAAAA 1 A_FadeOut(0.15)
			Stop
	}

}

ACTOR Ice_Blood
{
	-SHOOTABLE
	+THRUACTORS
	-ALLOWPARTICLES
	+NOBLOCKMAP
	+NOBLOODDECALS
	-BLOODSPLATTER
	+CLIENTSIDEONLY	
	states	{
		Spawn:
			TNT1 AA 0 A_CustomMissile ("XIceChunk1", 0, 0, random (-60, 60), 2, random (-60,35))
			TNT1 A 0 A_CustomMissile ("XIceChunk2", 0, 0, random (-60, 60), 2, random (-60,35))
			Stop
			
	}
}


ACTOR ToxicEffect: FastProjectile // DEPRECATED -- must check if can use as environmental hazard in EDAY (waterfalls of nukane)
{
	+HITMASTER // to receive someone we hit in our master pointer on hit
	+SEEKERMISSILE
	+NODAMAGETHRUST
	Speed 15
	Damagetype Slime
	Damage (Random(1,1))
	radius 2
	height 2
	//Missileheight 12
	//Missiletype "BFGBallLazerTrail"	
	States
	{
		Spawn:
			TNT1 A 1 // do nothing during our first tic
			// acquire target with 100% probability in a radius of one block (128 map units) and steer at it sharply
			TNT1 AAAAA 1 A_SeekerMissile(80, 90, SMF_LOOK, 256, 1)
			//TNT1 A 0 A_Die
			Stop
		Death: // hit a wall
		Crash: // hit a non-bleeding actor
			// do nothing but sound
			TNT1 A 0 A_Stop
			//TNT1 A 0 A_Explode(5, 120, 0)
			TNT1 A 0 A_PlaySound("burn")
			TNT1 AAAAAAAAAA 3 A_SpawnItemEx("GreenTinyTransparentFlameTrail", Random(-24,24), Random(-24,24), Random(0,24), 0.1 * Random(-24,24), 0.1 * Random(-24,24), 0, 0, 128)
			Stop
		XDeath: // hit a bleeding actor
			
			TNT1 A 1 
			// Rad suit negates the damage over time part.
			// (fast projectiles cannot check target's inventory, 
			//   A_JumpIfInTargetInventory gives a false negative)
			TNT1 A 0 A_JumpIf(CallAcs("FBD_GetMasterHasIronFeet"), "Crash")
			
			TNT1 A Random(30,45) A_NoBlocking

			TNT1 A 0 A_Warp(AAPTR_MASTER, 0, 0, 16, 0, WARPF_NOCHECKPOSITION | WARPF_ABSOLUTEOFFSET)
			TNT1 A 0 A_PlaySound("burn")
			TNT1 A 0 A_Explode(4, 64, 0, 0, 16)
			TNT1 AAAAA 3 A_SpawnItemEx("GreenTinyTransparentFlameTrail", Random(-24,24), Random(-24,24), Random(0,24), 0.1 * Random(-24,24), 0.1 * Random(-24,24), 0, 0, 128)
			TNT1 A Random(30,45) 

			TNT1 A 0 A_Warp(AAPTR_MASTER, 0, 0, 16, 0, WARPF_NOCHECKPOSITION | WARPF_ABSOLUTEOFFSET)
			TNT1 A 0 A_PlaySound("burn")
			TNT1 A 0 A_Explode(4, 64, 0, 0, 16)
			TNT1 AAAAA 3 A_SpawnItemEx("GreenTinyTransparentFlameTrail", Random(-24,24), Random(-24,24), Random(0,24), 0.1 * Random(-24,24), 0.1 * Random(-24,24), 0, 0, 128)
			TNT1 A Random(30,45) 

			TNT1 A 0 A_Warp(AAPTR_MASTER, 0, 0, 16, 0, WARPF_NOCHECKPOSITION | WARPF_ABSOLUTEOFFSET)
			TNT1 A 0 A_PlaySound("burn")
			TNT1 A 0 A_Explode(4, 64, 0, 0, 16)
			TNT1 AAAAA 3 A_SpawnItemEx("GreenTinyTransparentFlameTrail", Random(-24,24), Random(-24,24), Random(0,24), 0.1 * Random(-24,24), 0.1 * Random(-24,24), 0, 0, 128)
			TNT1 A Random(30,45) 

			TNT1 A 0 A_Warp(AAPTR_MASTER, 0, 0, 16, 0, WARPF_NOCHECKPOSITION | WARPF_ABSOLUTEOFFSET)
			TNT1 A 0 A_PlaySound("burn")
			TNT1 A 0 A_Explode(4, 64, 0, 0, 16)
			TNT1 AAAAA 3 A_SpawnItemEx("GreenTinyTransparentFlameTrail", Random(-24,24), Random(-24,24), Random(0,24), 0.1 * Random(-24,24), 0.1 * Random(-24,24), 0, 0, 128)
			TNT1 A Random(30,45) 

			TNT1 A 0 A_PlaySound("burn")
			TNT1 A 0 A_Explode(4, 64, 0, 0, 16)
			TNT1 AAAAA 3 A_SpawnItemEx("GreenTinyTransparentFlameTrail", Random(-24,24), Random(-24,24), Random(0,24), 0.1 * Random(-24,24), 0.1 * Random(-24,24), 0, 0, 128)
			TNT1 A 30
			Stop
	}
}

ACTOR ToxicDOT: CustomInventory 
{
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	inventory.maxamount 10
    States
    {
		Pickup:
			// inventory item's states executes in the context of the actor that item is in inventory of
			TNT1 A 0
			// that script checks for radsuit
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunToxicDOT", 25, 5)
			Stop
    }
}

ACTOR ToxicDOT1: CustomInventory 
{
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	inventory.maxamount 10
    States
    {
		Pickup:
			// inventory item's states executes in the context of the actor that item is in inventory of
			TNT1 A 0
			// that script checks for radsuit
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunToxicDOT", 1, 1)
			Stop
    }
}


ACTOR RedTinyFlameTrail: ExplosionFlames
{
	Scale 0.5
	States
	{
		Spawn:
			TNT1 A 2
			TNT1 A 0 A_Jump(192, "Spawn2", "Spawn3", "Spawn4")
		Spawn1:	
			TNT1 A 0 
			EXPL C 1 BRIGHT A_SetScale(0.15, 0.15)
			EXPL D 1 BRIGHT A_SetScale(0.2, 0.2)
			EXPL E 1 BRIGHT A_SetScale(0.3, 0.3)
			EXPL F 1 BRIGHT A_SetScale(0.4, 0.4)
			EXPL G 1 BRIGHT A_SetScale(0.5, 0.5)
			Stop
		Spawn2:	
			TNT1 A 0
			EXPL C 1 BRIGHT A_SetScale(-0.15, 0.15)
			EXPL D 1 BRIGHT A_SetScale(-0.2, 0.2)
			EXPL E 1 BRIGHT A_SetScale(-0.3, 0.3)
			EXPL F 1 BRIGHT A_SetScale(-0.4, 0.4)
			EXPL G 1 BRIGHT A_SetScale(-0.5, 0.5)
			Stop
		Spawn3:	
			TNT1 A 0
			EXPL C 1 BRIGHT A_SetScale(0.15, -0.15)
			EXPL D 1 BRIGHT A_SetScale(0.2, -0.2)
			EXPL E 1 BRIGHT A_SetScale(0.3, -0.3)
			EXPL F 1 BRIGHT A_SetScale(0.4, -0.4)
			EXPL G 1 BRIGHT A_SetScale(0.5, -0.5)
			Stop
		Spawn4:	
			TNT1 A 0
			EXPL C 1 BRIGHT A_SetScale(-0.15, -0.15)
			EXPL D 1 BRIGHT A_SetScale(-0.2, -0.2)
			EXPL E 1 BRIGHT A_SetScale(-0.3, -0.3)
			EXPL F 1 BRIGHT A_SetScale(-0.4, -0.4)
			EXPL G 1 BRIGHT A_SetScale(-0.5, -0.5)
			Stop
		
	}
}

ACTOR ImmolantProjectileTrail: RedTinyFlameTrail
{
	+NOGRAVITY
	States
	{
		Spawn:
			TNT1 A 0 NODELAY A_Warp(AAPTR_Default, 0,0,2)
			TNT1 A 1 A_Jump(256, "Spawn1", "Spawn2", "Spawn3", "Spawn4")
			Wait
	}
}

ACTOR GreenTinyFlameTrail: ExplosionFlames
{
	Scale 0.5
	States
	{
		Spawn:
			TNT1 A 2
			TNT1 A 0 A_Jump(192, "Spawn2", "Spawn3", "Spawn4")
		Spawn1:	
			TNT1 A 0 
			EXPG C 1 BRIGHT A_SetScale(0.15, 0.15)
			EXPG D 1 BRIGHT A_SetScale(0.2, 0.2)
			EXPG E 1 BRIGHT A_SetScale(0.3, 0.3)
			EXPG F 1 BRIGHT A_SetScale(0.4, 0.4)
			EXPG G 1 BRIGHT A_SetScale(0.5, 0.5)
			Stop
		Spawn2:	
			TNT1 A 0
			EXPG C 1 BRIGHT A_SetScale(-0.15, 0.15)
			EXPG D 1 BRIGHT A_SetScale(-0.2, 0.2)
			EXPG E 1 BRIGHT A_SetScale(-0.3, 0.3)
			EXPG F 1 BRIGHT A_SetScale(-0.4, 0.4)
			EXPG G 1 BRIGHT A_SetScale(-0.5, 0.5)
			Stop
		Spawn3:	
			TNT1 A 0
			EXPG C 1 BRIGHT A_SetScale(0.15, -0.15)
			EXPG D 1 BRIGHT A_SetScale(0.2, -0.2)
			EXPG E 1 BRIGHT A_SetScale(0.3, -0.3)
			EXPG F 1 BRIGHT A_SetScale(0.4, -0.4)
			EXPG G 1 BRIGHT A_SetScale(0.5, -0.5)
			Stop
		Spawn4:	
			TNT1 A 0
			EXPG C 1 BRIGHT A_SetScale(-0.15, -0.15)
			EXPG D 1 BRIGHT A_SetScale(-0.2, -0.2)
			EXPG E 1 BRIGHT A_SetScale(-0.3, -0.3)
			EXPG F 1 BRIGHT A_SetScale(-0.4, -0.4)
			EXPG G 1 BRIGHT A_SetScale(-0.5, -0.5)
			Stop
		
	}
}

ACTOR GreenTinyTransparentFlameTrail: GreenTinyFlameTrail
{
	Renderstyle Translucent
	Alpha 0.15
}

ACTOR ToxicParticleVfx: GreenTinyTransparentFlameTrail 
{
	// yellowish-orange ring of flames EFIR to sickly green
	Translation "208:223=152:157", "236:239=109:109", "160:167=152:159", "224:231=152:152", "48:63=152:156", "0:0=111:111"
	Scale 1.0
	Alpha 0.4
	Renderstyle Translucent
	States {
		Spawn:
			EFIR BCDEFGHIJKLM 2
			Stop
	}
}	

ACTOR NoxinantProjectileTrail: GreenTinyTransparentFlameTrail
{
	+NOGRAVITY
	States
	{
		Spawn:
			TNT1 A 0 NODELAY A_Warp(AAPTR_Default, 0,0,2)
			TNT1 A 1 A_Jump(256, "Spawn1", "Spawn2", "Spawn3", "Spawn4")
			Wait
	}
}

ACTOR Immolant: AbstractElemenant 17761
{
	DamageFactor "Fire", 0.0
	DamageFactor "Flames", 0.0
	DamageFactor "Burn", 0.25

	Tag "$IMMOLANT"
	Obituary "$IMMOLANT_O"

	Translation "80:111=168:191", "128:143=26:43", "9:12=189:191", "152:159=72:79", "144:151=25:47", "48:79=16:47", "160:167=170:185"
	+BRIGHT
	States
	{
		Spawn:
			SKEL B 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 4) // revenant head
			TNT1 A 0 A_GiveInventory("IsARevenant", 1)
			TNT1 A 0 A_GiveInventory("FBD_FireEnhanced", 1)
			TNT1 A 0 A_SetUserVar("user_sleeping", 1)
			SKEL B 10 A_Look
			Goto Stand
		
		ActuallyBreakInHalf:
			SKEX A 0 A_SpawnItemEx("ImmolantUSpawner", 0, 0, 40, random(-3,3), random(-3,3), 1, 0, SXF_NOCHECKPOSITION | SXF_CLEARCALLERTID | SXF_TRANSFERTRANSLATION, 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
			
		Asplode:
			TNT1 A 0 A_CustomMissile ("FireEnhancedDeathExplosion", 0, 40, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_SpawnItemEx("SkeletonMeatsplosion", 0,0,30, 0,0,0, 0,SXF_NOCHECKPOSITION)
			TNT1 A 0 A_SpawnItemEx("XFBD_DeadSkeleton22", 0,0,0, 0,0,0, 0,SXF_TRANSFERTRANSLATION) // legs only, begin with one cycle of walking animation. NOT raiseable!
			TNT1 A 30
			TNT1 A -1
			
		AsplodeDown:
			TNT1 A 0 A_CustomMissile ("FireEnhancedDeathExplosion", 0, 8, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_SpawnItemEx("SkeletonMeatsplosion", 0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			TNT1 A 30
			TNT1 A -1
			
		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("ImmolantPunch",10,0,0,2)
			TNT1 A 0 A_CustomMissile("ImmolantPunch",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("ImmolantPunch",10,0,0,2)
			TNT1 A 0 A_CustomMissile("ImmolantPunch",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

		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_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("ImmolantFireball",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("ImmolantFireball",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
			
		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("ImmolantRocket",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("ImmolantRocket",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("ImmolantRocket",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("ImmolantRocket",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			
	}
}

ACTOR ImmolantRaisedByVile: Immolant
{
	// 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.	
	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)
			TNT1 A 0 A_GiveInventory("FBD_FireEnhanced", 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 Friginant: AbstractElemenant 17762
{
	DamageFactor "Ice", 0.0
	DamageFactor "Frost", 0.0
	Translation "80:111=%[0.00,0.00,0.00]:[1.01,2.00,2.00]", "128:143=%[0.00,0.00,0.00]:[0.00,1.61,1.61]", "9:12=%[0.00,0.00,0.00]:[0.00,0.47,0.47]", "152:159=%[0.00,0.00,0.00]:[0.00,1.14,1.14]", "144:151=%[0.00,0.00,0.00]:[0.81,1.17,1.15]"
	Tag "$FRIGINANT"
	Obituary "$FRIGINANT_O"
	States
	{
		Spawn:
			SKEL B 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 4) // revenant head
			TNT1 A 0 A_GiveInventory("IsARevenant", 1)
			TNT1 A 0 A_GiveInventory("ImmuneToFrostEffect", 1)
			TNT1 A 0 A_SetUserVar("user_sleeping", 1)
			SKEL B 10 A_Look
			Goto Stand		
		
		ActuallyBreakInHalf:
			SKEX A 0 A_SpawnItemEx("FriginantUSpawner", 0, 0, 40, random(-3,3), random(-3,3), 1, 0, SXF_NOCHECKPOSITION | SXF_CLEARCALLERTID | SXF_TRANSFERTRANSLATION, 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
		Asplode:
			TNT1 A 0 A_CustomMissile ("IceEnhancedDeathExplosion", 0, 40, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_SpawnItemEx("SkeletonMeatsplosion", 0,0,30, 0,0,0, 0,SXF_NOCHECKPOSITION)
			TNT1 A 0 A_SpawnItemEx("XFBD_DeadSkeleton22", 0,0,0, 0,0,0, 0,SXF_TRANSFERTRANSLATION) // legs only, begin with one cycle of walking animation. NOT raiseable!
			TNT1 A 30
			TNT1 A -1
		AsplodeDown:
			TNT1 A 0 A_CustomMissile ("IceEnhancedDeathExplosion", 0, 8, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_SpawnItemEx("SkeletonMeatsplosion", 0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			TNT1 A 30
			TNT1 A -1	

		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("FriginantPunch",10,0,0,2)
			TNT1 A 0 A_CustomMissile("FriginantPunch",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("FriginantPunch",10,0,0,2)
			TNT1 A 0 A_CustomMissile("FriginantPunch",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

		Missile:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("ImmuneToFrostEffect", 1)	
			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_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("FriginantFireball",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("FriginantFireball",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
			
		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("FriginantRocket",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("FriginantRocket",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("FriginantRocket",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("FriginantRocket",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				
	}
}

ACTOR FriginantRaisedByVile: Friginant
{
	// 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.	
	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)
			TNT1 A 0 A_GiveInventory("ImmuneToFrostEffect", 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 Noxinant: AbstractElemenant 17763
{
	BloodType "NoxinantBloodz", "NoxinantBloodzSaw", "NoxinantBloodzSaw"
	Translation "80:111=112:127", "128:143=112:127", "16:24=87:95", "25:41=152:159", "42:47=9:12", "48:56=80:88", "57:72=89:111", "73:79=9:12", "160:167=152:159", "144:151=98:111", "208:223=112:127", "248:248=251:251", "232:235=155:159", "168:191=112:127"
	DamageFactor "Slime", 0.0
	Tag "$NOXINANT"
	// This obituary will rarely be seen because he mostly kills via DOT
	// and any DOT death is reported by the game engine as "Player killed self".
	// Alas, there is no way around that.
	// Still can show if he punches a player to death, or the direct missile hit
	//  offs a player on his last hit points.
	Obituary "$NOXINANT_O"
	States
	{
		Spawn:
			SKEL B 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 4) // revenant head
			TNT1 A 0 A_GiveInventory("IsARevenant", 1)
			TNT1 A 0 A_GiveInventory("ImmuneToToxicEffect", 1)
			TNT1 A 0 A_SetUserVar("user_sleeping", 1)
			SKEL B 10 A_Look
			Goto Stand	
		
		ActuallyBreakInHalf:
			SKEX A 0 A_SpawnItemEx("NoxinantUSpawner", 0, 0, 40, random(-3,3), random(-3,3), 1, 0, SXF_NOCHECKPOSITION | SXF_CLEARCALLERTID | SXF_TRANSFERTRANSLATION, 0, tid )
				
			TNT1 A 0 A_CustomMissile ("RoamingNoxinantLegs", 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
		Asplode:
			TNT1 A 0 A_CustomMissile ("PoisonEnhancedDeathExplosion", 0, 40, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_SpawnItemEx("NoxinantMeatsplosion", 0,0,30, 0,0,0, 0,SXF_NOCHECKPOSITION)
			TNT1 A 0 A_SpawnItemEx("XFBD_DeadSkeleton22", 0,0,0, 0,0,0, 0,SXF_TRANSFERTRANSLATION) // legs only, begin with one cycle of walking animation. NOT raiseable!
			TNT1 A 30
			TNT1 A -1
		AsplodeDown:
			TNT1 A 0 A_CustomMissile ("PoisonEnhancedDeathExplosion", 0, 8, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_SpawnItemEx("NoxinantMeatsplosion", 0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			TNT1 A 30
			TNT1 A -1
			
		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("NoxinantPunch",10,0,0,2)
			TNT1 A 0 A_CustomMissile("NoxinantPunch",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("NoxinantPunch",10,0,0,2)
			TNT1 A 0 A_CustomMissile("NoxinantPunch",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

		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_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("NoxinantFireball",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("NoxinantFireball",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
			
		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("NoxinantRocket",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("NoxinantRocket",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("NoxinantRocket",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("NoxinantRocket",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			
	}
}

ACTOR NoxinantRaisedByVile: Noxinant
{
	// 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.	
	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)
			TNT1 A 0 A_GiveInventory("ImmuneToToxicEffect", 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 ImmolantU: AbstractElemenantU 17853
{
	DamageFactor "Fire", 0.0
	DamageFactor "Flames", 0.0
	DamageFactor "Burn", 0.25
	Translation "80:111=168:191", "128:143=26:43", "9:12=189:191", "152:159=72:79", "144:151=25:47", "48:79=16:47", "160:167=170:185"
	+BRIGHT
	Tag "$IMMOLANT_U"
	Obituary "$IMMOLANT_O"
	
	States
	{
		Spawn:
			UKEL A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster") // no headbox
			TNT1 A 0 A_GiveInventory("FBD_FireEnhanced", 1)
			Goto Stand
			
		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", 24), "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 ("ImmolantRaisedByVile",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, 24, 0, 0)
			Stop
			
		Asplode:
			TNT1 A 0 A_CustomMissile ("FireEnhancedDeathExplosion", 0, 8, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_SpawnItemEx("SkeletonMeatsplosion", 0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			TNT1 A 30
			TNT1 A -1			

		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("ImmolantFireball",20,15,0,0)
			Goto See
		Missile2:	
			UKEL E 1 A_FaceTarget
			UKEL F 10 A_CustomMissile("ImmolantFireball",20,-15,0,0)
			Goto See
			
	}
}


ACTOR FriginantU: AbstractElemenantU 17854
{
	DamageFactor "Ice", 0.0
	DamageFactor "Frost", 0.0
	Translation "80:111=%[0.00,0.00,0.00]:[1.01,2.00,2.00]", "128:143=%[0.00,0.00,0.00]:[0.00,1.61,1.61]", "9:12=%[0.00,0.00,0.00]:[0.00,0.47,0.47]", "152:159=%[0.00,0.00,0.00]:[0.00,1.14,1.14]", "144:151=%[0.00,0.00,0.00]:[0.81,1.17,1.15]"
	Tag "$FRIGINANT_U"
	Obituary "$FRIGINANT_O"
	States
	{
		Spawn:
			UKEL A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster") // no headbox
			TNT1 A 0 A_GiveInventory("ImmuneToFrostEffect", 1)
			Goto Stand
			
		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", 25), "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 ("FriginantRaisedByVile",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, 25, 0, 0)
			Stop
			
		Asplode:
			TNT1 A 0 A_CustomMissile ("IceEnhancedDeathExplosion", 0, 8, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_SpawnItemEx("SkeletonMeatsplosion", 0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			TNT1 A 30
			TNT1 A -1				
			
		Missile:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("ImmuneToFrostEffect", 1)	
			//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("FriginantFireball",20,15,0,0)
			Goto See
			
		Missile2:	
			UKEL E 1 A_FaceTarget
			UKEL F 10 A_CustomMissile("FriginantFireball",20,-15,0,0)
			Goto See
			
	}
}


ACTOR NoxinantU: AbstractElemenantU 17855
{
	BloodType "NoxinantBloodz", "NoxinantBloodzSaw", "NoxinantBloodzSaw"
	Translation "80:111=112:127", "128:143=112:127", "16:24=87:95", "25:41=152:159", "42:47=9:12", "48:56=80:88", "57:72=89:111", "73:79=9:12", "160:167=152:159", "144:151=98:111", "208:223=112:127", "248:248=251:251", "232:235=155:159", "168:191=112:127"
	DamageFactor "Slime", 0.0
	Tag "$NOXINANT_U"
	Obituary "$NOXINANT_O"
	States
	{
		Spawn:
			UKEL A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster") // no headbox
			TNT1 A 0 A_GiveInventory("ImmuneToToxicEffect", 1)
			Goto Stand		
		
		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", 23), "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 ("NoxinantRaisedByVile",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, 26, 0, 0)
			Stop
		OnRezSfx:
			// knight, baron, duke, belphegor and cacodemon corpses must replace this method with one that has appropriate blood color
			TNT1 AAA 3 A_CustomMissile ("GreenBloodMistBig", 20, 0, random (0, 360), 2, random (30, 90))
			TNT1 AAAA 3 A_CustomMissile ("GreenBloodMist", 20, 0, random (0, 360), 2, random (30, 90))
			TNT1 AAAAA 3 A_CustomMissile ("GreenBloodMistSmall", 20, 0, random (0, 360), 2, random (30, 90))
			TNT1 A 30
			Stop
		Asplode:
			TNT1 A 0 A_CustomMissile ("PoisonEnhancedDeathExplosion", 0, 8, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_SpawnItemEx("NoxinantMeatsplosion", 0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			TNT1 A 30
			TNT1 A -1			
		Missile:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("ImmuneToToxicEffect")	
			//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("NoxinantFireball",20,15,0,0)
			Goto See
		Missile2:	
			UKEL E 1 A_FaceTarget
			UKEL F 10 A_CustomMissile("NoxinantFireball",20,-15,0,0)
			Goto See				
	}
}

//ACTOR ShockinantU: AbstractElemenantU 17856
// FBD_LightningEnhanced

ACTOR ImmolantUSpawner: RevenantUSpawner
{
	States
    {
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("FBD_TrySpawningRevenantU", 1)
		Fly:	
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Death")
			UKEL G 12
			Loop
		Death:
			TNT1 A 0 A_SpawnItemEx("FireEnhancedDeathExplosion",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			Stop
	}
}

ACTOR FriginantUSpawner: RevenantUSpawner
{
	States
    {
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("FBD_TrySpawningRevenantU", 2)
		Fly:	
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Death")
			UKEL G 12
			Loop
		Death:
			TNT1 A 0 A_SpawnItemEx("IceEnhancedDeathExplosion",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			Stop
	}
}

ACTOR NoxinantUSpawner: RevenantUSpawner
{
	Decal GreenBloodSplat
	Translation "80:111=112:127", "128:143=112:127", "16:24=87:95", "25:41=152:159", "42:47=9:12", "48:56=80:88", "57:72=89:111", "73:79=9:12", "160:167=152:159", "144:151=98:111", "208:223=112:127", "248:248=251:251", "232:235=155:159", "168:191=112:127"
	States
    {
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("FBD_TrySpawningRevenantU", 3)
		Fly:	
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Death")
			UKEL G 12
			Loop
		Death:
			TNT1 A 0 A_SpawnItemEx("PoisonEnhancedDeathExplosion",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			Stop
	}
}

//***Che DAFUG did I decide making him dark gray with green blood?
// Why, me, WHYYYYYYY :(((((

ACTOR RoamingNoxinantLegs: RoamingLegs
{
	BloodType "NoxinantBlood"
	Translation "80:111=112:127", "128:143=112:127", "16:24=87:95", "25:41=152:159", "42:47=9:12", "48:56=80:88", "57:72=89:111", "73:79=9:12", "160:167=152:159", "144:151=98:111", "208:223=112:127", "248:248=251:251", "232:235=155:159", "168:191=112:127"
	States
	{
		Death.SniperBullet:
		Death.Bullet792:			
		Death.Shotgun:
		Death.Minigun:
		XDeath:
			TNT1 AAAAAAAAAAAAAAAAA 0 A_CustomMissile ("NoxinantPiece", 37, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop	
	}
}

ACTOR NoxinantPiece: RevenantPiece
{
	Translation "80:111=112:127", "128:143=112:127", "16:24=87:95", "25:41=152:159", "42:47=9:12", "48:56=80:88", "57:72=89:111", "73:79=9:12", "160:167=152:159", "144:151=98:111", "208:223=112:127", "248:248=251:251", "232:235=155:159", "168:191=112:127"
}

ACTOR NoxinantDust: RevenantDust
{
	Translation "80:111=112:127", "128:143=112:127", "16:24=87:95", "25:41=152:159", "42:47=9:12", "48:56=80:88", "57:72=89:111", "73:79=9:12", "160:167=152:159", "144:151=98:111", "208:223=112:127", "248:248=251:251", "232:235=155:159", "168:191=112:127"
}

ACTOR NoxinantDust2: RevenantDust2 
{
	Translation "80:111=112:127", "128:143=112:127", "16:24=87:95", "25:41=152:159", "42:47=9:12", "48:56=80:88", "57:72=89:111", "73:79=9:12", "160:167=152:159", "144:151=98:111", "208:223=112:127", "248:248=251:251", "232:235=155:159", "168:191=112:127"
}

Actor NoxinantBloodz: GreenFBD_SawBlood
{
	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 AAA 0 A_CustomMissile ("NoxinantDust", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 AA 0 A_CustomMissile ("NoxinantDust2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 A 0 A_CustomMissile ("NoxinantPiece", 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("Green_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 NoxinantBloodzSaw: NoxinantBloodz
{
	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 ("NoxinantDust", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 AA 0 A_CustomMissile ("NoxinantDust2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 A 0 A_CustomMissile ("NoxinantPiece", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			Stop		
		HitGuts:
			TNT1 A 0 A_SpawnItem("Green_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("ChainsawHitGreen", 200, RGF_PLAYERS , 1)
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
			TNT1 A 0 A_RadiusGive("PowerGreenBloodOnVisor", 200, RGF_PLAYERS , 1)			
			TNT1 A 1
			Stop	
	}
}

ACTOR ImmolantPunch: REvenantAttack
{
	DamageType Burn // imp fireball, player has a lesser death than simply burning
}

ACTOR FriginantPunch: REvenantAttack
{
	DamageType Ice
}

ACTOR NoxinantPunch: REvenantAttack
{
	DamageType Slime
}


ACTOR ImmolantFireball: FBD_RevenantBall {

	//Translation "176:191=172:191", "168:175=168:171", "38:47=174:184", "128:143=172:183", "144:151=172:183", "58:79=172:191", "13:15=179:186", "16:47=168:191", "208:223=168:180", "160:167=168:179", "232:235=177:184"
	Translation "176:191=211:223", "168:175=208:210", "38:47=174:184", "128:143=211:221", "144:151=211:223", "58:79=211:223", "13:15=216:221", "16:47=208:223", "208:223=208:217", "160:167=208:215", "232:235=212:218"
	DamageType "Flames"
	Damage (Random(1,1))

	States {
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("RevenantFireballTrails", 1) // 0 immolant fireball
			TNT1 A 0 ACS_NamedExecuteWithResult("RFDeclumpManageServerside")
			Goto FlyTargetless
			
		Death:
		XDeath:
		Crash:
			TNT1 A 0
			//P.S. NOPE. this causes yfreets to infight them, which should not be happening
			//TNT1 A 0 A_SetDamageType("Burn")
			TNT1 A 0 A_Explode(7, 120, 1)

			TNT1 AAA 0 A_CustomMissile("ImmolatorIgniter", 0.0, 0.0, Random(-180,180), CMF_AIMDIRECTION | CMF_TRACKOWNER | CMF_SAVEPITCH, Random(5, 60))
			
			TNT1 A 0 A_SpawnItemEx("VFX_ImmolantBallHit", 0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			
			TNT1 A 30
			
			Stop
	}
}

ACTOR VFX_ImmolantBallHit 
{
	+NOGRAVITY
	+NOCLIP
	+NOINTERACTION
	+CLIENTSIDEONLY
	Radius 1
	Height 1
	States {
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("ExplosionFlareSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_CustomMissile ("BDExplosionparticles", 0, 0, random (0, 360), 2, random (40, 90))
			TNT1 A 0 A_CustomMissile ("BDExplosionparticles2", 0, 0, random (0, 360), 2, random (40, 90))
			TNT1 A 0 A_CustomMissile ("BDExplosionparticles3", 10, 0, random (0, 360), 2, random (40, 90))
			EXPL A 0 A_CustomMissile ("FlamethrowerFireParticles", 6, 0, random (0, 360), 2, random (0, 90))
			TNT1 A 1
			Stop
	}
}

ACTOR ImmolantRocket: RevenantUnguidedRocket
{
	DamageType Flames
	Translation "168:177=208:213", "178:191=214:223", "16:47=208:220"
	States {
		Death:
		XDeath:
		Crash:
			TNT1 A 0
			TNT1 A 0 A_Explode(7, 120, 1)
			TNT1 AAA 0 A_CustomMissile("ImmolatorIgniter", 0.0, 0.0, Random(-180,180), CMF_AIMDIRECTION | CMF_TRACKOWNER | CMF_SAVEPITCH, Random(5, 60))
			
			TNT1 A 0 A_SpawnItemEx ("ExplosionFlareSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_CustomMissile ("BDExplosionparticles", 0, 0, random (0, 360), 2, random (40, 90))
			TNT1 A 0 A_CustomMissile ("BDExplosionparticles2", 0, 0, random (0, 360), 2, random (40, 90))
			TNT1 A 0 A_CustomMissile ("BDExplosionparticles3", 10, 0, random (0, 360), 2, random (40, 90))
			EXPL A 0 A_CustomMissile ("FlamethrowerFireParticles", 6, 0, random (0, 360), 2, random (0, 90))
			Stop
	}	
}

ACTOR FriginantProjectileTrails: 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
			FRPB BCDEFGH 1 BRIGHT
			Stop
	}
}

ACTOR FriginantFireball: FBD_RevenantBall {
	Translation "176:191=194:200", "168:175=192:194", "38:47=194:199", "128:143=194:198", "144:151=195:198", "58:79=194:200", "13:15=198:201", "16:47=192:202", "208:223=192:200", "160:167=192:199", "232:235=197:200"
	DamageType "Ice"
	Damage (Random(1,1))
	States
	{
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("RevenantFireballTrails", 2) // 0 friginant fireball
			TNT1 A 0 ACS_NamedExecuteWithResult("RFDeclumpManageServerside")
			Goto FlyTargetless
		
		Death:
		XDeath:
		Crash:
			TNT1 A 0 A_Stop
			TNT1 A 0 A_Explode(5, 120, 0)
			//TNT1 A 0 A_CustomMissile("FrostEffect", 0.0, 0.0, 0, CMF_AIMDIRECTION | CMF_SAVEPITCH | CMF_TRACKOWNER, pitch)
			TNT1 A 0 A_RadiusGive("FrostAOE", 120, RGF_PLAYERS | RGF_MONSTERS | RGF_OBJECTS)
			TNT1 AAA 0 A_CustomMissile("FrostSpreader", 0.0, 0.0, Random(-180,180), CMF_AIMDIRECTION | CMF_TRACKOWNER | CMF_SAVEPITCH, Random(5, 60))
			
			TNT1 A 0 A_SpawnItemEx("VFX_FriginantBallHit", 0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			
			TNT1 A 30
			Stop
	}	
}

ACTOR VFX_FriginantBallHit 
{
	+NOGRAVITY
	+NOCLIP
	+NOINTERACTION
	+CLIENTSIDEONLY
	Radius 1
	Height 1
	States {
		Spawn:
			TNT1 A 0
			TNT1 AA 0 A_CustomMissile ("FrostVfx", 0, 0, 0, 2, random (-40,0))
			TNT1 AAAA 0 A_CustomMissile ("XIceChunk1", 48, 0, random (-60, 60), 2, random (-60,35))
			TNT1 AAA 0 A_CustomMissile ("XIceChunk2", 48, 0, random (-60, 60), 2, random (-60,35))
			TNT1 AA 0 A_CustomMissile ("XIceChunk3", 48, 0, random (-60, 60), 2, random (-60,35))	
			Stop	
	}
}



ACTOR FriginantRocket: RevenantUnguidedRocket
{
	DamageType Ice
	Translation "168:177=192:197", "178:191=198:202", "16:47=192:202", "160:167=80:99"
	States
	{
		Death:
		XDeath:
		Crash:
			TNT1 A 0 A_Stop
			TNT1 A 0 A_Explode(5, 120, 0)
			//TNT1 A 0 A_CustomMissile("FrostEffect", 0.0, 0.0, 0, CMF_AIMDIRECTION | CMF_SAVEPITCH | CMF_TRACKOWNER, pitch)
			TNT1 AAA 0 A_CustomMissile("FrostSpreader", 0.0, 0.0, Random(-180,180), CMF_AIMDIRECTION | CMF_TRACKOWNER | CMF_SAVEPITCH, Random(5, 60))
			
			TNT1 AA 0 A_CustomMissile ("FrostVfx", 0, 0, 0, 2, random (-40,0))
			TNT1 AAAA 0 A_CustomMissile ("XIceChunk1", 48, 0, random (-60, 60), 2, random (-60,35))
			TNT1 AAA 0 A_CustomMissile ("XIceChunk2", 48, 0, random (-60, 60), 2, random (-60,35))
			TNT1 AA 0 A_CustomMissile ("XIceChunk3", 48, 0, random (-60, 60), 2, random (-60,35))			
			TNT1 A 30
			Stop
	}
}

Actor NoxinantFireball: FBD_RevenantBall {
	Translation "176:191=152:159", "168:175=112:120", "38:47=194:199", "128:143=152:158", "144:151=152:159", "64:79=152:159", "56:63=112:120", "13:15=156:159", "24:47=152:159", "16:23=112:120", "214:223=152:159", "208:213=112:120", "160:162=112:120", "163:167=152:159", "232:235=155:159"
	DamageType Slime
	Damage (Random(15,15))
	States
	{
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("RevenantFireballTrails", 3) // 0 noxinant fireball
			TNT1 A 0 ACS_NamedExecuteWithResult("RFDeclumpManageServerside")
			Goto FlyTargetless
		Death:
		XDeath:
		Crash:
			TNT1 A 0 A_Stop
			TNT1 A 0 A_Explode(5, 120, 0)
			//TNT1 A 0 A_CustomMissile("ToxicEffect", 0.0, 0.0, 0, CMF_AIMDIRECTION | CMF_SAVEPITCH | CMF_TRACKOWNER, pitch)
			
			// unlike explosions, which are cubic, radiusgive is a sphere + sight check by default
			TNT1 A 0 A_RadiusGive("ToxicDOT", 120, RGF_PLAYERS | RGF_MONSTERS | RGF_OBJECTS)
			TNT1 AAA 0 A_CustomMissile("ToxicSpreader", 0.0, 0.0, Random(-180,180), CMF_AIMDIRECTION | CMF_TRACKOWNER | CMF_SAVEPITCH, Random(5, 60))
			
			
			TNT1 AAAAAAAAA 0 A_CustomMissile ("GreenFlameTrails", 0, 0, random (0, 360), 2, random (0, 360))			
			
			TNT1 A 30
			Stop
	}	
}



ACTOR NoxinantRocket: RevenantUnguidedRocket
{
	DamageType Slime
	Damage (Random(15,15))
	Translation "168:177=112:122", "178:191=152:159", "16:47=112:123", "160:167=112:123"
	States
	{
		Death:
		XDeath:
		Crash:
			TNT1 A 0 A_Stop
			TNT1 A 0 A_Explode(5, 120, 0)
			//TNT1 A 0 A_CustomMissile("ToxicEffect", 0.0, 0.0, 0, CMF_AIMDIRECTION | CMF_SAVEPITCH | CMF_TRACKOWNER, pitch)
			// unlike explosions, which are cubic, radiusgive is a sphere + sight check by default
			TNT1 A 0 A_RadiusGive("ToxicDOT", 120, RGF_PLAYERS | RGF_MONSTERS | RGF_OBJECTS)
			TNT1 AAA 0 A_CustomMissile("ToxicSpreader", 0.0, 0.0, Random(-180,180), CMF_AIMDIRECTION | CMF_TRACKOWNER | CMF_SAVEPITCH, Random(5, 60))
			
			
			TNT1 AAAAAAAAA 0 A_CustomMissile ("GreenFlameTrails", 0, 0, random (0, 360), 2, random (0, 360))			
			
			TNT1 A 30
			Stop
	}	
}

#include Elementals.txt