//Base
class GiverSharedDoom : CustomInventory
{
	Default
	{
		+INVENTORY.AUTOACTIVATE
		//+INVENTORY.COUNTINV
	}
}

//Bonuses
class BlackBonus : GC_ExtendingHealthBonus //replaces HealthBonus
{
	Default
	{
		Tag "\c[Black]Black Flame Sigil\c-";
		Radius 20;
		Height 16;
		Inventory.Amount 2;
		Inventory.MaxAmount 300;
		Inventory.PickupMessage "Obtained a black flame sigil.";
		Inventory.PickupSound "Bonus/Pickup";
		Scale 0.8;
		//+INVENTORY.COUNTITEM
		+INVENTORY.ALWAYSPICKUP
	}
	
	States
	{
	Spawn:
		BONB A -1 Bright;
		Stop;
	}
}

class PurpleBonus : BasicArmorBonus //replaces ArmorBonus
{
	Default
	{
		Tag "\c[GCPurple]Purple Scale Sigil\c-";
		Radius 20;
		Height 16;
		Inventory.PickupMessage "Obtained a purple scale sigil.";
		Inventory.PickupSound "Bonus/Pickup";
		Inventory.Icon "BONAA0";
		Armor.SavePercent 33.335;
		Armor.SaveAmount 2;
		Armor.MaxSaveAmount 400;
		Scale 0.8;
		//+INVENTORY.COUNTITEM
		+INVENTORY.ALWAYSPICKUP
	}
	
	States
	{
	Spawn:
		BONA A -1;
		Stop;
	}
}

class Soulsphere2 : GC_ExtendingHealthBonus
{
	Default
	{
		Tag "\c[LightBlue]Soulsphere\c-";
		Inventory.Amount 100;
		Inventory.MaxAmount 300;
		Inventory.PickupMessage "\c[LightBlue]Soulsphere!";
		Inventory.PickupSound "Soulsphere/Pickup";
		Renderstyle 'Add';
		+FLOATBOB
		+INVENTORY.ALWAYSPICKUP
	}
	
	int Fade;
	
	States
	{
	Spawn:
		SOUL AAAABBBBCCCCDDDDEEEEFFFFEEEEDDDDCCCCBBBB 1 Bright { 
			If(!(A_CheckSight("Null") || GetCVar("GC_PickupParticleChoker")))
			{
				if(Fade % 4 == 0)
				{
					A_SpawnItemEx("SoulFade",0,0,0,0,0,0,0,SXF_CLIENTSIDE,0);
					Fade = 0;
				}
				Fade++;
				A_SpawnItemEx("SoulsphereParticle",
					frandom(10.0,-10.0),frandom(10.0,-10.0),
					35+frandom(10.0,-10.0),frandom(0.6,-0.6),
					frandom(0.6,-0.6),frandom(1.2,0.4),
					frandom(0.0,360.0),SXF_CLIENTSIDE,64);
			}
		}
		Loop;
	}
}

class SoulFade : Actor
{
	Default
	{
		Renderstyle 'Add';
		+NOINTERACTION
		+NOTONAUTOMAP
	}
	
	States
	{
	Spawn:
		SOUL C 1 NoDelay {
			A_FadeOut(0.12);
			A_SetScale(Scale.X + 0.02);
		}
		Loop;
	}
}

class MediCaps : Stimpack
{
	Default
	{
		Tag "Medical Capsule";
	   inventory.pickupsound "Capsule/Pickup";
	   inventory.pickupmessage "Obtained a stimpack.";
	}
	
	States
	{
	Spawn:
		STIM A 1 NoDelay {
			If(!(A_CheckSight("Null") || GetCVar("GC_PickupParticleChoker")))
			{
				A_SpawnItemEx("RedParticle",
				frandom(3.0,-3.0),frandom(3.0,-3.0),7+frandom(10.0,0.0),
				frandom(0.2,-0.2),frandom(0.2,-0.2),frandom(1.6,0.4),
				frandom(0.0,360.0),SXF_CLIENTSIDE,128);
			}
		}
		Loop;
   }
}

