// Acolyte Stuff //
Actor AcolyteInitialized : Inventory {}
Actor AcolyteClassic : Inventory {}
Actor AcolyteLonghorn : Inventory {}
Actor AcolyteStrucker : Inventory {}
Actor AcolytePulverizer : Inventory {}

Actor GCSAcolyteInit : CustomInventory {

	// This is where the magic happens. Every Acolyte gives itself this item at
	// spawn. This actor checks a server-level CVar, then determines the chance
	// of that Acolyte using a GC weapon. It gives items accordingly so that the
	// Acolyte can access the appropriate attack state and drop the right ammo 
	// on death. It also sets the proper translation for the Acolyte. The point 
	// of this madness is to keep the actual monster definition relatively 
	// clean. I'd like to do this with user variables, but that doesn't work for 
	// CustomInventory actors. It's a catch-22; both would need to have the 
	// variables defined, but G/ZDoom errors out if that's the case, because the 
	// item being given and the actor recieving it have the same variables 
	// defined.
	
	+ALWAYSPICKUP
	States
	{
	Pickup:
		TNT1 A 0 A_JumpIfInventory("AcolyteInitialized", 1, "Null")
		TNT1 A 0 A_GiveInventory("AcolyteInitialized")
		TNT1 A 0 A_JumpIf(CheckClass("GCS_AcolyteShadow"), "ShadowAcolyte")
		TNT1 A 0 A_JumpIf(CheckClass("GCS_AcolyteTan"), 1)
		
		Goto OtherAcolytes
		TNT1 A 0 A_JumpIf(GetCVar("GC_StrifeAcolyteRandomizeWeapon") == 0, 2)
		TNT1 A 0 A_Jump(GetCVar("GC_StrifeAcolyteRandomizeWeapon")*32, "LonghornAco","StruckerAco","PulverizerAco")
		TNT1 A 0 A_GiveInventory("AcolyteClassic")
		Stop
		
	 LonghornAco:
		TNT1 A 0 A_GiveInventory("AcolyteLonghorn")
		TNT1 A 0 A_Jump(256,1,2)
		TNT1 A 0 A_SetTranslation("Acolyte_LonghornGold")
		Stop
		TNT1 A 0 A_SetTranslation("Acolyte_LonghornBlue")
		Stop
		
	 StruckerAco:
		TNT1 A 0 A_GiveInventory("AcolyteStrucker")
		TNT1 A 0 A_Jump(256,1,2,3)
		TNT1 A 0 A_SetTranslation("Acolyte_StruckerGrey")
		Stop
		TNT1 A 0 A_SetTranslation("Acolyte_StruckerRust")
		Stop
		TNT1 A 0 A_SetTranslation("Acolyte_StruckerOlive")
		Stop
		
	 PulverizerAco:
		TNT1 A 0 A_GiveInventory("AcolytePulverizer")
		TNT1 A 0 A_Jump(256,1,2)
		TNT1 A 0 A_SetTranslation("Acolyte_PulverizerRed")
		Stop
		TNT1 A 0 A_SetTranslation("Acolyte_PulverizerGreen")
		Stop
		
	ShadowAcolyte:
		TNT1 A 0 {
			A_SetRenderStyle(0.4, STYLE_Translucent);
			A_ChangeFlag("Shadow", 1);
		}
		TNT1 A 0 A_JumpIf(GetCVar("GC_StrifeAcolyteRandomizeWeapon") > 0, 2)
		TNT1 A 0 A_GiveInventory("AcolyteClassic")
		Stop
		TNT1 A 0
		Goto Pickup+5
		
	OtherAcolytes:
		TNT1 A 0 A_JumpIf(GetCVar("GC_StrifeAcolyteRandomizeWeapon")>0,"OA_ChanceOfWeapon")
		TNT1 A 0 A_GiveInventory("AcolyteClassic")
		TNT1 A 0 A_JumpIf(CheckClass("GCS_AcolyteGold"), 6)
		TNT1 A 0 A_JumpIf(CheckClass("GCS_AcolyteGrey"), 6)
		TNT1 A 0 A_JumpIf(CheckClass("GCS_AcolyteRust"), 6)
		TNT1 A 0 A_JumpIf(CheckClass("GCS_AcolyteOlive"), 6)
		TNT1 A 0 A_JumpIf(CheckClass("GCS_AcolyteRed"), 6)
		TNT1 A 0 A_JumpIf(CheckClass("GCS_AcolyteGreen"), 6)
		
		TNT1 A 0 A_SetTranslation("Acolyte_LonghornGold")
		Stop
		TNT1 A 0 A_SetTranslation("Acolyte_StruckerBlack")
		Stop
		TNT1 A 0 A_SetTranslation("Acolyte_StruckerRust")
		Stop
		TNT1 A 0 A_SetTranslation("Acolyte_StruckerOlive")
		Stop
		TNT1 A 0 A_SetTranslation("Acolyte_PulverizerRed")
		Stop
		TNT1 A 0 A_SetTranslation("Acolyte_PulverizerGreen")
		Stop
		
	 OA_ChanceOfWeapon:
		TNT1 A 0 A_Jump(GetCVar("GC_StrifeAcolyteRandomizeWeapon") * 32, 1)
		Stop
		TNT1 A 0 A_JumpIf(CheckClass("GCS_AcolyteGold"),6)
		TNT1 A 0 A_JumpIf(CheckClass("GCS_AcolyteGrey"),8)
		TNT1 A 0 A_JumpIf(CheckClass("GCS_AcolyteRust"),8)
		TNT1 A 0 A_JumpIf(CheckClass("GCS_AcolyteOlive"),8)
		TNT1 A 0 A_JumpIf(CheckClass("GCS_AcolyteRed"),8)
		TNT1 A 0 A_JumpIf(CheckClass("GCS_AcolyteGreen"),8)
		
		TNT1 A 0 A_Jump(256,1,2)
		
		TNT1 A 0 {
			A_SetTranslation("Acolyte_LonghornGold");
			A_GiveInventory("AcolyteLonghorn");
		}
		Stop
		TNT1 A 0 {
			A_SetTranslation("Acolyte_LonghornBlue");
			A_GiveInventory("AcolyteLonghorn");
		}
		Stop
		TNT1 A 0 {
			A_SetTranslation("Acolyte_StruckerBlack");
			A_GiveInventory("AcolyteStrucker");
		}
		Stop
		TNT1 A 0 {
			A_SetTranslation("Acolyte_StruckerRust");
			A_GiveInventory("AcolyteStrucker");
		}
		Stop
		TNT1 A 0 {
			A_SetTranslation("Acolyte_StruckerOlive");
			A_GiveInventory("AcolyteStrucker");
		}
		Stop
		TNT1 A 0 {
			A_SetTranslation("Acolyte_PulverizerRed");
			A_GiveInventory("AcolytePulverizer");
		}
		Stop
		TNT1 A 0 {
			A_SetTranslation("Acolyte_PulverizerGreen");
			A_GiveInventory("AcolytePulverizer");
		}
		Stop
	}
}

