// 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
  SetTargetToWhoeverIsHolding
  tmpargument = 40
  SetReloadTime
  MakeSimilarNamesKnown
  
  //Do they know what it is?
  IfUsageIsKnown
    tmpargument = [CODE]
    IfTargetHasSkillID
      tmpargument = 3           //Paladins refuse
      SendMessageNear
    Else
      tmpargument = 1
      SetState
  Else			//They don't know what it was
    MakeUsageKnown
    tmpargument = 40
    tmpdistance = EXPDARE
    GiveExperienceToTarget
    tmpargument = 1		//Make them drink it
    SetState

  //This proceeds if the player drank the potion
  IfStateIs1
    tmpargument = ACTIONMC		//Drink animation
    TargetDoAction
    tmpdistance = SPAWNORIGIN
    tmpargument = 1
    SpawnAttachedHolderParticle
        
    //Message and effect
    tmpargument = [GNOM]
    IfTargetHasID                 //Gnomes can take this
      tmpargument = 768
      HealTarget
      tmpargument = 16            //Permanent strength bonus
      GiveStrengthToTarget
      tmpargument = -8            //Permanent mental penality
      GiveIntelligenceToTarget
      GiveWisdomToTarget
      tmpargument = 7
    Else
      tmpargument = rand % 5 + 8  //It's too much for others
      GrogTarget
    
      tmpargument = 4             
      IfTargetIsAPlayer
        tmpargument = 5
    SendMessageNear
    tmpargument = 1
    PlaySound

    //Use one "charge"
    CostAmmo
    IfAmmoOut
      GoPoof

  tmpargument = 0
  SetState				//Reset for next use

// Finish up
End