class MediPod : Medikit
{
	Default
	{
		Tag "Medical Pod";
		Inventory.PickupSound "Capsule/Pickup";
		Inventory.PickupMessage "Obtained a medpack.";
		Health.LowMessage 25, "That was a life-saving medpack!";
		Scale 0.9;
	}
	
   States
   {
   Spawn:
		MEDI A 1 NoDelay {
			If(!(A_CheckSight("Null") || GetCVar("GC_PickupParticleChoker")))
			{
				A_SpawnItemEx("RedParticle",
					frandom(5.0,-5.0),frandom(5.0,-5.0),15+frandom(25.0,0.0),
					frandom(0.2,-0.2),frandom(0.2,-0.2),frandom(1.6,0.4),
					frandom(0.0,360.0),SXF_CLIENTSIDE,64);
			}
		}
		Loop;
   } 
}

class RejuvCapsGiver : GiverSharedDoom
{
	Default
	{
		Tag "Rejuvenation Capsule";
		Inventory.PickupSound "Capsule/Pickup";
		Inventory.PickupMessage "Obtained a rejuvenation capsule.";
		Inventory.MaxAmount 0;
		+INVENTORY.AUTOACTIVATE
	}
	
	States
	{
	Spawn:
		MPOD C 1 NoDelay {
			If(!(A_CheckSight("Null") || GetCVar("GC_PickupParticleChoker")))
			{
				A_SpawnItemEx("YellowParticle",
					frandom(3.0,-3.0),frandom(3.0,-3.0),7+frandom(10.0,0.0),
					frandom(0.2,-0.2),frandom(0.2,-0.2),frandom(1.6,0.4),
					frandom(0.0,360.0),SXF_CLIENTSIDE,128);
			}
		}
		Loop;
	Pickup:
		TNT1 A 0 A_JumpIf(GetCVar("GC_AutoUse") == 2, "BringIt");
		TNT1 A 0 A_JumpIf(CountInv("RejuvCaps") >= GetDefaultByType("RejuvCaps").MaxAmount && GetCVar("GC_AutoUse") == 1, "BringIt");
		TNT1 A 0 A_GiveInventory("RejuvCaps",1);
		Stop;
	BringIt:
		TNT1 A 0 {
			If(Health < PlayerPawn(self).MaxHealth ||
			   CountInv("Mana") < FindInventory("Mana").MaxAmount)
			{
				A_PlaySound("Capsule/Use",3);
				let RejuvManager = RejuvenationManager(FindInventory("RejuvenationManager"));
				if(RejuvManager)
				{
					RejuvManager.NewTimer();
				}
				else
				{
					let RejuvManager = RejuvenationManager(GiveInventoryType("RejuvenationManager"));
					RejuvManager.NewTimer();
				}
				Return true;
			}
			else If(GetCVar("GC_AutoUse") == 2 && CountInv("RejuvCaps") < GetDefaultByType("RejuvCaps").MaxAmount) {
				A_GiveInventory("RejuvCaps",1);
				Return true;
			}
			else { Return false; }
		}
		Stop;
	}
}

class RejuvCaps : CustomInventory
{
	Default
	{
		Tag "Rejuvenation Capsule";
		Inventory.Amount 1;
		Inventory.MaxAmount 10;
		Inventory.InterHubAmount 10;
		Inventory.Icon 'ARTIMPOD';
		Inventory.PickupSound "Capsule/Pickup";
		Inventory.UseSound "Capsule/Use";
		Inventory.PickupMessage "Obtained a rejuvenation capsule.";
		+INVENTORY.INVBAR
	}
	
