//Magical effect
IfUsed
  tmpargument = 1	//RED
  SparkleIcon
  IfAmmoOut	//Dont if out of charges
    GetState
  Else		//Fake fire
    tmpargument = 2
    tmpx = selfx
    tmpy = selfy
    tmpdistance = selfz
    SpawnExactParticle
  IfTimeOut
    CostAmmo	//Cost 1 charge every 0.5 second
    tmpargument = 25
    SetTime
    IfAmmoOut	//Any charges left?
      GetState
    Else		//Real damaging fire
      tmpargument = 1
      tmpx = selfx
      tmpy = selfy
      tmpdistance = selfz
      SpawnExactParticle
Else
  UnsparkleIcon
  IfTimeOut
    IncreaseAmmo
    tmpargument = 22	//Time between each charge is reloaded
    SetTime

//--------------------------------------------------------------------------
// ZZ> This function makes an item fall to the floor when spawned
IfSpawned				//
  tmpargument = ACTIONJB		  //
  DoAction				  //
  KeepAction				  //
  MakeCrushValid

//--------------------------------------------------------------------------
//Spawn smoke if crushed
IfCrushed
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  tmpargument = 0
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  GoPoof
  tmpargument = 1
  SendMessageNear

//--------------------------------------------------------------------------
// Make it lie on floor
IfDropped				
  KeepAction				  

//--------------------------------------------------------------------------
// Tell them what they've won...
IfGrabbed				
  SetTargetToWhoeverIsHolding		  //
  IfTargetIsAPlayer			  //
    tmpargument = 0			  //
    SendMessageNear			  //

//--------------------------------------------------------------------------
// Make a sound
IfHitGround				
  tmpargument = 0			  
  tmpdistance = rand & 2047 + 8000	  
  PlaySound				  

//--------------------------------------------------------------------------
End					// All done
//--------------------------------------------------------------------------
