//Make yourself disenchantable
IfSpawned
  SetTargetToSelf
  EnchantTarget
  
  // Must die in 1 hit to disallow punching it open
  tmpargument = 512
  SetDamageThreshold

//Magic sparklies
tmpargument = 1
tmpdistance = selfz
tmpx = selfx
tmpy = selfy
SpawnExactParticle

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

//Make sure it's invisible
IfSpawned
  IfStateIs0
    tmpargument = 2
    ChangeArmor

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

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

// Smash open
IfKilled
  tmpargument = 20
  tmpdistance = EXPDARE
  GiveExperienceToTarget

  tmpargument = 50
  tmpdistance = EXPQUEST
  GiveExperienceToGoodTeam

  //Drop the crown
  DropKeys
  DropItems
  tmpargument = selfmoney
  DropMoney

  // Play the break sound
  tmpargument = 1
  PlaySound

  tmpargument = 0
  SendMessageNear

  //Spooky spell effect
  tmpargument = 2
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  SpawnExactParticle

  GoPoof

  //Bad stuff usually happens when destroying seals
  tmpargument = 0
  IfContentIs
    tmpx = 2500
    tmpy = 2200
    tmpdistance = 50
    tmpargument = 55
    SpawnExactCharacterXYZ           //20 fiend bugs
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    tmpx = 2500
    tmpy = 2000
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    tmpx = 2500
    tmpy = 2400
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    tmpx = 2200
    tmpy = 2200
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ

  tmpargument = 1
  IfContentIs
    tmpx = selfx
    tmpy = selfy
    tmpdistance = selfz
    tmpargument = 49
    SpawnExactCharacterXYZ           //Prepeare a meteor swarm
    SpawnExactCharacterXYZ
    tmpy = selfy + 250
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    tmpy = selfy + 500
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    tmpy = selfy - 250
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    tmpy = selfy - 500
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ

  tmpargument = 2
  IfContentIs			    //Open the exit gate =) Nothin bad
    tmpargument = 14
    OpenPassage
    tmpargument = 15
    OpenPassage

  tmpargument = 3
  IfContentIs			    //Wake the Magma Yeti! moahaha!
    tmpargument = [YETI]
    IssueOrder

End
