Actor LegendaryInvulnerabilitySphere : CustomInventory 
{
  Inventory.PickupMessage "Legendary Invulnerability Sphere!"
  Inventory.PickupSound "legendarycrystal/take"
  Inventory.UseSound "Powerup/Unstable"
  Inventory.Icon "LVLNE0"
  Inventory.MaxAmount 1
  Tag "Legendary Invulnerability Sphere"
  Renderstyle Add
  +INVBAR
  +COUNTITEM
  +INVENTORY.BIGPOWERUP
  +NOTIMEFREEZE
  +FLOAT
  +FLOATBOB
  States
  {
  Spawn:
	TNT1 AA 0 Bright A_CustomMissile("YellowSparkleSpawner",0,0,random(0,-360),2,random(0,360))
	LVLN ABCD 2 Bright A_SpawnItemEx("InvulnSphereParticle",Random(-12,12),Random(-12,12),Random(30,50),Random(-2,2),Random(-2,2),Random(-2,2),Random(-20,20),128)
	Loop
  Use:
    TNT1 A 0
	TNT1 A 0 A_GiveInventory("LegendaryDoubleDamageGiver",1)	
	TNT1 A 0 A_GiveInventory("LegendaryInvuln",1)	
	TNT1 A 1 ACS_NamedExecuteAlways("LegendaryInvuln",0)
    Stop  
  }
}

Actor LegendaryInvulnerabilitySphereQuiet : LegendaryInvulnerabilitySphere
{
  -INVBAR
  -COUNTITEM
  +INVENTORY.ALWAYSPICKUP
  +INVENTORY.QUIET
  States
  {
  Pickup:
    TNT1 A 0
	TNT1 A 0 A_GiveInventory("DoubleDamageGiver2",1)	
	TNT1 A 0 A_GiveInventory("LegendaryInvuln",1)
	TNT1 A 1 ACS_NamedExecuteAlways("LegendaryInvuln",0)
    Stop  
	}
}

Actor InvulnSphereParticle : BFGTrailParticleGold
{
Scale 0.03
}

Actor LegendaryInvuln : PowerupGiver 
{
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
  Inventory.MaxAmount 0
  Powerup.Duration -35 // 60
  Powerup.Type "Invulnerable" 
  Powerup.Mode Reflective
  Powerup.Color GoldMap	 
}

ACTOR LegendaryDoubleDamageGiver : PowerupGiver
{
	 +INVENTORY.AUTOACTIVATE
	 +INVENTORY.ALWAYSPICKUP
	 Inventory.MaxAmount 0
	 Powerup.Duration -25 // 45
	 Powerup.Type "DoubleDamage"
}