// Create the character
IfSpawned
  KeepAction

// Draw message
IfTakenOut
  SetTargetToWhoeverIsHolding
    IfTargetIsAPlayer
      tmpargument = 0
      SendMessageNear

// Allow it to be cast
IfUsed
  SetTargetToWhoeverIsHolding
  tmpx = targetmana
  tmpy = 512
  IfXIsMoreThanY
    tmpargument = 512
    CostTargetMana
    MakeNameKnown
    MakeUsageKnown
    
    //Cooldown
    tmpturn = targetint > 8
    tmpargument = 150 - tmpturn     //Higher INT = faster attack speed
    SetReloadTime

    // Spawn the damage particle
    tmpx = selfx
    tmpy = selfy
    tmpdistance = selfz + 75
    tmpargument = 1
    SpawnExactParticle

// Return to spellbook, Do last!
IfDropped
  tmpargument = 0
  SetContent
  BecomeSpellbook
  DisaffirmCharacter
  tmpargument = ACTIONJB
  DoAction
  KeepAction
End
