// Set up general stuff
IfSpawned
  tmpargument = ACTIONJB
  DoAction
  KeepAction
  MakeCrushValid
  MakeAmmoKnown



// Make it poof
IfCrushed
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  tmpargument = 0
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  GoPoof
  tmpargument = 1
  SendMessageNear



// Make it lie on the floor
IfDropped
  KeepAction



// Play a clink or clang
IfHitGround
  tmpargument = 0
  PlaySound


// Alert others to draw
IfTakenOut
  SetTargetToWhoeverIsHolding
  IfTargetIsAPlayer
    tmpargument = 2
    SendMessageNear



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



// Give the user a bonus, but it's addictive...
IfUsed
  tmpargument = 40
  SetReloadTime
  MakeSimilarNamesKnown
  IfUsageIsKnown
    IfTargetIsHurt
      tmpargument = 1		//Make them drink it
      SetState
      tmpargument = 3
    Else
      tmpargument = 6
    SendMessageNear
  Else			//They don't know what it was
    MakeUsageKnown
    tmpargument = 4
    IfTargetIsAPlayer
      tmpargument = 5
    SendMessageNear
    tmpargument = 40
    tmpdistance = EXPDARE
    GiveExperienceToTarget
    tmpargument = 1		//Make them drink it
    SetState

  //This proceeds if the player drank the potion
  IfStateIs1
    tmpargument = 1
    PlaySound
    tmpargument = 0 - 32		      // Decrease max life a little
    GiveLifeToTarget
    
    // Increase current life
    tmpargument = rand & 2047 + 2048	//Amount of life healed
    HealTarget
    tmpargument = ACTIONMC		//Drink animation
    TargetDoAction
    tmpdistance = SPAWNORIGIN
    tmpargument = 1
    SpawnAttachedHolderParticle
  Else				//This makes them drop it if not set to use
    tmpx = selfx	//Where to spawn the object
    tmpy = selfy
    tmpturn = selfturn
    tmpdistance = 0	//Velocity speed of the spawned object
    SpawnCharacter	//Spawn a copy of the flask
      tmpargument = 1
      SetChildAmmo

  //Use one "charge"
  CostAmmo
  IfAmmoOut
    GoPoof

  tmpargument = 0
  SetState				//Reset for next use

// Finish up
End