Actor Midas_Statue_Acolyte : Midas_Statue
{
	Tag "Acolyte Statue"
	States
	{
	Spawn:
		AGRD O 1
		Goto Super::Cycle
	Death:
	Crash:
		TNT1 A 0 A_SetUserVar("User_GoldRange",10)
		TNT1 A 0 A_SetUserVar("User_GoldAmount",6)
		TNT1 A 0 A_SetUserVar("User_GoldCounter1",8)
		TNT1 A 0 A_SetUserVar("User_GoldCounter2",0)
		Goto Super::DeathInit
	MidasReward:
		TNT1 A 0 A_JumpIf(GetCVar("GC_MoneyShare"),2)
		TNT1 A 0 A_GiveToTarget("Dosh",15)
		Stop
		TNT1 A 0 ACS_NamedExecuteAlways("MoneySharing",0,15)
		Stop
	}
}

Actor AcolyteGibbed
{
	Var int User_turd; // Dino waz here.
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			for(User_turd = 0; User_turd < 6 ; User_turd++) { A_SpawnItemEx("CeilBloodLauncherLong",0,0,0,velx+frandom(5.0,-5.0),vely+frandom(3.0,-3.0),velz+frandom(10.0,4.0),frandom(0.0,360.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR); }
			for(User_turd = 0; User_turd < 2 ; User_turd++) { A_SpawnItemEx("XDeath1",0,0,25,velx+frandom(5.0,-5.0),vely+frandom(3.0,-3.0),velz+frandom(10.0,4.0),frandom(0.0,360.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR);
															  A_SpawnItemEx("XDeath2",0,0,25,velx+frandom(5.0,-5.0),vely+frandom(3.0,-3.0),velz+frandom(10.0,4.0),frandom(0.0,360.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR);
															  A_SpawnItemEx("XDeath3",0,0,25,velx+frandom(5.0,-5.0),vely+frandom(3.0,-3.0),velz+frandom(10.0,4.0),frandom(0.0,360.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR); }
			for(User_turd = 0; User_turd < 1 ; User_turd++) { A_SpawnItemEx("XDeath4",0,0,25,velx+frandom(5.0,-5.0),vely+frandom(3.0,-3.0),velz+frandom(10.0,4.0),frandom(0.0,360.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR); }
			for(User_turd = 0; User_turd < 8 ; User_turd++) { A_SpawnItemEx("GC_WallBlood",0,0,33,velx+frandom(3.0,-3.0),vely+frandom(2.0,-2.0),velz+frandom(4.0,2.0),frandom(-5.0,5.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR); }
			for(User_turd = 0; User_turd < 2 ; User_turd++) { A_SpawnItemEx("Instestin",0,0,25,velx+frandom(5.0,-5.0),vely+frandom(3.0,-3.0),velz+frandom(10.0,4.0),frandom(0.0,360.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR); }
			for(User_turd = 0; User_turd < 24; User_turd++) { A_SpawnItemEx("GC_FlyingBlood",0,0,27,velx+frandom(5.0,-5.0),vely+frandom(3.0,-3.0),velz+frandom(10.0,4.0),frandom(0.0,360.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR); }
			for(User_turd = 0; User_turd < 6 ; User_turd++) { A_SpawnItemEx("GC_SuperGoreSpawner",0,0,25,velx+frandom(5.0,-5.0),vely+frandom(3.0,-3.0),velz+frandom(14.0,4.0),frandom(0.0,360.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR); }
		}
		Stop
	}
}

Actor Midas_Statue_Templar : Midas_Statue
{
	Tag "Templar Statue"
	States
	{
	Spawn:
		PGRD A 1
		Goto Super::Cycle
	Death:
	Crash:
		TNT1 A 0 A_SetUserVar("User_GoldRange",10)
		TNT1 A 0 A_SetUserVar("User_GoldAmount",6)
		TNT1 A 0 A_SetUserVar("User_GoldCounter1",8)
		TNT1 A 0 A_SetUserVar("User_GoldCounter2",0)
		Goto Super::DeathInit
	MidasReward:
		TNT1 A 0 A_JumpIf(GetCVar("GC_MoneyShare"),2)
		TNT1 A 0 A_GiveToTarget("Dosh",50)
		Stop
		TNT1 A 0 ACS_NamedExecuteAlways("MoneySharing",0,50)
		Stop
	}
}

Actor AcolyteGumpopGibbed
{
	Var int User_turd; // Dino waz here.
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			for(User_turd = 0; User_turd < 11; User_turd++) { A_SpawnItemEx("CeilBloodLauncherLong",0,0,0,velx+frandom(5.0,-5.0),vely+frandom(3.0,-3.0),velz+frandom(10.0,4.0),frandom(0.0,360.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR); }
			for(User_turd = 0; User_turd < 4 ; User_turd++) { A_SpawnItemEx("XDeath1",0,0,25,velx+frandom(5.0,-5.0),vely+frandom(3.0,-3.0),velz+frandom(10.0,4.0),frandom(0.0,360.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR);
															  A_SpawnItemEx("XDeath2",0,0,25,velx+frandom(5.0,-5.0),vely+frandom(3.0,-3.0),velz+frandom(10.0,4.0),frandom(0.0,360.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR);
															  A_SpawnItemEx("XDeath3",0,0,25,velx+frandom(5.0,-5.0),vely+frandom(3.0,-3.0),velz+frandom(10.0,4.0),frandom(0.0,360.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR); }
			for(User_turd = 0; User_turd < 3 ; User_turd++) { A_SpawnItemEx("XDeath4",0,0,25,velx+frandom(5.0,-5.0),vely+frandom(3.0,-3.0),velz+frandom(10.0,4.0),frandom(0.0,360.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR); }
			for(User_turd = 0; User_turd < 14; User_turd++) { A_SpawnItemEx("GC_WallBlood",0,0,33,velx+frandom(3.0,-3.0),vely+frandom(2.0,-2.0),velz+frandom(4.0,2.0),frandom(-5.0,5.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR); }
			for(User_turd = 0; User_turd < 4 ; User_turd++) { A_SpawnItemEx("Instestin",0,0,25,velx+frandom(5.0,-5.0),vely+frandom(3.0,-3.0),velz+frandom(10.0,4.0),frandom(0.0,360.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR); }
			for(User_turd = 0; User_turd < 32; User_turd++) { A_SpawnItemEx("GC_FlyingBlood",0,0,27,velx+frandom(5.0,-5.0),vely+frandom(3.0,-3.0),velz+frandom(10.0,4.0),frandom(0.0,360.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR); }
			for(User_turd = 0; User_turd < 10; User_turd++) { A_SpawnItemEx("GC_SuperGoreSpawner",0,0,25,velx+frandom(5.0,-5.0),vely+frandom(3.0,-3.0),velz+frandom(14.0,4.0),frandom(0.0,360.0),SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_USEBLOODCOLOR); }
		}
		stop
	}
}

// Bot Stuff //
// Since robots don't bleed, here's a modification to the junk they cast off at
// death so it spawns dosh when the 'LoadsOMoney' CVar is enabled.

Actor TemplarPuff : BulletPuff2
{
	States
	{
	Spawn:
		MPUF AB 5 BRIGHT
		POW1 ABCDE 4 BRIGHT
		Stop
	}
}

Actor GCS_Junk
{
	+NOCLIP
	var float user_scalex;
	var float user_scaley;
	States
	{
	Spawn:
		TNT1 A 0 NoDelay
		{
			A_SetUserVarFloat(user_scalex,1.0);
			A_SetUserVarFloat(user_scaley,1.0);
		}
	 ScaleSet:
		TNT1 A 0 A_SetScale(user_scalex,user_scaley)
		TNT1 A 0 A_JumpIf(GetCVar("GC_Loadsamoney"),"DOSH")
		TNT1 A 0 A_Jump(256,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
		JUNK A 0 A_Jump(256,"FrameSet")
		JUNK B 0 A_Jump(256,"FrameSet")
		JUNK C 0 A_Jump(256,"FrameSet")
		JUNK D 0 A_Jump(256,"FrameSet")
		JUNK E 0 A_Jump(256,"FrameSet")
		JUNK F 0 A_Jump(256,"FrameSet")
		JUNK G 0 A_Jump(256,"FrameSet")
		JUNK H 0 A_Jump(256,"FrameSet")
		JUNK I 0 A_Jump(256,"FrameSet")
		JUNK J 0 A_Jump(256,"FrameSet")
		JUNK K 0 A_Jump(256,"FrameSet")
		JUNK L 0 A_Jump(256,"FrameSet")
		JUNK M 0 A_Jump(256,"FrameSet")
		JUNK N 0 A_Jump(256,"FrameSet")
		JUNK O 0 A_Jump(256,"FrameSet")
		JUNK P 0 A_Jump(256,"FrameSet")
		JUNK Q 0 A_Jump(256,"FrameSet")
		JUNK R 0 A_Jump(256,"FrameSet")
		JUNK S 0 A_Jump(256,"FrameSet")
		JUNK T 0
	 FrameSet:
		"####" "#" 700
		Stop
	DOSH:
		TNT1 A 0 {
			A_SpawnItemEx("BloodDoshSpawner",frandom(-5,5),frandom(-5,5),frandom(5,10),frandom(4,8),0,frandom(4,8),random(1,360));
			A_SpawnItemEx("BloodDoshSpawner",frandom(-5,5),frandom(-5,5),frandom(5,10),frandom(4,8),0,frandom(4,8),random(1,360));}
		Stop
	}
}

Actor GCS_SmallJunk : GCS_Junk
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_SetUserVarFloat(user_scalex,frandom(0.4,0.6));
			A_SetUserVarFloat(user_scaley,frandom(0.4,0.6));
		}
		Goto Super::ScaleSet
	DOSH:
		TNT1 A 0 A_SpawnItemEx("BloodDoshSpawner",frandom(-5,5),frandom(-5,5),frandom(5,10),frandom(4,8),0,frandom(4,8),random(1,360))
		Stop
	}
}

Actor GCS_LargeJunk : GCS_Junk
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_SetUserVarFloat(user_scalex,frandom(0.4,0.6));
			A_SetUserVarFloat(user_scaley,frandom(1.4,1.6));
		}
		Goto Super::ScaleSet
	DOSH:
		TNT1 A 0 {
			A_SpawnItemEx("BloodDoshSpawner",frandom(-5,5),frandom(-5,5),frandom(5,10),frandom(4,8),0,frandom(4,8),random(1,360));
			A_SpawnItemEx("BloodDoshSpawner",frandom(-5,5),frandom(-5,5),frandom(5,10),frandom(4,8),0,frandom(4,8),random(1,360));
			A_SpawnItemEx("BloodDoshSpawner",frandom(-5,5),frandom(-5,5),frandom(5,10),frandom(4,8),0,frandom(4,8),random(1,360));}
		Stop
	}
}

Actor Midas_Statue_StrifeStalker : Midas_Statue
{
	Tag "Stalker Statue"
	States
	{
	Spawn:
		STLK L 1
		Goto Super::Cycle
	Death:
	Crash:
		TNT1 A 0 A_SetUserVar("User_GoldRange",10)
		TNT1 A 0 A_SetUserVar("User_GoldAmount",6)
		TNT1 A 0 A_SetUserVar("User_GoldCounter1",8)
		TNT1 A 0 A_SetUserVar("User_GoldCounter2",0)
		Goto Super::DeathInit
	MidasReward:
		TNT1 A 0 A_JumpIf(GetCVar("GC_MoneyShare"),2)
		TNT1 A 0 A_GiveToTarget("Dosh",5)
		Stop
		TNT1 A 0 ACS_NamedExecuteAlways("MoneySharing",0,5)
		Stop
	}
}
		
Actor Midas_Statue_Sentinel : Midas_Statue
{
	Tag "Sentinel Statue"
	States
	{
	Spawn:
		SEWR C 1
		Goto Super::Cycle
	Death:
	Crash:
		TNT1 A 0 A_SetUserVar("User_GoldRange",10)
		TNT1 A 0 A_SetUserVar("User_GoldAmount",6)
		TNT1 A 0 A_SetUserVar("User_GoldCounter1",8)
		TNT1 A 0 A_SetUserVar("User_GoldCounter2",0)
		Goto Super::DeathInit
	MidasReward:
		TNT1 A 0 A_JumpIf(GetCVar("GC_MoneyShare"),2)
		TNT1 A 0 A_GiveToTarget("Dosh",10)
		Stop
		TNT1 A 0 ACS_NamedExecuteAlways("MoneySharing",0,10)
		Stop
	}
}

Actor Midas_Statue_Reaver : Midas_Statue
{
	Tag "Reaver Statue"
	States
	{
	Spawn:
		ROB1 A 1
		Goto Super::Cycle
	Death:
	Crash:
		TNT1 A 0 A_SetUserVar("User_GoldRange",10)
		TNT1 A 0 A_SetUserVar("User_GoldAmount",6)
		TNT1 A 0 A_SetUserVar("User_GoldCounter1",8)
		TNT1 A 0 A_SetUserVar("User_GoldCounter2",0)
		Goto Super::DeathInit
	MidasReward:
		TNT1 A 0 A_JumpIf(GetCVar("GC_MoneyShare"),2)
		TNT1 A 0 A_GiveToTarget("Dosh",25)
		Stop
		TNT1 A 0 ACS_NamedExecuteAlways("MoneySharing",0,25)
		Stop
	}
}

Actor Midas_Statue_Crusader : Midas_Statue
{
	Tag "Crusader Statue"
	States
	{
	Spawn:
		ROB2 D 1
		Goto Super::Cycle
	Death:
	Crash:
		TNT1 A 0 A_SetUserVar("User_GoldRange",10)
		TNT1 A 0 A_SetUserVar("User_GoldAmount",6)
		TNT1 A 0 A_SetUserVar("User_GoldCounter1",8)
		TNT1 A 0 A_SetUserVar("User_GoldCounter2",0)
		Goto Super::DeathInit
	MidasReward:
		TNT1 A 0 A_JumpIf(GetCVar("GC_MoneyShare"),2)
		TNT1 A 0 A_GiveToTarget("Dosh",50)
		Stop
		TNT1 A 0 ACS_NamedExecuteAlways("MoneySharing",0,50)
		Stop
	}
}

Actor Midas_Statue_Inquisitor : Midas_Statue
{
	Tag "Inquisitor Statue"
	States
	{
	Spawn:
		ROB2 D 1
		Goto Super::Cycle
	Death:
	Crash:
		TNT1 A 0 A_SetUserVar("User_GoldRange",10)
		TNT1 A 0 A_SetUserVar("User_GoldAmount",6)
		TNT1 A 0 A_SetUserVar("User_GoldCounter1",8)
		TNT1 A 0 A_SetUserVar("User_GoldCounter2",0)
		Goto Super::DeathInit
	MidasReward:
		TNT1 A 0 A_JumpIf(GetCVar("GC_MoneyShare"),2)
		TNT1 A 0 A_GiveToTarget("Dosh",1000)
		Stop
		TNT1 A 0 ACS_NamedExecuteAlways("MoneySharing",0,1000)
		Stop
	}
}

// Boss Stuff //
Actor Midas_Statue_Programmer : Midas_Statue
{
	Tag "Techno Wazard gone Gold"
	States
	{
	Spawn:
		PRGR L 1
		Goto Super::Cycle
	Death:
	Crash:
		TNT1 A 0 A_SetUserVar("User_GoldRange",10)
		TNT1 A 0 A_SetUserVar("User_GoldAmount",6)
		TNT1 A 0 A_SetUserVar("User_GoldCounter1",8)
		TNT1 A 0 A_SetUserVar("User_GoldCounter2",0)
		Goto Super::DeathInit
	MidasReward:
		TNT1 A 0 A_JumpIf(GetCVar("GC_MoneyShare"),2)
		TNT1 A 0 A_GiveToTarget("Dosh",1000)
		Stop
		TNT1 A 0 ACS_NamedExecuteAlways("MoneySharing",0,1000)
		Stop
	}
}

Actor Midas_Statue_StrifeBishop : Midas_Statue
{
	Tag "Bishop Statue"
	States
	{
	Spawn:
		MLDR A 1
		Goto Super::Cycle
	Death:
	Crash:
		TNT1 A 0 A_SetUserVar("User_GoldRange",10)
		TNT1 A 0 A_SetUserVar("User_GoldAmount",6)
		TNT1 A 0 A_SetUserVar("User_GoldCounter1",8)
		TNT1 A 0 A_SetUserVar("User_GoldCounter2",0)
		Goto Super::DeathInit
	MidasReward:
		TNT1 A 0 A_JumpIf(GetCVar("GC_MoneyShare"),2)
		TNT1 A 0 A_GiveToTarget("Dosh",1500)
		Stop
		TNT1 A 0 ACS_NamedExecuteAlways("MoneySharing",0,1500)
		Stop
	}
}

Actor Midas_Statue_Loremaster : Midas_Statue
{
	Tag "Loremaster Statue"
	States
	{
	Spawn:
		PRST A 1
		Goto Super::Cycle
	Death:
	Crash:
		TNT1 A 0 A_SetUserVar("User_GoldRange",10)
		TNT1 A 0 A_SetUserVar("User_GoldAmount",6)
		TNT1 A 0 A_SetUserVar("User_GoldCounter1",8)
		TNT1 A 0 A_SetUserVar("User_GoldCounter2",0)
		Goto Super::DeathInit
	MidasReward:
		TNT1 A 0 A_JumpIf(GetCVar("GC_MoneyShare"),2)
		TNT1 A 0 A_GiveToTarget("Dosh",2000)
		Stop
		TNT1 A 0 ACS_NamedExecuteAlways("MoneySharing",0,2000)
		Stop
	}
}

// Used to make the wreckage cast off from some bosses respect the death type
// of the boss, so they can take the appropriate actions.

Actor BossCharredDeath : Inventory {}
Actor BossTiberiumDeath : Inventory {}
Actor BossBlueTiberiumDeath : Inventory {}

// Special bits of junk.

Actor GCS_InquisitorArm : InquisitorArm
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIfInventory("BossCharredDeath",1,"FireStuff",AAPTR_MASTER)
		TNT1 A 0 A_JumpIfInventory("BossTiberiumDeath",1,"TibStuff",AAPTR_MASTER)
		TNT1 A 0 A_JumpIfInventory("BossBlueTiberiumDeath",1,"BlueTibStuff",AAPTR_MASTER)
		Goto Set
	FireStuff:
		TNT1 A 0 ACS_NamedExecuteAlways("Extra Crispy")
		TNT1 A 0 A_SpawnItemEx("FlamingDeath",0,0,0,0,0,0,0,SXF_CLIENTSIDE|SXF_SETTARGET|SXF_ORIGINATOR)
		Goto Set
	TibStuff:
		TNT1 A 0 ACS_NamedExecuteAlways("Toxic Avenger")
		TNT1 A 0 A_SpawnItemEx("TiberiumDeath",0,0,0,0,0,0,0,SXF_CLIENTSIDE|SXF_SETTARGET|SXF_ORIGINATOR)
		Goto Set
	BlueTibStuff:
		TNT1 A 0 ACS_NamedExecuteAlways("Blue Oyster Cult")
		TNT1 A 0 A_SpawnItemEx("BlueTiberiumDeath",0,0,0,0,0,0,0,SXF_CLIENTSIDE|SXF_SETTARGET|SXF_ORIGINATOR)
	Set:
		RBB3 FG 5 Bright
		RBB3 H -1
		Stop
	}
}

Actor GCS_ProgrammerBase : ProgrammerBase
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIfInventory("BossCharredDeath",1,"FireStuff",AAPTR_MASTER)
		TNT1 A 0 A_JumpIfInventory("BossTiberiumDeath",1,"TibStuff",AAPTR_MASTER)
		TNT1 A 0 A_JumpIfInventory("BossBlueTiberiumDeath",1,"BlueTibStuff",AAPTR_MASTER)
		Goto Set
	FireStuff:
		TNT1 A 0 ACS_NamedExecuteAlways("Extra Crispy")
		TNT1 A 0 A_SpawnItemEx("FlamingDeath",0,0,0,0,0,0,0,SXF_CLIENTSIDE|SXF_SETTARGET|SXF_ORIGINATOR)
		Goto Set
	TibStuff:
		TNT1 A 0 ACS_NamedExecuteAlways("Toxic Avenger")
		TNT1 A 0 A_SpawnItemEx("TiberiumDeath",0,0,0,0,0,0,0,SXF_CLIENTSIDE|SXF_SETTARGET|SXF_ORIGINATOR)
		Goto Set
	BlueTibStuff:
		TNT1 A 0 ACS_NamedExecuteAlways("Blue Oyster Cult")
		TNT1 A 0 A_SpawnItemEx("BlueTiberiumDeath",0,0,0,0,0,0,0,SXF_CLIENTSIDE|SXF_SETTARGET|SXF_ORIGINATOR)
	Set:
		BASE A 5 Bright A_Explode(32,32,1,1)
		BASE BCD 5 Bright
		BASE EFG 5
		BASE H -1
		Stop
	}
}

// Used to make MAP03 redirect to MAP30 and MAP09 redirect to MAP10 after the 
// defeat of the Programmer.

Actor ProgrammerIsDead : Inventory {
	Inventory.Amount 1
	Inventory.MaxAmount 1
}

// Alien Spectres give these instead of Sigil pieces. Also given by the Programmer.

Actor SpectreReward : CustomInventory
{
	Inventory.PickupMessage ""
	Inventory.PickupSound ""
	+ALWAYSPICKUP
	States
	{
	Spawn:
		TNT1 A -1
		Stop
	Pickup:
		TNT1 A 0 {
			A_PlaySound("Spell/Buy",5);
			A_PlaySound("Chest/Illuminate",6);
			A_PlaySound("Tome/Pickup",7);
			A_Print("\c[GCSkyBlue]The power of Sigil lies in your hands.");
			A_QuakeEx(1,1,2,35,0,256,"none",QF_SCALEDOWN);
			A_SetBlend("",0.3,140);
			A_GiveInventory("SigilBringer",1);
			A_GiveInventory("HealthMaxer",200);
		}
		Stop
	}
}

// Entity Stuff //
// These replace the Sigil pieces,and are checked for in the STRFHELP ACS 
// script to make sure the door to the Entity's Lair opens,and that you get the 
// right mission logs & so forth.

Actor EntityKey : Inventory
{
	Inventory.Amount 1
	Inventory.MaxAmount 5
}