

//***Che: This file contains stuff that is used by ChebSkies-EDAY *with BD22*
//  it should be cloned as is into the BD22 min-patch included with ChebSkies.
//  i, myself, use a symlink






// ==========================================================================

//                                ARACNORB 

//    (aka Octabrain's little brother from a Duke-styled EDAY secret map)
// ==========================================================================




ACTOR ShoquePurple: Shoque {
	// "Shoque" is *red* ligtning dancing, defined in BD (see cacodemon) but never used. All uses are "ShoqueAzul" which is the blue variation
	Translation "176:191=250:254", "168:175=250:250"
}

ACTOR AracnorbMindBlast
{
	Game Doom
	SpawnID 53
	Radius 10
	Height 4
	Speed 10
	FastSpeed 10
	Damage (Random(4,4))
	PROJECTILE
	+THRUGHOST
	+SEEKERMISSILE
	Scale 0.5
    damagetype "Psionic"
	SeeSound "KYARNFIR"
	ActiveSound "KYARNACT"
	DeathSound "KYARNHIT"
	+FORCEXYBILLBOARD
	RenderStyle Add
	
	States
	{
		Spawn:
			TNT1 A 0 NODELAY A_GiveInventory("SummonsCount", 2, AAPTR_TARGET)
		Fly:
			TNT1 A 0 A_LoopActiveSound
			
			// Non-monster actors cannot *use* the master pointer as such
			//  because all master-related functions do nothing when called by a non-monster,
			//  which does not prevent using that pointer as a temporary buffer variable
			
			
			// now that the target pointer points at whoever this missile is homing at,
			// we can perform all kinds of checks 
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TracerIsInvisible"), "FlyAtInvisible")
			
			
			KYFR A 1 BRIGHT A_SeekerMissile (4,8, SMF_LOOK | SMF_PRECISE)
			KYFR BCD 1 BRIGHT 
			TNT1 A 0 A_CheckFlag("SOLID", 1, AAPTR_TARGET) // all mind blasts disappear with aracnorb's death
			Goto FadeAndVanish
			KYFR E 1 BRIGHT A_SeekerMissile (4,8, SMF_LOOK | SMF_PRECISE)
			KYFR FGH 1 BRIGHT
			TNT1 A 0 A_CheckFlag("SOLID", 1, AAPTR_TARGET)
			Goto FadeAndVanish
			KYFR I 1 BRIGHT A_SeekerMissile (4,8, SMF_LOOK | SMF_PRECISE)
			KYFR JKL 1 BRIGHT
			TNT1 A 0 A_CheckFlag("SOLID", 1, AAPTR_TARGET)
			Goto FadeAndVanish			
			KYFR M 1 BRIGHT A_SeekerMissile (4,8, SMF_LOOK | SMF_PRECISE)
			KYFR NOP 1 BRIGHT 
			TNT1 A 0 A_CheckFlag("SOLID", 1, AAPTR_TARGET)
			Goto FadeAndVanish
			TNT1 A 0 // obligatory frame to jump to
			Loop
			
		FlyAtInvisible:
	
			KYFR ABCD 1 BRIGHT 
			
			//TNT1 A 0 A_JumpIfInventory("SummonsCount", 4, "FadeAndVanish", AAPTR_TARGET)
			TNT1 A 0 A_CheckFlag("SOLID", 1, AAPTR_TARGET)
			Goto FadeAndVanish
			
			KYFR E 1 BRIGHT A_SeekerMissile (4,8, SMF_LOOK | SMF_PRECISE)
			
			// Wobble!
			TNT1 A 0 A_SetAngle(angle + random(-5,5))
			TNT1 A 0 A_ChangeVelocity(momx, momy, momz + 0.1 * random(-10,10), CVF_REPLACE)
			KYFR FGH 1 BRIGHT
			KYFR IJKL 1 BRIGHT 
			KYFR M 1 BRIGHT A_SeekerMissile (4,8, SMF_LOOK | SMF_PRECISE)
			TNT1 A 0 A_SetAngle(angle + random(-5,5))
			TNT1 A 0 A_ChangeVelocity(momx, momy, momz + 0.1 * random(-10,10), CVF_REPLACE)
			KYFR NOP 1 BRIGHT
			Goto Fly
			
		
		Crash:
		Death:		
			TNT1 A 0
			FIR6 A 0 Bright A_Explode(4, 120, 1)
			TNT1 A 0 A_TakeInventory("SummonsCount", 1, AAPTR_TARGET)
			Goto Explodez
		Xdeath:	
			TNT1 A 0
			TNT1 A 0 A_TakeInventory("SummonsCount", 1, AAPTR_TARGET)
			Goto Explodez
		Explodez:
			TNT1 A 0 
			// FIR6 is green plasma explosion played slowly
			FIR6 ABCDEFGHIJKLMNOP 5 BRIGHT A_CustomMissile ("ShoquePurple", 3, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0
			TNT1 A 30
			Stop
			
		FadeAndVanish:
			TNT1 A 0 A_StopSound
			TNT1 A 0 A_Stop
			TNT1 A 0 A_TakeInventory("SummonsCount", 1, AAPTR_TARGET)
			TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
			TNT1 A 0 A_ChangeFlag("THRUGHHOST", 1)
			FIR6 ABCDEFGHIJKLMNOP 5 BRIGHT A_FadeOut(0.063)
			Stop
			
		
	}
}

Actor DecreasedAgression: Inventory
{
	inventory.maxamount 100
}


// -- Aracnorb, ancestral class copy-pasted from BD21 ---------------------------------------------------

actor AracnorbBD21
{
	MONSTER
	+NOGRAVITY
	+FLOAT
	+FLOATBOB
	+DONTHURTSPECIES  
	Species "Arachnotron"
	Health 200
	Radius 24
	Height 56
	Mass 400
	Speed 5
	PainChance 150
	SeeSound "aracnorb/sight"
	ActiveSound "baby/active"
	PainSound "baby/pain"
	DeathSound "misc/gibbed"
	MeleeSound "demon/melee"
	MeleeDamage 6
	MissileHeight 36
	Obituary "%o was zapped by an aracnorb."
	HitObituary "%o had %p skull chewed by an aracnorb."
	damagefactor "Shrapnel", 3.0
	Scale 0.85
	States
	{
		Spawn:
			ACNB A 1 A_Look
			Loop
		See:
			ACNB A 2 A_Chase
			Loop
		Melee:
			TNT1 A 0 A_Playsound("caco/melee")
			ACNB A 3 A_FaceTarget
			TNT1 A 0 A_Recoil(-1)
			ACNB B 3 
			TNT1 A 0 A_Recoil(-1)
			ACNB C 3
			TNT1 AAA 0 A_CustomMissile("DemonAttack",40,0,0,0)
			ACNB B 3 
			ACNB A 5
			Goto See
		Missile:
			ACNB B 8 A_FaceTarget
			ACNB C 4 Bright
			ACNB B 2 A_CustomMissile("WeakGreenPlasmaBall", 34, 0, 0, 0)
			ACNB D 0 A_MonsterRefire(220, "See")
			Goto Missile

		Pain.Killme:
		Pain.Taunt:
			TNT1 A 0
			TNT1 A 0 HealThing(1)
			Goto Missile
				
		Pain:
			ACNF I 2
			ACNF I 2 A_Pain
			Goto See
		Pain.Kick:
		Pain.ExtremePunches:
			TNT1 A 0 A_Recoil(10)
			ACNF I 6 A_FaceTarget
			ACNF I 6 A_Pain
			Goto See    
		Pain.Avoid: 
			TNT1 A 0
			TNT1 A 0 A_Jump(256, "AvoidLeft", "AvoidRight")
			Goto AvoidLeft
	  
		AvoidLeft:
			ACNB A 1 A_FaceTarget
			TNT1 A 0 ThrustThing(angle*256/360+192, 15, 0, 0)
			ACNB A 5 A_FaceTarget
			Goto Missile
		AvoidRight:
			ACNB A 1 A_FaceTarget
			TNT1 A 0 ThrustThing(angle*256/360+64, 15, 0, 0)
			ACNB A 5 A_FaceTarget
			Goto Missile
    

		Death:
			ACNB D 0 A_ChangeFlag("FLOATBOB",0)	
			ACNB D 8 A_Scream
			TNT1 AAAAA 0 A_CustomMissile ("CeilBloodLauncherLong", 0, 0, random (0, 360), 2, random (50, 130))
			TNT1 AAAA 0 A_CustomMissile ("Guts", 32, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeathBrain1", 32, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeathBrain2", 32, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAAAAA 0 A_CustomMissile ("FBD_Bloodmist", 50, 0, random (0, 360), 2, random (60, 90))
			TNT1 AA 0 A_CustomMissile ("XDeathSpiderNew1", 42, 0, random (0, 360), 2, random (60, 90))
			TNT1 A 0 A_CustomMissile ("XDeathSpiderNew2", 42, 0, random (0, 360), 2, random (60, 90))
			ACNB E 6 A_NoBlocking
			ACNB FG 8
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			ACNB H -1 		
			Stop

		Death.SuperPlasma:
		Death.Plasma:
		Death.Plasma2:
		Death.GreenFire:
		Death.Electric:
			ACNB D 0 A_ChangeFlag("FLOATBOB",0)	 
			TNT1 A 0 A_Jump(50, "XDeath") 
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 50, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), 2, random (0, 160))
			EXPL AA 0 A_CustomMissile ("ExplosionSmoke", 32, 0, random (0, 360), 2, random (0, 360))
			CARB JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ 7 A_CustomMissile ("PlasmaSmoke", 15, 0, random (0, 360), 2, random (70, 110))
			CARB J -1
			Stop

		Death.Fire:
			TNT1 A 0
			ACNB D 0 A_ChangeFlag("FLOATBOB",0)	  
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 AAA 0 A_CustomMissile ("PEPart2", 32, 0, random (0, 360), 2, random (0, 160))
			ACNB DDDD 2 A_CustomMissile ("FlameTrails", 45, 0, random (0, 360), 2, random (50, 130))
			ACNB EEEE 2 A_CustomMissile ("FlameTrails", 30, 0, random (0, 360), 2, random (50, 130))
			ACNB FFFF 2 A_CustomMissile ("FlameTrails", 25, 0, random (0, 360), 2, random (50, 130))
			ACNB GGGG 2 A_CustomMissile ("FlameTrails", 25, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 0 A_Playsound("props/redfire")
			Goto Burns
		Burns:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("BrutalCounter")
			CARB JJ 2 A_SpawnItem("YellowFlare",0,20)
			ID22 F 0 A_CustomMissile ("FlameTrails", 20, 0, random (0, 360), 2, random (70, 110))
			CARB JJ 2 A_SpawnItem("YellowFlare",0,20)
			ID22 F 0 A_CustomMissile ("FlameTrails", 20, 0, random (0, 360), 2, random (70, 110))
			ID22 F 0 A_CustomMissile ("PlasmaSmoke", 30, 0, random (0, 360), 2, random (70, 110))
			TNT1 A 0 A_JumpIfInventory("BrutalCounter", 30, "Smokes")
			Loop
		Smokes:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("BrutalCounter", 60, "Rest")
			TNT1 A 0 A_GiveInventory("BrutalCounter")
			CARB J 5 A_CustomMissile ("PlasmaSmoke", 30, 0, random (0, 360), 2, random (70, 110))
			Loop	
		Rest:	
			CARB J -1
			Stop    
    

		Death.Cut:
		Death.Saw:
			ACNB D 0 A_ChangeFlag("FLOATBOB",0)	 
			TNT1 A 0 A_Jump(50, "XDeath")     	
			TNT1 AAA 0 A_CustomMissile ("Guts2", 14, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("CeilBloodLauncher", 40, 0, random (0, 360), 2, random (50, 130))
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 10, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2", 10, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAAAAAAAA 0 A_CustomMissile ("PlayerFlyingBlood", 50, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			ACNB JKLM 4 
			TNT1 AAAAAAAAA 0 A_CustomMissile ("XDeathBrain1", 24, 15, random (0, 360), 2, random (0, 160))
			TNT1 AAAAAAAAAA 0 A_CustomMissile ("Guts2", 24, 15, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			ACNB NNNNN 1	A_CustomMissile ("Brutal_LiquidBlood2", 28, 0, random (0, 360), 2, random (30, 60))	
			ACNB OOOOO 1	A_CustomMissile ("Brutal_LiquidBlood2", 21, 0, random (0, 360), 2, random (30, 60))	
			ACNB PPPPPPPP 1	A_CustomMissile ("Brutal_LiquidBlood2", 14, 0, random (0, 360), 2, random (30, 60))	
			ACNB P -1
			Stop    
    
/*	Death.Ice:
		Death.Freeze:
		Death.Frost:
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_ChangeFlag("SOLID", 0)
			TNT1 A 0 A_SpawnItem("FrozenAracnorb")
			Stop
*/		    
		Death.XDeath:
		Death.Blast:
		Death.SSG:
		Death.ExplosiveImpact:
		Death.FriendlyExplosion:			
		Death.Crush:
		Death.Bfg10k: //***Che changed damage type from extreme to custom		
			ACNB D 0 A_ChangeFlag("FLOATBOB",0)	 	
			ACNB I 2
			TNT1 A 0 A_Playsound("misc/gibbed",3)    
			TNT1 AAA 0 A_CustomMissile ("Guts2", 14, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("CeilBloodLauncher", 40, 0, random (0, 360), 2, random (50, 130))
			TNT1 AAAAAA 0 A_CustomMissile ("XDeath1", 10, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAAAA 0 A_CustomMissile ("XDeath2", 10, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("Aracnorb_BrainBD21", 32, 0, random (0, 360), 2, random (0, 160))	  
			TNT1 AAAAAAAAAA 0 A_CustomMissile ("PlayerFlyingBlood", 50, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			POSS STUVW 3
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			POSS X -1 
			Stop  
    
		Raise:
			TNT1 A 0 A_SpawnItemEx("StandaloneRezSfx",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			ACNB HGFEDA 8
			ACNB A 0 A_ChangeFlag("FLOATBOB",1)
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_CustomizeOnRez") // it runs OnRezMapScript
				// if the map prpvides one
			Goto See
	}
}

ACTOR Aracnorb_BrainBD21
{
    Radius 8
    Height 8
    Speed 16
    Scale 1.5
	Mass 1
    +NOBLOCKMAP
	+MISSILE
    +NOTELEPORT
    +MOVEWITHSECTOR
    +CLIENTSIDEONLY
    +RIPPER
    +BLOODLESSIMPACT 
    +DOOMBOUNCE
	+SKYEXPLODE
    BounceFactor 0.5
	damagetype Blood
    SeeSound "misc/xdeath4"
    DeathSound "misc/xdeath1"
	Decal BloodSuper
    States
    {
		Spawn:
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
			ID22 A 2 A_CustomMissile("BloodTrails",0,0,180,2)
		
			ID22 B 2 A_CustomMissile("BloodTrails",0,0,180,2)
			
			ID22 C 2 A_CustomMissile("BloodTrails",0,0,180,2)
			
			ID22 D 2 A_CustomMissile("BloodTrails",0,0,180,2)
			Loop
		Death:
		
			ID22 F 1 A_SpawnItem("FBD_FlyingBlood",0,5,0,1)
			ID22 F -1
			Stop
			TNT1 A 1
		Splash:
			TNT1 A 0
			Stop
    }
}


// -- end copy-paste ------------------------------------------------------------------



ACTOR ArachnorbChe: AracnorbBD21 17607 {

	//***Che radius, height and maxdropoffheight (n/a for flying ones) MUST be kept consistent with FBD_TrySpawn in FBD_CORE.acs!

	//$category "FBD Monsters"
	
	PainChance "Avoid", 128
	Tag "$ARACNORB"
	Obituary "$ARACNORB_O"	
	HitObituary "$ARACNORB_OH"
	
	var int user_sleeping;
	var int user_item_no;
	var int user_serverside_sfchk;
	
	Radius 16 // he's the size of a normal humanoid monster
	
	damagefactor "Argent", 0.0
	
	damagefactor "Killme", 1.0 // AOE inflicted by captured marines
	PainChance "Killme", 255
	
	States {
		Spawn:
			ACNB A 1 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster")
			
		Stand:
			ACNB A 10 A_Look
			Loop	
		Death.Ice:
		Death.Freeze:
		Death.Frost:
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("FrozenAracnorb",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		Death.IOS_Frost:
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("PermafrostArachnorb",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)		
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		Pain:
			TNT1 A 0 A_TakeInventory("SummonsCount", 1)
			ACNF I 2
			TNT1 A 0 A_TakeInventory("DecreasedAgression", 100)
			ACNF I 2 A_Pain
			Goto See
		See:
			ACNB A 2 A_Chase
			TNT1 A 0 A_JumpIfInventory("DecreasedAgression", 20, "SeeChill")
			TNT1 A 0 A_JumpIfTargetInLOS("SeeRabid",0,JLOSF_DEADNOJUMP) 
			TNT1 A 0 A_TakeInventory("DecreasedAgression", 1)
			Loop
		SeeRabid:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("DecreasedAgression", 80, "SeeChill")
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "SeeCantSee")
			TNT1 A 0 A_Jump(200, "Missile")
			ACNB A 2 A_Chase
			Goto See
		Idle: // without this, the game engine puts him into his Spawn state when he loses target 
				//-- and that wrecks havok with the init scripts!
			TNT1 A 0
			TNT1 A 0 A_SetUserVar("user_sleeping", 1)
			Goto Stand	

		Idle: // without this, the game engine puts him into his Spawn state when he loses target 
				//-- and that wrecks havok with the init scripts!
			TNT1 A 0
			TNT1 A 0 A_SetUserVar("user_sleeping", 1)
			
		SearchPlayer:
			ANCB A 10 A_Look
			TNT1 A 0 A_SetAngle(angle - 30)
			ANCB A 10 A_Look
			TNT1 A 0 A_SetAngle(angle + 30)
			ANCB A 10 A_Look
			TNT1 A 0 A_SetAngle(angle + 30)
			ANCB A 10 A_Look
			TNT1 A 0 A_SetAngle(angle - 30)
			
			
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			
			TNT1 A 0 A_Jump(128, "SearchPlayer")
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			ANCB A 0 A_Wander
			ANCB A 2 A_Look
			Goto SearchPlayer

			
		SeeCantSee:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("DecreasedAgression", 7)
		SeeChill:	
			ACNB A 2 A_Chase
			TNT1 A 0 A_TakeInventory("DecreasedAgression", 1)
			TNT1 A 0 A_Jump(256, "See")
			Loop // should never execute
		Missile:
			TNT1 A 0 A_JumpIfInventory("SummonsCount", 1, "AvoidRandom") // prevent mind blast spam!
				// aracnorb is nasty on large maps, mind blasts got no declumping mechanism.
			
			// Kinslayer check:	
			TNT1 A 0 A_JumpIf(!CheckClass("ArachnorbChe", AAPTR_TARGET, true), 2)
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_InfightFriendlyFireOn")
		
			ACNB B 8 A_FaceTarget
			ACNB C 4 Bright
			ACNB B 2 A_CustomMissile("AracnorbMindBlast", 34, 0, 0, 0)
			ACNB B 8
			ACNB A 8
			TNT1 A 0 A_GiveInventory("DecreasedAgression", 9)
			TNT1 A 0 A_Jump(220, "AvoidLeft", "AvoidRight")
			TNT1 A 0 A_Jump(256, "SeeRabid")
			Goto See
		Pain.Avoid: // inflicted by the tracer "Alerter" fired by: the vanilla bfg9000; the revenant launcher; the minigun when beginning to spin up; the rocket launcher. 
			TNT1 A 0
			TNT1 A 0 A_TakeInventory("SummonsCount", 99)
			TNT1 A 0 HealThing(1)
			TNT1 A 0 A_JumpIf(user_sleeping, "See") // dont dodge if unaware
			TNT1 A 1 A_Jump(256, "AvoidLeft", "AvoidRight")
			Wait
		AvoidRandom:
			TNT1 A 0 A_TakeInventory("SummonsCount", 1)
			TNT1 A 1 A_Jump(256, "AvoidLeft", "AvoidRight")
			Wait
		AvoidLeft:
			ACNB A 1 A_FaceTarget
			TNT1 A 0 ThrustThing(angle*256/360+192, random(4,10), 0, 0)
			ACNB A 5 A_FaceTarget
			TNT1 A 1 A_Jump(256, "AvoidUp", "AvoidDown")
			Wait
		AvoidRight:
			ACNB A 1 A_FaceTarget
			TNT1 A 0 ThrustThing(angle*256/360+64, random(4,10), 0, 0)
			ACNB A 5 A_FaceTarget
			TNT1 A 1 A_Jump(256, "AvoidUp", "AvoidDown")
			Wait
		AvoidUp:
			ACNB A 1 A_FaceTarget	
			TNT1 A 0 ThrustThingZ(0, random(4,10), 0, 1)
			ACNB A 5 A_FaceTarget
			Goto See
		AvoidDown:
			ACNB A 1 A_FaceTarget	
			TNT1 A 0 ThrustThingZ(0, random(4,10), 1, 1)
			ACNB A 5 A_FaceTarget
			Goto See
		Death.Fatality:
			// was never implemented in BD21.
			// ersatz fatality: doomguy punches, we asplode, doomguy flexes
			TNT1 A 0 
			TNT1 A 0 A_NoBlocking
			
			TNT1 A 0 A_GiveToTarget("GoFatality", 1)
			TNT1 A 0 A_GiveToTarget("ErsatzFatality", 1)	
			
			// after exactly 15 tics, asplode
			ACNB A 9 A_FaceTarget
			ACNB B 6
			
			TNT1 A 0 A_StopSound(CHAN_VOICE)
			
			//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
						
			Goto Death.ExplosiveImpact //XDeath	

		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", 2017) // 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			
	}
}


ACTOR AracnorbRaisedByVile: ArachnorbChe {
	States {
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster")
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)		
			ACNB HGFEDA 8
			ACNB A 0 A_ChangeFlag("FLOATBOB",1)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_CustomizeOnRez") // it runs OnRezMapScript
				// if the map prpvides one
			Goto See		

	}
}













