// Regeneration

ACTOR RegenSphereSpawnActor : CustomInventory 10078
{
	Tag "Regeneration Sphere"
	//$Category Powerups
	//$Sprite REGNA0
	+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("RegenSphereSpawner")
	Nothing:
	  TNT1 A 1
	  TNT1 A -1
	  Stop
	}
}

ACTOR RegenSphereSpawner : RandomSpawner
{
	DropItem "RegenSphere"
}

ACTOR RegenSphere : CustomInventory
{
    +FLOAT
    +FLOATBOB
	+COUNTITEM
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
    Inventory.PickupSound "misc/p_pkup"
	Inventory.Pickupmessage "Regeneration!"
	Inventory.PickupAnnouncerEntry "regeneration"
	Inventory.RespawnTics 2100
    Inventory.MaxAmount 0
	Tag "Regeneration Sphere"
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("SphereNoGravCheck") == true,"NoGrav")
	SpawnLoop:
	  REGN 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\nRegeneration!\n\n\n\n100 health regen per second!")
	  TNT1 A 0 A_GiveInventory("RegenSphereRegeneration")
	  TNT1 A 0 A_GiveInventory("StrengthPowerupTrail")
	  Stop
	}
}

ACTOR PowerIDMRegeneration : PowerRegeneration
{
	Inventory.Icon "REGNSP1"
}

ACTOR RegenSphereRegeneration : PowerupGiver
{
	Inventory.maxamount 0
	Powerup.Type "IDMRegeneration"
	Powerup.Duration -30
	Powerup.Strength 100
	Powerup.Color "Purple", 0.1
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
}