// DoomSphere

ACTOR DoomSphereSpawnActor : CustomInventory 10075
{
	Tag "Doomsphere (Insanity)"
	//$Category Powerups
	//$Sprite DOOMA0
	+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("DoomSphereSpawner")
	Nothing:
	  TNT1 A 1
	  TNT1 A -1
	  Stop
	}
}

ACTOR DoomSphereSpawner : RandomSpawner
{
	DropItem "IDMDoomsphere"
}

ACTOR IDMDoomSphere : CustomInventory
{
	+FLOAT
	+FLOATBOB
	+COUNTITEM
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
	Inventory.PickupSound "misc/quad_pkup"
	Inventory.MaxAmount 0
	Inventory.PickupMessage "DOOMSPHERE!"
	Inventory.PickupAnnouncerEntry "doomsphere"
	Inventory.RespawnTics 2100
	Tag "Doomsphere"
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("SphereNoGravCheck") == true,"NoGrav")
	SpawnLoop:
	  DOOM A 10 Bright
	  DOOM B 15 Bright
	  DOOM C 8 Bright
	  DOOM D 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\n\nDOOMSPHERE!\n\n\n\n200 Health!\n4x Damage!")
	  TNT1 A 0 Healthing(200,200)
	  TNT1 A 0 A_GiveInventory("DoomSphereQuadDamage")
	  TNT1 A 0 A_GiveInventory("DoomsphereIcon")
	  Stop
	}
}

ACTOR DoomSphereIcon : Powerup
{
	Inventory.Icon "DOOMSP1"
	Powerup.Duration -20
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
}

ACTOR DoomSphereShortIcon : DoomSphereIcon
{
	Powerup.Duration -10
}

ACTOR DoomSphereQuadDamage : PowerupGiver
{
	Powerup.Type "QuadDamage"
	Inventory.MaxAmount 0
	Powerup.Color RedMap
	Powerup.Duration -20
	Inventory.PickupMessage ""
	Inventory.PickupSound ""
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
}