	States
	{
	Spawn:
		MPOD C 1 NoDelay {
			If(!(A_CheckSight("Null") || GetCVar("GC_PickupParticleChoker")))
			{
				A_SpawnItemEx("YellowParticle",
					frandom(3.0,-3.0),frandom(3.0,-3.0),7+frandom(10.0,0.0),
					frandom(0.2,-0.2),frandom(0.2,-0.2),frandom(1.6,0.4),
					frandom(0.0,360.0),SXF_CLIENTSIDE,128);
			}
		}
		Loop;
	Use:
		TNT1 A 0 {
			If(invoker.owner.Health < PlayerPawn(invoker.owner).MaxHealth ||
			   invoker.owner.CountInv("Mana") < invoker.owner.FindInventory("Mana").MaxAmount)
			{
				A_PlaySound("Capsule/Use",3);
				let RejuvManager = RejuvenationManager(invoker.owner.FindInventory("RejuvenationManager"));
				if(RejuvManager)
				{
					RejuvManager.NewTimer();
				}
				else
				{
					let RejuvManager = RejuvenationManager(invoker.owner.GiveInventoryType("RejuvenationManager"));
					RejuvManager.NewTimer();
				}
				Return true;
			}
			else { Return false; }
		}
		Stop;
	}
}

class GunzerkGiver : GiverSharedDoom
{
	Default
	{
		Tag "\c[gcpurple]Gunzerker Pack";
		Inventory.PickupMessage "You've got the \c[gcpurple]Gunzerker Pack\c-!";
		Inventory.PickupSound "Gunzerk/Pickup";
		Scale 0.9;
	}
	
	States
	{
	Spawn:
		PSTR A 1 NoDelay {
			If(!(A_CheckSight("Null") || GetCVar("GC_PickupParticleChoker")))
			{
				A_SpawnItemEx("PurpleParticle",
					frandom(5.0,-5.0),frandom(5.0,-5.0),15+frandom(25.0,0.0),
					frandom(0.2,-0.2),frandom(0.2,-0.2),frandom(1.6,0.4),
					frandom(0.0,360.0),SXF_CLIENTSIDE,64);
			}
		}
		Loop;
	Pickup:
		TNT1 A 0 A_JumpIf(GetCVar("GC_AutoUse") == 2, "BringIt");
		TNT1 A 0 A_JumpIf(CountInv("Gunzerk") >= GetDefaultByType("Gunzerk").MaxAmount && !GetCvar("sv_unlimited_pickup"), "Nope");
		TNT1 A 0 A_GiveInventory("Gunzerk",1);
		Stop;
	BringIt:
		TNT1 A 0 {
			A_PlaySound("Gunzerk/Use",3);
			A_GiveInventory("PowerGunzerkingResist");
			A_GiveInventory("GunzerkingGiver");
			//ACS_NamedExecute("GC Ammo Regen");	
			A_GiveInventory("GunzerkExtender",1);
			A_SetBlend("Purple",0.2,35);
			HealThing(200, 0);
		}
		Stop;
	Nope:
		TNT1 A 0 A_JumpIf(GetCVar("GC_AutoUse") == 1,"BringIt");
		Fail;
	}
}

class Gunzerk : CustomInventory
{
	Default
	{
		Tag "\c[gcpurple]Gunzerker pack";
		Inventory.Icon 'ARTIPSTR';
		Inventory.PickupMessage "You've got the \c[gcpurple]Gunzerker Pack\c-!";
		Inventory.Amount 1;
		Inventory.MaxAmount 5;
		Inventory.InterHubAmount 0x7FFFFFFF;
		Inventory.PickupSound "Gunzerk/Pickup";
		Inventory.UseSound "Gunzerk/Use";
		Tag "Gunzerker Pack";
		Scale 0.9;
		+INVENTORY.INVBAR
		+COUNTITEM
	}
	
