// Set up general stuff
IfSpawned
  tmpargument = ACTIONJB
  DoAction
  KeepAction
  MakeCrushValid
  
//Crushed in a passage
IfCrushed
  tmpargument = 3
  tmpdistance = selfz
  tmpx = selfx
  tmpy = selfy
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  GoPoof
  tmpargument = 5
  SendMessageNear
  
// Make it lie on the floor
IfDropped
  KeepAction
  tmpargument = ACTIONJB
  DoAction


// 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

// What happens if it is used by a healer??
IfUsed
  SetTargetToWhoeverIsHolding
  tmpargument = [HMAG]
  IfTargetHasSkillID		//Can cast divine?
    GetContent
    tmpx = tmpargument
    tmpy = 900
    IfXIsLessThanY		//Dont overcharge
      tmpy = targetmanaflow
      IfXIsLessThanY		//Enough manaflow?
        tmpy = 10
        tmpx = targetmana
        IfXIsMoreThanY		//Enough mana to charge more?
          tmpargument = 10	//Mana cost
          CostTargetMana
          GetContent
          tmpargument = tmpargument + 10	//Casting speed
          SetContent
  Else
    tmpargument = 3
    SendMessageNear

Else
  GetContent
  tmpx = tmpargument
  tmpy = 896
  IfXIsMoreThanY	//Finished Charging
    tmpargument = 4
    SendMessageNear	//Send message
    tmpargument = 0
    tmpx = targetx
    tmpy = targety
    tmpdistance = targetz
    SpawnExactParticle	//Spawn the magic effects
    tmpargument = 1
    PlaySound		//Play the holy sound
    tmpargument = 150
    SetReloadTime	//cannot be used again for a while
  tmpargument = 0
  SetContent

// Put the little mana ball on the
// character's hand
GetContent
tmpx = tmpargument
tmpy = 0
IfXIsMoreThanY
  tmpturn = tmpargument * 25 + 5000
  tmpdistance = SPAWNORIGIN
  tmpargument = 2
  SpawnAttachedSizedParticle

// Finish up
End
