//======================
// Legendary Time Freeze
//======================

Actor LegTimeFreezeSphere : CustomInventory
{
  Inventory.PickupMessage "Legendary Time Freeze, master of time the world is yours!"
  Inventory.PickupSound "legtime/pickup"
  Inventory.UseSound "legtime/use"
  Inventory.Icon "INVLB0"
  Inventory.MaxAmount 1
  +FLOATBOB
  +INVBAR
  +COUNTITEM
  +NOTIMEFREEZE
  States
  {
  Spawn:
	TTIM ABCDE 10 Bright A_CustomMissile("LegendarySphereFlameSpawner",-20,0,random(0,-360),2,random(0,360)) 
	Loop	
  Use:
    TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(SCR_IS_TIMEFREEZE_ALLOWED, 0, 0) == 1, "TooSoon")
	TNT1 A 0 A_PlaySound("legtime/use")
    TNT1 A 0 A_GiveInventory("LegTimeFreezer")
	TNT1 A 0 A_SpawnItemEx("TimeFreezeSoundEffect")
	TNT1 A 0 ACS_Execute(SCR_TIMEFREEZE, 0, 11)
    Stop  	
  TooSoon:
	TNT1 A 0 ACS_Execute(SCR_TIMEFREEZE_TOOSOON, 0, 0)
	Fail
  }
}

Actor LegTimeFreezer : PowerTimeFreezer
{
    +NOTIMEFREEZE
    Powerup.Duration -11
    Powerup.Color GoldMap
}

Actor TimeFreezeSoundEffect
{
  +NOTIMEFREEZE
  States
  { 	
  Spawn:
  	TNT1 A 0
	TNT1 A 45 A_PlaySound("timefreeze/effect1",CHAN_AUTO|CHAN_NOPAUSE,1.0,FALSE,ATTN_NONE)  
	TNT1 A 245 A_PlaySound("timefreeze/effect2",CHAN_BODY|CHAN_NOPAUSE,1.0,FALSE,ATTN_NONE) 
	TNT1 A 1 A_StopSound(CHAN_BODY)  
	TNT1 A 1 A_PlaySound("timefreeze/effect3",CHAN_AUTO|CHAN_NOPAUSE,1.0,FALSE,ATTN_NONE)  
	Stop	
  }
}