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



// Make it lie on the floor
IfDropped
  KeepAction
  tmpargument = ACTIONJB
  DoAction
  



// Play a clink or clang
IfHitGround
  tmpargument = 0
  tmpdistance = rand & 2047 + 10000
  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 = [GOOD]
  IfTargetHasSpecialID		//Can cast divine?
    GetContent
    tmpx = tmpargument
    tmpy = 900
    IfXIsLessThanY		//Dont overcharge
      tmpy = targetmanaflow
      IfXIsLessThanY		//Enough manaflow?
        tmpy = 14
        tmpx = targetmana
        IfXIsMoreThanY		//Enough mana to charge more?
          tmpargument = 8	//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 = 3
  SpawnAttachedSizedParticle

// Finish up
End