	States
	{
	Spawn:
		PSTR A 1 NoDelay {
			If(!(A_CheckSight("Null") || GetCVar("GC_PickupParticleChoker")))
			{
				A_SpawnItemEx("PurpleParticle",
					frandom(5.0,-5.0),frandom(5.0,-5.0),15+frandom(25.0,0.0),
					frandom(0.2,-0.2),frandom(0.2,-0.2),frandom(1.6,0.4),
					frandom(0.0,360.0),SXF_CLIENTSIDE,64);
			}
		}
		Loop;
	Use:
		TNT1 A 0 {
			A_GiveInventory("PowerGunzerkingResist");
			A_GiveInventory("GunzerkingGiver");
			//ACS_NamedExecute("GC Ammo Regen");
			A_GiveInventory("GunzerkExtender",1);
			A_SetBlend("Purple",0.2,35);
			HealThing(200, 0);
		}
		Stop;
	}
}

class Berserk2Giver : GiverSharedDoom
{
	Default
	{
		Tag "\c[gcfury]Berserker Pack";
		Inventory.PickupMessage "You've got the \c[gcfury]Berserker Pack\c-!";
		Inventory.PickupSound "Berserk/Pickup";
		Scale 0.9;
	}
	States
	{
	Spawn:
		BERZ A 1 NoDelay {
			If(!(A_CheckSight("Null") || GetCVar("GC_PickupParticleChoker")))
			{
				A_SpawnItemEx("ZerkParticle",
					frandom(5.0,-5.0),frandom(5.0,-5.0),15+frandom(25.0,0.0),
					frandom(0.2,-0.2),frandom(0.2,-0.2),frandom(1.6,0.4),
					frandom(0.0,360.0),SXF_CLIENTSIDE,64);
			}
		}
		Loop;
	Pickup:
		TNT1 A 0 A_JumpIf(GetCVar("GC_AutoUse") == 2, "BringIt");
		TNT1 A 0 A_JumpIf(CountInv("Berserk2") >= GetDefaultByType("Berserk2").MaxAmount && !GetCvar("sv_unlimited_pickup"), "Nope");
		TNT1 A 0 A_GiveInventory("Berserk2",1);
		Stop;
	BringIt:
		TNT1 A 0 {
			A_PlaySound("Berserk/Use",3);
			A_GiveInventory("PowerJumping",1);
			A_GiveInventory("PowerSpeeding",1);
			A_GiveInventory("PowerBerserkingResist",1);
			A_GiveInventory("PowerBerserking",1);
			A_GiveInventory("BerserkExtender",1);
			A_GiveInventory("PowerAfterBerserking",1);
			A_SetBlend("Red",0.2,35);
			HealThing(200, 0);
		}
		Stop;
	Nope:
		TNT1 A 0 A_JumpIf(GetCVar("GC_AutoUse") == 1,"BringIt");
		Fail;
	}
}

class Berserk2 : CustomInventory
{
	Default
	{
		Tag "\c[gcfury]Berserker pack";
		Inventory.Icon 'ARTIBERZ';
		Inventory.PickupMessage "You've got the \c[gcfury]Berserker Pack\c-!";
		Inventory.Amount 1;
		Inventory.MaxAmount 5;
		Inventory.InterHubAmount 0x7FFFFFFF;
		Inventory.PickupSound "Berserk/Pickup";
		Inventory.UseSound "Berserk/Use";
		Tag "Berserker Pack";
		Scale 0.9;
		+INVENTORY.INVBAR
	}
	
	States
	{
	Spawn:
		BERZ A 1 NoDelay {
			If(!(A_CheckSight("Null") || GetCVar("GC_PickupParticleChoker")))
			{
				A_SpawnItemEx("ZerkParticle",
					frandom(5.0,-5.0),frandom(5.0,-5.0),15+frandom(25.0,0.0),
					frandom(0.2,-0.2),frandom(0.2,-0.2),frandom(1.6,0.4),
					frandom(0.0,360.0),SXF_CLIENTSIDE,64);
			}
		}
		Loop;
	Use:
		TNT1 A 0 {
			A_GiveInventory("PowerJumping",1);
			A_GiveInventory("PowerSpeeding",1);
			A_GiveInventory("PowerBerserkingResist",1);
			A_GiveInventory("PowerBerserking",1);
			A_GiveInventory("BerserkExtender",1);
			A_GiveInventory("PowerAfterBerserking",1);
			A_SetBlend("Red",0.2,35);
			HealThing(200, 0);
		}
		Stop;
	}
}

