/* Originally from Realm 667 pickups of the same names.  Created by Dreadopp,
 * who modified stock Doom 2 sprites.
 *
 * Modified (along with the large stock ammo) to drop a smaller
 * unit of ammo if the player can't carry all of it.
 */

// Note that all of these have to be CustomInventory because it's the only
// builtin type that can have a custom Pickup state
actor Anachrony_BulletKit : CustomInventory 12444
{
	//$Title Bullet Kit
	//$Category Ammunition
	game Doom
	inventory.pickupmessage "Picked up a bullet kit."
	states
	{
	Spawn:
		AMOK A -1
		stop
	Pickup:
		AMOK A 0 ACS_NamedExecuteWithResult("anachrony_give_ammo_with_change", 0, 30)
		stop
	}
}

actor Anachrony_ShellKit : CustomInventory 12333
{
	//$Title Shell Kit
	//$Category Ammunition
	game Doom
	inventory.pickupmessage "Picked up a shell kit."
	states
	{
	Spawn:
		SHLK A -1
		stop
	Pickup:
		SHLK A 0 ACS_NamedExecuteWithResult("anachrony_give_ammo_with_change", 1, 12)
		stop
	}
}

actor Anachrony_RocketPile : CustomInventory 12234
{
	//$Title Rocket Pile
	//$Category Ammunition
	game Doom
	inventory.pickupmessage "Picked up a pile of rockets."
	states
	{
	Spawn:
		RCKP A -1
		stop
	Pickup:
		RCKP A 0 ACS_NamedExecuteWithResult("anachrony_give_ammo_with_change", 2, 3)
		stop
	}
}

actor Anachrony_CellKit : CustomInventory 14212
{
	//$Title Cell Kit
	//$Category Ammunition
	game Doom
	inventory.pickupmessage "Picked up an energy cell kit."
	states
	{
	Spawn:
		CELK A -1
		stop
	Pickup:
		CELK A 0 ACS_NamedExecuteWithResult("anachrony_give_ammo_with_change", 3, 60)
		stop
	}
}

// Large ammo replacements
actor Anachrony_ClipBox : CustomInventory replaces ClipBox
{
	game Doom
	inventory.pickupmessage "$GOTCLIPBOX"
	states
	{
	Spawn:
		AMMO A -1
		stop
	Pickup:
		AMMO A 0 ACS_NamedExecuteWithResult("anachrony_give_ammo_with_change", 0, 50)
		stop
	}
}
actor Anachrony_ShellBox : CustomInventory replaces ShellBox
{
	game Doom
	inventory.pickupmessage "$GOTSHELLBOX"
	states
	{
	Spawn:
		SBOX A -1
		stop
	Pickup:
		SBOX A 0 ACS_NamedExecuteWithResult("anachrony_give_ammo_with_change", 1, 20)
		stop
	}
}
actor Anachrony_RocketBox : CustomInventory replaces RocketBox
{
	game Doom
	inventory.pickupmessage "$GOTROCKBOX"
	states
	{
	Spawn:
		BROK A -1
		stop
	Pickup:
		BROK A 0 ACS_NamedExecuteWithResult("anachrony_give_ammo_with_change", 2, 5)
		stop
	}
}
actor Anachrony_CellPack : CustomInventory replaces CellPack
{
	game Doom
	inventory.pickupmessage "$GOTCELLBOX"
	states
	{
	Spawn:
		CELP A -1
		stop
	Pickup:
		CELP A 0 ACS_NamedExecuteWithResult("anachrony_give_ammo_with_change", 3, 100)
		stop
	}
}


// Supply box, which gives a variety of ammo
// Also gives change, because why not?
// If you have max of everything, this has the hilarious effect of exploding a
// bunch of ammo everywhere
actor Anachrony_SupplyBox : CustomInventory 22015
{
	Inventory.PickupMessage "Picked up a supply box."
	Inventory.MaxAmount 0
	+COUNTITEM
	+INVENTORY.ALWAYSPICKUP
	Scale 0.75
	States
	{
	Spawn:
		SUPB A -1
		loop
	Pickup:
		TNT1 A 0 A_GiveInventory("SupplyBoxArmor", 2)
		TNT1 A 0 A_GiveInventory("SupplyBoxHealth", 1)
		TNT1 A 0 ACS_NamedExecuteWithResult("anachrony_give_ammo_with_change", 0, 40, true)
		TNT1 A 0 ACS_NamedExecuteWithResult("anachrony_give_ammo_with_change", 1, 10, true)
		TNT1 A 0 ACS_NamedExecuteWithResult("anachrony_give_ammo_with_change", 2, 2, true)
		TNT1 A 0 ACS_NamedExecuteWithResult("anachrony_give_ammo_with_change", 3, 30, true)
		stop
	}
}

Actor SupplyBoxArmor : BasicArmorBonus
{
	Inventory.PickupMessage ""
	Inventory.Icon "ARM1A0"
	Armor.SavePercent 33.33333
	Armor.SaveAmount 5
	Armor.MaxSaveAmount 200
	-COUNTITEM
}

Actor SupplyBoxHealth : Health
{
	-COUNTITEM
	Inventory.Amount 5
	Inventory.MaxAmount 200
	Inventory.PickupMessage ""
}
