//-----------------------------------------------------------------------------
// Alchemy special abillity
SetTargetToSelf
IfTargetIsAlive
  SetTargetToTargetLeftHand	//Check left hand first
    tmpargument = [POTI]
    IfTargetHasID
      IdentifyTarget		//Identify potions
      SetTargetToSelf
    tmpargument = [FLAS]
    IfTargetHasID
      IdentifyTarget		//And flasks
  SetTargetToTargetRightHand	//Repeat with other hand
    tmpargument = [POTI]
    IfTargetHasID
      IdentifyTarget		//Identify potions
    tmpargument = [FLAS]
    IfTargetHasID
      IdentifyTarget		//And flasks

//-----------------------------------------------------------------------------
// ZZ> Gong sound
IfCleanedUp
  tmpargument = 2
  PlayFullSound


//------------------------------------------------------------------------------
// ZZ> Scream and shout
IfUsed
  tmpargument = 10
  PlaySound


//------------------------------------------------------------------------------
// ZZ> Handle being bored by cheering or sneezing
IfBored
  tmpargument = 7
  SendMessageNear
  tmpargument = 11
  PlaySound
  tmpargument = ACTIONMC
  DoAction



//------------------------------------------------------------------------------
// ZZ> Handle death by sending a message and other stuff
IfKilled
  // Sound
  IfTargetIsOnHatedTeam
    tmpargument = 4
  Else
    tmpargument = 3
  PlaySound


  // Message
  tmpargument = 3
  IfArmorIs
    tmpargument = MESSAGECOSTUME
  Else
    tmpargument = MESSAGEDEATH
  IfTargetIsOnSameTeam
    tmpargument = MESSAGEFRAG
    IfTargetIsSelf
      tmpargument = MESSAGEACCIDENT
  SendMessage


  // Drop goodies
  tmpargument = 1+selflevel*selflevel*100		//The money loss formula
  DropMoney
  DropKeys


  // Make the character body
  tmpargument = 45
  SetBumpHeight

//------------------------------------------------------------------------------
// ZZ> For helper AIs
IfLeaderKilled
  BecomeLeader


//------------------------------------------------------------------------------
// ZZ> Handle being attacked by blocking or countering or running away
IfAttacked
  SetTargetToWhoeverAttacked
  IfTargetIsOnSameTeam
    tmpargument = 8
    PlaySound
    tmpargument = MESSAGEOUCH
    SendMessageNear
  Else
    tmpargument = rand & 1 + 5
    PlaySound


//------------------------------------------------------------------------------
// ZZ> Handle being healed by spitting out a message and stopping retreat
IfHealed
  tmpargument = 6
  SendMessageNear
  tmpargument = 9
  PlaySound


//------------------------------------------------------------------------------
// ZZ> Handle not being able to carry something
IfTooMuchBaggage
  tmpargument = 8
  SendMessageNear
  tmpargument = 7
  PlaySound

//------------------------------------------------------------------------------
//Invoke special power if enough xp gained
IfStateIs0
  SetTargetToSelf
  tmpx = targetexp
  tmpy = 9998
  IfXIsMoreThanY
    SetOwnerToTarget
    EnchantTarget 	//Give the special bonus
    tmpargument = 1
    SetState
  Else
    tmpargument = 0
    SetState
    UndoEnchant
Else
  tmpargument = 2	//Spawn some fancy sparklies
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  SpawnExactParticle


//------------------------------------------------------------------------------
End
//------------------------------------------------------------------------------