class AmplifierGiver : GiverSharedDoom
{
	Default
	{
		Tag "\c[purple]Ancient Amplifier";
		Inventory.PickupSound "Amplifier/Pickup";
		Inventory.PickupMessage "You've got an \c[purple]Ancient Amplifier\c-!";
		+FLOATBOB
	}
	States
	{
	Spawn:
		AMPF AAAABBBBCCCCDDDDEEEE 1 Bright {
			If(!(A_CheckSight("Null") || GetCVar("GC_PickupParticleChoker")))
			{
				A_SpawnItemEx("AmplifierSpark",
					frandom(3.0,-3.0),frandom(3.0,-3.0),21+frandom(23.0,0.0),
					frandom(0.05,-0.05),frandom(0.05,-0.05),frandom(0.05,-0.05),
					frandom(0.0,360.0),SXF_CLIENTSIDE,64);
			}
		}
		Loop;
	Pickup:
		TNT1 A 0 A_JumpIf(GetCVar("GC_AutoUse") == 2, "BringIt");
		TNT1 A 0 A_JumpIf(CountInv("Amplifier") >= GetDefaultByType("Amplifier").MaxAmount && !GetCvar("sv_unlimited_pickup"), "Nope");
		TNT1 A 0 A_GiveInventory("Amplifier",1);
		Stop;
	BringIt:
		TNT1 A 0 {
			A_PlaySound("Amplifier/Use",3);
			A_GiveInventory("Amplify",1);
			A_GiveInventory("AmplifierExtender",1);
			A_SetBlend("Purple",0.2,35);
		}
		Stop;
	Nope:
		TNT1 A 0 A_JumpIf(GetCVar("GC_AutoUse") == 1,"BringIt");
		Fail;
	}
}

class Amplifier : CustomInventory
{
	Default
	{
		Tag "Ancient Amplifier";
		Inventory.Icon 'ARTIAMPF';
		Inventory.Amount 1;
		Inventory.MaxAmount 5;
		Inventory.InterHubAmount 0x7FFFFFFF;
		Inventory.PickupSound "Amplifier/Pickup";
		Inventory.UseSound "Amplifier/Use";
		Inventory.PickupMessage "You've got an \c[purple]Ancient Amplifier\c-!";
		+INVENTORY.INVBAR
		+COUNTITEM
		+FLOATBOB
	}
	
	States
	{
	Spawn:
		AMPF AAAABBBBCCCCDDDDEEEE 1 Bright {
			If(!(A_CheckSight("Null") || GetCVar("GC_PickupParticleChoker")))
			{
				A_SpawnItemEx("AmplifierSpark",
					frandom(3.0,-3.0),frandom(3.0,-3.0),21+frandom(23.0,0.0),
					frandom(0.05,-0.05),frandom(0.05,-0.05),frandom(0.05,-0.05),
					frandom(0.0,360.0),SXF_CLIENTSIDE,64);
			}
		}
		Loop;
	Use:
		TNT1 A 0 {
			A_PlaySound("Amplifier/Use",3);
			A_GiveInventory("Amplify",1);
			A_GiveInventory("AmplifierExtender",1);
			A_SetBlend("Purple",0.2,35);
		}
		Stop;
	}
}

//Allmap
class Fullmap : Allmap //replaces Allmap
{
	Default
	{
		Tag "Map PDA";
		Inventory.MaxAmount 0;
		Inventory.PickupSound "Fullmap/Pickup";
		Inventory.PickupMessage "Got a \c[cyan]PDA chock-full of vertices\c-!";
	}
	
	States
	{
	Spawn:
		PMAP ABCDCB 5;
		Loop;
	}
}