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

//Remove self if ordered to do so
IfOrdered
  tmpx = selforder
  tmpy = [FREE]
  IfXIsEqualToY
    GoPoof

  //This is lord bishop's prison orb (looks different)
  tmpx = selforder
  tmpy = [KING]
  IfXIsEqualToY
    tmpargument = 1
    SetContent
    ChangeArmor

//Spelly effects
tmpargument = 0
IfContentIs
  tmpargument = 1
Else
  tmpargument = 4
tmpdistance = selfz
tmpx = selfx
tmpy = selfy
SpawnExactParticle
SetTurnModeToSpin

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

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

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

  // Play the break sound
  tmpargument = 1
  PlaySound

  tmpargument = 0
  SendMessageNear

  tmpargument = 2
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  SpawnExactParticle

  GoPoof
  tmpargument = [FREE]
  IssueOrder               //Release the prisoner!
End
