//Drop the loot
IfKilled
  DropKeys
  SetTargetToWhoeverAttacked
  tmpargument = 150			//Award some quest xp
  tmpdistance = EXPQUEST
  GiveExperienceToGoodTeam
  tmpargument = 512			//Give abillity to cast divine spells!
  GiveManaToTarget

IfHealed
  // Spawn a defense ping
  IfStateIs0
    tmpx = selfx
    tmpy = selfy
    tmpdistance = selfz
    tmpargument = 0
    SpawnExactParticle
    tmpargument = 1
    SetState
    tmpargument = 1
    SetTime
    tmpargument = 2
    SendMessageNear

//Hit by bashing weapons?
IfAttacked
  // Must die in 1 hit to disallow punching it open
  tmpargument = 512
  HealSelf
  // Spawn a defense ping
  IfStateIs0
    tmpx = selfx
    tmpy = selfy
    tmpdistance = selfz
    tmpargument = 0
    SpawnExactParticle
    tmpargument = 1
    SetState
    tmpargument = 1
    SetTime
    tmpargument = 2
    SendMessageNear



IfTimeOut
  // Ready the pings
  tmpargument = 0
  SetState
  tmpargument = 300
  SetTime



IfKilled
  tmpargument = 18
  OpenPassage
  // Smash open
  tmpargument = [GOOD]
  IfTargetHasSpecialID
    tmpturn = 0
  Else
    tmpturn = 1
  // Check for passages to open
  tmpx = passage
  tmpy = 0
  IfXIsEqualToY
    // Play the break sound
    tmpargument = 2
    tmpdistance = rand & 1023 + 10500
    PlaySound
  tmpargument = tmpturn
  SendMessageNear

  tmpargument = 4
  SpawnParticle

  // Drop goodies
  DropItems
  tmpargument = 65535
  DropMoney


  // Replace self with an imposter...
  tmpargument = 54
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  tmpturn = selfturn
  SpawnExactCharacterXYZ
  GoPoof

IfKilled
  tmpargument = 1
  IssueOrder


End
