actor SoulsphereSpawner : RandomSpawner replaces Soulsphere
{
    DropItem "SupremeHp" 255 3
    DropItem "SalvationPickup" 255 1
}

/*
CREDITS:
Health pickup sounds - ID (Quake 4)
*/

ACTOR SupremeHp : Health
{
   Inventory.PickupSound "misc/supremehp"
   Inventory.PickupMessage "Picked up a supreme health!"
   Inventory.Amount 2000
   Inventory.MaxAmount 999999
   Renderstyle Add
   +FLOAT
   +FLOATBOB
   +INVENTORY.ALWAYSPICKUP
   +INVENTORY.FANCYPICKUPSOUND
   -COUNTITEM
   Scale 1
   States
   {
   Spawn:
    MED4 A 1 A_SpawnItemEx("SupremeHpFX", random(1.5,-1.5), random(1.5,-1.5), 25+random(1.5,-1.5), 0, 0, 0.1*random(6,12), 0, 128, 0)
    Loop
   }
}

ACTOR SupremeHpFX
{
   Renderstyle Add
   Alpha 0.4
   Scale 1
   //+FLOAT
   +NOGRAVITY
   //+FLOATBOB
   +NOINTERACTION
   +CLIENTSIDEONLY
   States
   {
   Spawn:
    MED4 B 1 A_FadeOut(0.05)
    Loop
   }
}

/*
CREDITS:
Idea - DoomedArchvileDemon
Sound - Blizzard (Diablo II)
Pickup - Captain Toenail
*/

actor SalvationPickup : CustomInventory
{
  Inventory.PickupMessage "Salvationsphere!"
  Inventory.Amount 1
  Inventory.MaxAmount 0
  Inventory.PickupSound "Items/SalvationPick"
  Renderstyle Add
  +INVENTORY.ALWAYSPICKUP
  +INVENTORY.FANCYPICKUPSOUND
  +INVBAR
  +FLOATBOB
  +INFLOAT
  states
  {
  Spawn:
	SALV ABCDE 3 Bright
	loop
  Pickup:
	TNT1 A 0 A_JumpIfInventory("SalvationSphere",1,"Pickup2")
	TNT1 A 0 A_GiveInventory("SalvationSphere",1)
	stop
  Pickup2:
	TNT1 A 0 A_GiveInventory("SalvationHealth",1)
	TNT1 A 0 A_GiveInventory("SalvationActive",1)
	stop
  }
}

actor Salvationsphere : CustomInventory
{
  Inventory.PickupMessage "Salvationsphere!"
  Inventory.Amount 1
  Inventory.MaxAmount 1
  Inventory.PickupSound "Items/SalvationPick"
  Inventory.Icon ARTISALV
  Renderstyle Add
  +INVENTORY.FANCYPICKUPSOUND
  +INVBAR
  +FLOATBOB
  +INFLOAT
  states
  {
  Spawn:
	SALV ABCDE 3 Bright
	loop
  Use:
    TNT1 A 0 A_SetBlend("Blue",0.1,30)
    TNT1 A 0 A_PlaySoundEx("Items/SalvationMode","Item")
   	TNT1 A 0 A_JumpIfInventory("SalvationActive",1,"Use2")

	TNT1 A 0 A_GiveInventory("SalvationActive")
	TNT1 A 1 A_Print("Salvationsphere activated.")
	Fail
  Use2:
 	TNT1 A 0 A_TakeInventory("SalvationActive")
	TNT1 A 1 A_Print("Salvationsphere deactivated.")
	Fail
  }
}

actor Salvate : ArtiTeleport
{
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
}

actor SalvationActive : Inventory
{
  Inventory.MaxAmount 1
}

actor SalvationHealth : HealthBonus
{
  Inventory.Amount 1000
  Inventory.MaxAmount 999999
}
