Actor MCLargeMobRunnerHeretic : MCLargeMobRunner
{
	States
	{
	Spawn:
		TNT1 A 0 //NoDelay //ACS_NamedExecuteAlways("DirectorLimiter",0,3,0)
//Chooses between spider mastermind and cyberdemon.
		TNT1 A 0 A_SetUserArray("user_boss",0,random(0,1))
		TNT1 A 0 A_SetUserVar("user_dlimit",0)
		TNT1 A 0 A_SetUserVar("user_dlimitb",0)
		TNT1 A 0 //A_GiveInventory("CooldownEnable1",1)
		TNT1 A 0 A_Jump(256,"Idle")
	Idle:
		TNT1 AAAAA 1 A_Look
	See:
		TNT1 A 0 A_SetUserArray("user_x",0,x)
		TNT1 A 0 A_SetUserArray("user_y",0,y)
	Wanderbout:
		TNT1 A 1 A_Chase("","")
		TNT1 AAAAAAAAAAAAAAAAAAAA 1 A_Wander
		TNT1 A 0 A_SetUserArray("user_x",1,x)
		TNT1 A 0 A_SetUserArray("user_y",1,y)
		TNT1 A 0 A_JumpIf((user_x[0]==user_x[1])&&(user_y[0]==user_y[1]),"Stuck")
	Mobmaking:
		TNT1 A 0 A_CheckSight(1)
		Goto Wanderbout
		TNT1 A 0 A_CheckRange(2048,1)
		Goto Wanderbout
		TNT1 A 0 A_JumpIf(user_boss[1]==1,"BossCheck")
		TNT1 A 0 A_Jump(64,"BossCheck")
		Goto IronLichSpawn
	BossCheck:
		TNT1 A 0 A_SetUserArray("user_boss",1,1)
	SC1:
		TNT1 A 0 A_UnsetSolid
		TNT1 A 1 A_Chase("","")
		TNT1 A 0 A_CheckSight(1)
		Loop
		TNT1 A 0 A_CheckRange(2048,1)
		Loop
		TNT1 A 0 A_JumpIf(user_boss[0]==1,"MinotaurSpawn")
		Goto MinotaurSpawn2
	MinotaurSpawn:
		TNT1 A 0 Thing_ChangeTID(0,32666)
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_SpawnItemEx("Minotaur",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		TNT1 A 0 A_JumpIf(tid!=0,"See") //Means the actor failed to spawn.
		Goto CountUpBoss //One-hit wonder. We really don't need these things spawning more than one.
	MinotaurSpawn2:
		TNT1 A 0 Thing_ChangeTID(0,32666)
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_SpawnItemEx("Minotaur",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		TNT1 A 0 A_JumpIf(tid!=0,"See")
		Goto CountUpBoss
	IronLichSpawn:
		TNT1 A 0 Thing_ChangeTID(0,32666)
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_SpawnItemEx("IronLich",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		TNT1 A 0 A_JumpIf(tid!=0,"See")
		Goto CountUp
	CountUp:
		TNT1 A 0 A_SetUserVar("user_dlimit",user_dlimit+1)
		TNT1 A 0 A_JumpIf(user_dlimit>=5+ACS_NamedExecuteWithResult("WOC PLAYERCOUNT")/2 + ACS_ExecuteWithResult(WOC_DECORATE, STATS, GLOBALLEVEL)/10,"Vanish")
		Goto See
	CountUpBoss:
		TNT1 A 0 A_SetUserVar("user_dlimitb",user_dlimitb+1)
		TNT1 A 0 A_JumpIf(user_dlimitb>=1+ACS_NamedExecuteWithResult("WOC PLAYERCOUNT")/5 + ACS_ExecuteWithResult(WOC_DECORATE, STATS, GLOBALLEVEL)/50,"Vanish")
		Goto See
	}
}

Actor MCSquadMobRunnerHeretic : MCSquadMobRunner
{
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 //ACS_NamedExecuteAlways("DirectorLimiter",0,3,0)
		TNT1 A 0 A_SetUserVar("user_dlimit",0)
		TNT1 A 0 //A_GiveInventory("CooldownEnable1",1)
		TNT1 A 0 A_Jump(256,"Idle")
	Idle:
		TNT1 AAAAA 1 A_Look
	See:
	Wanderbout:
		TNT1 A 1 A_Chase
		TNT1 AAAAAAAAAAAAAAAAAAAA 1 A_Wander
	Mobmaking:
		TNT1 A 0 A_CheckSight(1)
		Goto Wanderbout
		TNT1 A 0 A_CheckRange(2048,1)
		Goto Wanderbout
		TNT1 A 0 Thing_ChangeTID(0,32670) 
		//The above call is used to check and see if the spawning worked.
		//If it did, its TID is set to 0.
		TNT1 A 0 //A_Log("Medium Monster")
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_Jump(256,1,2,3,4,5)
		TNT1 A 0 A_SpawnItemEx("Snake",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("Beast",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("Wizard",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("KnightGhost",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("Knight",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
	CountUp:
		TNT1 A 0 A_JumpIf(tid!=0,"Wanderbout") //Means it didn't work.
		TNT1 A 0 //A_Log("Good")
		TNT1 A 0 A_SetUserVar("user_dlimit",user_dlimit+1)
		TNT1 A 0 A_JumpIf(user_dlimit>=11+ACS_NamedExecuteWithResult("WOC PLAYERCOUNT") + ACS_ExecuteWithResult(WOC_DECORATE, STATS, GLOBALLEVEL)/4,"Vanish")
		Goto Wanderbout
	}
}

Actor MCMediumMobRunnerHeretic : MCMediumMobRunner
{
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 //ACS_NamedExecuteAlways("DirectorLimiter",0,3,0)
		TNT1 A 0 A_SetUserVar("user_dlimit",0)
		TNT1 A 0 //A_GiveInventory("CooldownEnable1",1)
		TNT1 A 0 A_Jump(256,"Idle")
	Idle:
		TNT1 AAAAA 1 A_Look
	See:
	Wanderbout:
		TNT1 A 1 A_Chase
		TNT1 AAAAAAAAAAAAAAAAAAAA 1 A_Wander
	Mobmaking:
		TNT1 A 0 A_CheckSight(1)
		Goto Wanderbout
		TNT1 A 0 A_CheckRange(2048,1)
		Goto Wanderbout
		TNT1 A 0 Thing_ChangeTID(0,32667) 
		//The above call is used to check and see if the spawning worked.
		//If it did, its TID is set to 0.
		TNT1 A 0 //A_Log("Medium Monster")
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_Jump(256,1,2,3,4,5)
		TNT1 A 0 A_SpawnItemEx("Snake",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("Beast",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("Wizard",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("KnightGhost",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("Knight",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
	CountUp:
		TNT1 A 0 A_JumpIf(tid!=0,"Wanderbout") //Means it didn't work.
		TNT1 A 0 //A_Log("Good")
		TNT1 A 0 A_SetUserVar("user_dlimit",user_dlimit+1)
		TNT1 A 0 A_JumpIf(user_dlimit>=6+ACS_NamedExecuteWithResult("WOC PLAYERCOUNT")/2 + ACS_ExecuteWithResult(WOC_DECORATE, STATS, GLOBALLEVEL)/8,"Vanish")
		Goto Wanderbout
	}
}

Actor MCHordeMobRunnerHeretic : MCHordeMobRunner
{
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 //ACS_NamedExecuteAlways("DirectorLimiter",0,3,0)
		TNT1 A 0 A_SetUserVar("user_dlimit",0)
		TNT1 A 0 //A_GiveInventory("CooldownEnable1",1)
		TNT1 A 0 A_Jump(256,"Idle")
	Idle:
		TNT1 AAAAA 1 A_Look
	See:
	Wanderbout:
		TNT1 A 1 A_Chase
		TNT1 AAAAAAAAAAAAAAAAAAAA 1 A_Wander
	Mobmaking:
		TNT1 A 0 A_CheckSight(1)
		Goto Wanderbout
		TNT1 A 0 A_CheckRange(2048,1)
		Goto Wanderbout
		TNT1 A 0 Thing_ChangeTID(0,32669)
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_Jump(256,1,2,3,4,5,6)
		TNT1 A 0 A_SpawnItemEx("HereticImp",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("Mummy",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("MummyGhost",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("MummyLeader",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("Clink",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("MummyLeaderGhost",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
	CountUp:
		TNT1 A 0 A_JumpIf(tid!=0,"Wanderbout") //Means it didn't work.
		TNT1 A 0 //A_Log("Good")
		TNT1 A 0 A_SetUserVar("user_dlimit",user_dlimit+1)
		TNT1 A 0 A_JumpIf(user_dlimit>=27+3*ACS_NamedExecuteWithResult("WOC PLAYERCOUNT") + 3*ACS_ExecuteWithResult(WOC_DECORATE, STATS, GLOBALLEVEL)/5,"Vanish")
		Goto Wanderbout
	}
}

Actor MCSmallMobRunnerHeretic : MCSmallMobRunner
{
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 //A_GiveInventory("CooldownEnable2",1)//ACS_NamedExecuteAlways("DirectorLimiter",0,1,0)
		TNT1 A 0 A_SetUserVar("user_dlimit",0)
		TNT1 A 0 A_Jump(256,"Idle")
	Idle:
		TNT1 AAAAA 1 A_Look
	See:
	Wanderbout:
		TNT1 A 1 A_Chase
		TNT1 AAAAAAAAAAAAAAAAAAAA 1 A_Wander
	Mobmaking:
		TNT1 A 0 A_CheckSight(1)
		Goto Wanderbout
		TNT1 A 0 A_CheckRange(2048,1)
		Goto Wanderbout
		TNT1 A 0 Thing_ChangeTID(0,32669)
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_Jump(256,1,2,3,4,5,6)
		TNT1 A 0 A_SpawnItemEx("HereticImp",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("Mummy",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("MummyGhost",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("MummyLeader",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("Clink",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
		TNT1 A 0 A_SpawnItemEx("MummyLeaderGhost",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS|SXF_CLEARCALLERTID)
		Goto CountUp
	CountUp:
		TNT1 A 0 A_JumpIf(tid!=0,"Wanderbout")
		TNT1 A 0 A_SetUserVar("user_dlimit",user_dlimit+1)
		TNT1 A 0 A_JumpIf(user_dlimit>=9+ACS_NamedExecuteWithResult("WOC PLAYERCOUNT") + ACS_ExecuteWithResult(WOC_DECORATE, STATS, GLOBALLEVEL)/5,"Vanish")
		Goto Wanderbout
	}
}