// Haste

ACTOR HasteSphereSpawnActor : CustomInventory 10079
{
	Tag "Haste Sphere"
	//$Category Powerups
	//$Sprite HASTA0
	+NOBLOCKMAP
	+NOGRAVITY
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 1
	  TNT1 A 1 A_JumpIf(ACS_NamedExecuteWithResult("GunModifierSpawn") == 666,"Nothing")
	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("DuelSpawn") == true,"Duel")
	  TNT1 A 1 A_SpawnItemEx("HasteSphereSpawner")
	Nothing:
	  TNT1 A 1
	  TNT1 A -1
	  Stop
	Duel:
	  TNT1 A 1 A_SpawnItemEx("DuelHasteSphereSpawner")
	  TNT1 A 1
	  TNT1 A -1
	  Stop
	}
}

ACTOR HasteSphereSpawner : RandomSpawner
{
	DropItem "HasteSphere"
}

ACTOR DuelHasteSphereSpawner : RandomSpawner
{
	DropItem "DuelHasteSphere"
}

ACTOR HasteSphere : CustomInventory
{
    +FLOAT
    +FLOATBOB
	+COUNTITEM
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
    Inventory.PickupSound "misc/p_pkup"
	Inventory.Pickupmessage "Haste!"
	Inventory.PickupAnnouncerEntry "haste"
	Inventory.RespawnTics 2100
    Inventory.MaxAmount 0
	Tag "Haste Sphere"
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("SphereNoGravCheck") == true,"NoGrav")
	SpawnLoop:
	  HAST A 15 Bright
	  HAST BCB 10 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\n\nHaste!\n\n\n\n200 Health!\n2x firing speed!\n1.25x movement speed!",4)
	  TNT1 A 0 Healthing(200,200)
	  TNT1 A 0 A_GiveInventory("HasteSphereSpeed")
	  TNT1 A 0 A_GiveInventory("HasteSphereDoubleFire")
	  Stop
	}
}

ACTOR DuelHasteSphere : HasteSphere
{
	States
	{
	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\nHaste!\n\n\n\n2x firing speed!\n1.25x movement speed!",4)
	  TNT1 A 0 A_GiveInventory("DuelHasteSphereSpeed")
	  TNT1 A 0 A_GiveInventory("DuelHasteSphereDoubleFire")
	  Stop
	}
}

ACTOR PowerIDMSpeed : PowerSpeed
{
	Inventory.Icon "HASTSP1"
	Speed 1.25
}

ACTOR HasteSphereSpeed : PowerupGiver
{
	Inventory.maxamount 0
	Powerup.Type "IDMSpeed"
	Powerup.Duration -30
	Powerup.Colormap 1.0,0.8,0.15
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
}

ACTOR DuelHasteSphereSpeed : HasteSphereSpeed
{
	Powerup.Duration -15
}

ACTOR HasteSphereDoubleFire : PowerupGiver
{
	Inventory.maxamount 0
	Powerup.Type DoubleFiringSpeed
	Powerup.Duration -30
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
}

ACTOR DuelHasteSphereDoubleFire : HasteSphereDoubleFire
{
	Powerup.Duration -15
}

ACTOR HasteSphereHighJump : PowerupGiver
{
	Inventory.maxamount 0
	Powerup.Type HighJump
	Powerup.Duration -30
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
}