// Prosperity

ACTOR ProsperitySphereSpawnActor : CustomInventory 10081
{
	Tag "Prosperity Sphere"
	//$Category Powerups
	//$Sprite AMSPA0
	+NOBLOCKMAP
	+NOGRAVITY
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 1
	  TNT1 A 1 A_JumpIf(ACS_NamedExecuteWithResult("GunModifierSpawn") == 666,"Nothing")
	  TNT1 A 1 A_SpawnItemEx("ProsperitySphereSpawner")
	Nothing:
	  TNT1 A 1
	  TNT1 A -1
	  Stop
	}
}

ACTOR ProsperitySphereSpawner : RandomSpawner
{
	DropItem "ProsperitySphere"
}

ACTOR ProsperitySphere : CustomInventory
{
    +FLOAT
    +FLOATBOB
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	+COUNTITEM
	-INVENTORY.INVBAR
	Inventory.PickupMessage "Prosperity!"
	Inventory.PickupSound "misc/p_pkup"
	Inventory.PickupAnnouncerEntry "prosperity"
	Inventory.RespawnTics 2100
    Inventory.MaxAmount 0
	Tag "Prosperity Sphere"
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("SphereNoGravCheck") == true,"NoGrav")
	SpawnLoop:
	  AMSP ABCD 6 Bright
	  Loop
	NoGrav:
	  TNT1 A 0 A_ScaleVelocity(0)
	  TNT1 A 0 A_ChangeFlag(NOGRAVITY,true)
	  Goto SpawnLoop
	Pickup:
	  TNT1 A 0 A_JumpIfInventory("PowerRageInvulnerable",1,"NoProt")
	  TNT1 A 0 A_GiveInventory("PickupProtection")
    NoProt:
	  TNT1 A 0 A_Print("\n\n\n\n\n\nProsperity!\n\n\n\n200 Health, random Light Armor & full ammo!\nInfinite ammo for 10 seconds!",4)
	  TNT1 A 0 Healthing(200,200)
	  TNT1 A 0 A_GiveInventory("IDMPowerupTrail10")
	  TNT1 A 0 A_GiveInventory("ProsperityInfiniteAmmo")
	  TNT1 A 0 A_GiveInventory("IDMClip", 300)
	  TNT1 A 0 A_GiveInventory("IDMShell", 30)
	  TNT1 A 0 A_GiveInventory("IDMRocketAmmo", 30)
	  TNT1 A 0 A_GiveInventory("IDMCell", 200)
	  TNT1 A 0 A_Jump(256,"BulletArmor","FragArmor","TechArmor")
	  Stop
	BulletArmor:
	  TNT1 A 0 A_GiveInventory("BulletArmor")
	  Stop
	FragArmor:
	  TNT1 A 0 A_GiveInventory("FragArmor")
	  Stop
	TechArmor:
	  TNT1 A 0 A_GiveInventory("TechArmor")
	  Stop
	}
}

ACTOR PowerIDMInfiniteAmmo : PowerInfiniteAmmo
{
	Inventory.Icon "PROSSP1"
}

ACTOR ProsperityInfiniteAmmo : PowerupGiver
{
	Game Doom
	Powerup.Duration -10
	Powerup.Type "IDMInfiniteAmmo"
	Powerup.Color "Coral", 0.2
	Inventory.MaxAmount 0
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
}