// MegaSphere

ACTOR MegaSphereSpawnActor : CustomInventory 10072
{
	Tag "Megasphere (Insanity)"
	//$Category Powerups
	//$Sprite MEGAA0
	+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("MegasphereSpawner")
	Nothing:
	  TNT1 A 1
	  TNT1 A -1
	  Stop
	}
}

ACTOR MegasphereSpawner : RandomSpawner
{
	DropItem "IDMMegasphere"
}

ACTOR IDMMegasphere : CustomInventory
{
  +FLOAT
  +FLOATBOB
  +COUNTITEM
  +INVENTORY.ALWAYSPICKUP
  Inventory.PickupMessage "Megasphere!"
  Inventory.PickupSound "misc/p_pkup"
  Inventory.PickupAnnouncerEntry "megasphere"
  Inventory.RespawnTics 2100
  Tag "Megasphere"
  States
  {
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("SphereNoGravCheck") == true,"NoGrav")
  SpawnLoop:
    MEGA 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_Print("\n\n\n\n\nMegasphere!\n\n\n\n300 Health & random Heavy Armor!")
	TNT1 A 0 A_GiveInventory("SoulSphereHealth")
 	TNT1 A 0 A_Jump(256,"BlueArmor", "RedArmor", "PurpleArmor")
	Stop
  BlueArmor:
	TNT1 A 0 A_GiveInventory("IDMBlueArmor")
	Stop
  RedArmor:
	TNT1 A 0 A_GiveInventory("IDMRedArmor")
	Stop
  PurpleArmor:
	TNT1 A 0 A_GiveInventory("PurpleArmor")
    Stop
  }
}