ACTOR LegendarySalvationsphere : CustomInventory
{
  Inventory.PickupSound "Powerup/Salvation"
  Inventory.PickupMessage "Legendary Salvation Sphere! A guardian angel watches over you..."
  Inventory.Icon LSALZ0
  Inventory.Amount 1
  Inventory.MaxAmount 1
  Renderstyle Add
  Tag "Legendary Salvation Sphere - Automatically used when at critical health"
  +INVENTORY.BIGPOWERUP
  +INVENTORY.UNDROPPABLE
  +INVENTORY.INVBAR
  +FLOATBOB
  -FLOAT
  +NOTIMEFREEZE
  ActiveSound "LegSalvLoop"
  States
   {
  Spawn:
	TNT1 A 0
	//TNT1 A 0 A_LoopActiveSound
	TNT1 A 0 A_CustomMissile ("YellowSparkleSpawner", 0, 0, random(0,-360), 2, random(0,360))
    LSAL AAAAAABBBBBB 1 Bright A_SpawnItem("YellowSphereFlare",0,38)
	TNT1 A 0 A_CustomMissile ("YellowSparkleSpawner", 0, 0, random(0,-360), 2, random(0,360))
    LSAL CCCCCCDDDDDD 1 Bright A_SpawnItem("YellowSphereFlare",0,38)
	TNT1 A 0 A_CustomMissile ("YellowSparkleSpawner", 0, 0, random(0,-360), 2, random(0,360))
    LSAL CCCCCCBBBBBB 1 Bright A_SpawnItem("YellowSphereFlare",0,38)
    Goto Spawn+2
  Pickup:
	TNT1 A 0
	TNT1 A 0 A_JumpIfInventory("LegendarySalvationSphere",1,"Nope")
	TNT1 A 0 ACS_NamedExecute("LegendarySalvationSphere",0)
	TNT1 A 1 A_StopSound
	Stop
  Use:
	TNT1 A 0
	TNT1 A 0 A_Print("This item is automatically used at low health!")
	Fail
  Nope:
	TNT1 A 1
	Fail
   }
}

Actor LegendarySalvationSphereItem : CustomInventory
{
  +INVBAR
  +INVENTORY.UNDROPPABLE
  Inventory.Icon LSALZ0
  States
  {
  Use:
	TNT1 A 0
	TNT1 A 0 A_Print("This item is automatically used at low health!")
	Fail
  }
}





Actor LegendarySalvationSphereExplode
{
    Radius 1
    Height 1
    Scale 3.2
    PROJECTILE
    RENDERSTYLE ADD
    +EXTREMEDEATH
    +SPAWNSOUNDSOURCE
    +DONTREFLECT
    +PIERCEARMOR
    +FOILINVUL
    +NOTIMEFREEZE
	+FORCERADIUSDMG
	+DONTHARMSPECIES
	+DONTHURTSPECIES
    +BRIGHT
    ALPHA 0.8
	Species "Player"
	DamageType "Legendary"
	DamageType "Player"
    DeathSound "star/explode"
    States
    {
    Spawn:
    Death:
		TNT1 A 0
	    TNT1 AA 0 A_Explode(700,700,0)
	    TNT1 A 0 Radius_Quake(15,20,0,20,0)
		TNT1 A 0 A_PlaySound("weapons/dtech10kexplode")
	    TNT1 A 0 A_SpawnItemEx("BlueDTech10KShockwave", 0, 0, 15, 0, 0, 0, 0, 128)
        TNT1 A 20 A_SpawnItem("BlueDTBFGEx",0,-10)
		LRB1 E 3 Bright
        LRB1 FGHIJKLMNO 3 Bright
        Stop
    }
}