




// a placeholder stub
ACTOR FBD_Vanillatron: FBD_Arachnotron1 17861
{
	Health 1000
	Tag "Placeholder"
	Obituary "%o was killed by a placeholder"
}

Actor FBD_Mindblower: FBD_Arachnotron2 17860
{
	// shiny red
	Translation "48:79=16:47", "128:143=168:187", "144:151=32:42", "13:15=38:45", "236:239=[70,0,0]:[0,0,0]", "250:254=160:167"
	
	Obituary "$MINDBLOWER_O" // "%o was killed by an Ancient Arachnotron.";
	Tag "$MINDBLOWER" //"Ancient Arachnotron";
	
	
	States {
		
		// Spider mastermind attack
		
		Missile:
			TNT1 A 0 A_TakeInventory ("BrutalCounter2", 500)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			TNT1 A 0 A_ChangeFlag("NODROPOFF", 0)
			ARAC A 4 A_FaceTarget 
			ARAC A 4 //A_FaceTarget 
			ARAC A 4 //A_FaceTarget 
			ARAC G 4 //A_FaceTarget
			
		MissileContinue:	
			
			ARAC G 3 //A_FaceTarget
			//***Che: do NOT adjust aim if target goes out of sight or is invisible
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "MissileAtInvisible")
			TNT1 A 0 A_JumpIfTargetInLOS(2)
			TNT1 A 0 A_Jump(256, 2)
			TNT1 A 0 A_FaceTarget			
			
			ARAC H 2 BRIGHT A_CustomMissile("MastermindTracer", 22, 0, random(-3, 3)+ angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH, random(-1, 1))
			TNT1 A 0 A_SpawnItem ("MasterMindCaseSpawn", 0, 60,0)
			
			TNT1 A 0 A_GiveInventory ("BrutalCounter2", 1)
			TNT1 A 0 A_JumpIfInventory("Enraged", 1, 2)
			TNT1 A 0 A_JumpIfInventory ("BrutalCounter2", 30, "StopFiring")
			TNT1 A 0 A_JumpIfInventory ("BrutalCounter2", 50, "StopFiring") // enraged
			//ARAC G 0 A_SpidRefire // includes A_FaceTarget as part of its action!!
			//Goto Missile+7
			
		MissileSpidRefire:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("Enraged", 1, "EnragedRefire")
			TNT1 A 0 A_JumpIfTargetInLOS("MissileContinue", 0, JLOSF_DEADNOJUMP)
			TNT1 A 0 A_Jump(192, "MissileContinue") // https://zdoom.org/wiki/A_MonsterRefire
			Goto See
		EnragedRefire:
			TNT1 A 0
			TNT1 A 0 A_Jump(208, "MissileContinue") // https://zdoom.org/wiki/A_MonsterRefire
			Goto See	
			
		MissileAtInvisible:
			TNT1 A 0
			TNT1 A 0 A_Jump(252, 2) // 1/64th chance to readjust aim
			TNT1 A 0 A_FaceTarget
			
			ARAC G 3
			ARAC H 2 BRIGHT A_CustomMissile("MastermindTracer", 22, 0, random(-3, 3)+ angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH, random(-1, 1))
			TNT1 A 0 A_SpawnItem ("MasterMindCaseSpawn", 0, 60,0)
			
			TNT1 A 0 A_GiveInventory ("BrutalCounter2", 1)
			TNT1 A 0 A_JumpIfInventory ("BrutalCounter2", 30, "StopFiring")
			ARAC G 0 A_SpidRefire
			Goto MissileContinue	
		
		StopFiring:
			ARAC A 6 A_FaceTarget 
			Goto See
	
		// *most* deaths (except fatality and fire) are him blowing up, mastermind style
		Death:
		Death.Cutless:
		Death.SuperPlasma:
		Death.Plasma:
		Death.Electric:
		Death.Plasma2:
		Death.Psionic:
		Death.Cut:
		Death.Saw:
		Death.Tear:	
		Death.Crush:
		Death.BlackHole:
		Death.QuadBlast:
		XDeath:
		Death.Bfg10k:
		XDeathRare:
		Death.Ice:
		Death.Freeze:
		Death.Frost:
		Death.IOS_Frost:
			ARAC J 1
			ARAC J 20 A_Scream
			tnt1 a 0 A_FaceTarget
			ARAC K 10 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("RidiculousExplosionSpawner", 30, 0, random (0, 360), 2, 90)
			ARAC LM 5
			EXPL A 0 Radius_Quake (8, 100, 0, 22, 0)
			TNT1 A 0 A_Explode(150, 300)
			TNT1 AAAAAAAAAA 0 A_CustomMissile ("PEPart2SuperFast", 32, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 90))
			TNT1 AAAAAAAAAA 0 A_CustomMissile ("BloodMistXXBig", 100, 0, random (0, 360), CMF_AIMDIRECTION, random (40, 90))
			TNT1 AAA 0 A_CustomMissile ("MindblowerLeg", 40, 0, random (0, 360), 2, random (40, 90))
			TNT1 A 0 A_SpawnItem ("GiantBloodSpot")
			
			TNT1 A 0 A_ChangeFlag("NOTARGET", 1)
			TNT1 A -1 // be raiseable
		
		Raise:
			TNT1 A 0 A_SpawnItemEx("StandaloneRezSfx",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			AR4C NMLKJ 5
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_CustomizeOnRez") // it runs OnRezMapScript
				// if the map prpvides one
			Goto SeeContinue1

		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", 2027) // 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 MindblowerLeg: SpiderLeg2
{
	Translation "48:79=16:47", "128:143=168:187", "144:151=32:42", "13:15=38:45", "236:239=[70,0,0]:[0,0,0]", "250:254=160:167"
}

ACTOR WeakMastermind: FBD_Mindblower {} // class name may be in use by some old script in chebskies


Actor MindblowerRaisedByVile: FBD_Mindblower {
	States {
		Spawn: 
			ARAC P 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster")
			

			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			
/*			//***Che this was the original BD animation. I replaced it with standard FBD raising SFX of blood mist
			TNT1 A 2 A_CustomMissile ("RealFlameTrailsSmall", 6, 0, random (0, 360), 2, random (70, 110))
			TNT1 A 0 A_SpawnItem("PentagramSpawner", 1, 60)
			TNT1 A 2 A_CustomMissile ("RealFlameTrailsSmall", 6, 0, random (0, 360), 2, random (70, 110))
			TNT1 A 0 A_SpawnItem("PentagramSpawner", 1, 60)
			TNT1 A 0 A_SpawnItem("TeleportFog")	
*/			
			
			ARAC PONMLKJ 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		

	}
}