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

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 = 2
    SpawnExactParticle
    tmpargument = 1
    SetState
    tmpargument = 20
    SetTime

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

IfKilled
  GoPoof
  tmpargument = 0
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  SpawnExactParticle
  PlaySound

  //Release the lich inside!
  tmpargument = 81		//Lich
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  tmpturn = selfturn
  SpawnExactCharacterXYZ
  
  //Give the lich some toys to play with
  SetTargetToChild
  tmpargument = 83		//Frostblast
  tmpdistance = RIGHT
  SpawnAttachedCharacter
  tmpargument = 82		//Fire dart
  tmpdistance = LEFT
  SpawnAttachedCharacter

  //Tell them what they have done
  tmpargument = 0
  SendMessageNear
  tmpargument = 1
  PlaySound

//Make it destroyable
IfSpawned
  JoinEvilTeam

End
