//If the cage is spawn in the hands, it spawns an overlay enchant with
//a new second cage and goes poof. If content = 0 the seal orb spawns
//in the X direction (otherwise Y)

IfSpawned
  IfHeld

    //Imprison the holder
    SetTargetToWhoeverIsHolding
    EnchantTarget

    //Spawn a key orb
    tmpargument = 0
    IfContentIs
      tmpx = targetx - 150
      tmpy = targety
    Else
      tmpx = targetx
      tmpy = targety - 150

    tmpargument = 2           //special king bishop orb
    IfContentIs
      tmpargument = 115
      tmpx = targetx - 150
      tmpy = targety
    Else
      tmpargument = 76
    tmpdistance = selfz
    tmpturn = rand
    SpawnExactCharacterXYZ

    //Go away
    GoPoof

//Spelly effects
tmpargument = 1
tmpdistance = selfz
tmpx = selfx
tmpy = selfy
SpawnExactParticle

//The prison seal is broken!
IfOrdered
  tmpx = selforder
  tmpy = [FREE]
  IfXIsEqualToY
    SetTargetToNearestFriend     //The prisoner
    DisenchantTarget
    GoPoof

End
