//Module Setting: Imprisoned One

IfSpawned
  tmpargument = 2
  tmpdistance = 0
  PlayMusic
  
  tmpdistance = BLAHFRIENDS + BLAHENEMIES + BLAHQUEST
  tmpturn = [IMPB]
  SetTargetToNearestBlahID
  IfTargetHasQuest                  //Get the current quest level
    tmpargument = tmpdistance       //quest level = time left
  Else
    tmpargument = 50*60*25          //Default to 25 minutes
  SetContent

//Update the game timer
tmpx = selfcontent
tmpy = 0
IfXIsMoreThanY
  tmpargument = selfcontent - 1
  SetContent
  ShowTimer
  
IfOrdered
  tmpx = selforder
  tmpy = [BEAT]
  IfXIsEqualToY
    tmpargument = [IMPC]          //Imprisoned one level 3
    tmpdistance = selfcontent     //Store time left on this level
    AddQuestAllPlayers
    BeatModule
    EnableExport
    EndModule
    ClearEndMessage
    tmpy = selfcontent / 60 / 50      //Calculate amount of time left from the ticks
    tmpx = selfcontent / 50
    tmpx = tmpx % 60
    tmpargument = 0
    AddEndMessage
    tmpargument = 1
    AddEndMessage
    tmpargument = 2
    AddEndMessage
    tmpargument = 3
    AddEndMessage
    tmpargument = 4
    AddEndMessage
  
//Do lava bubbles
IfTimeOut
  tmpargument = rand & 31 + 15
  SetTime
  
  tmpargument = 0
  tmpdistance = 0
  tmpx = rand % 562 + selfspawnx - 281
  tmpy = rand % 562 + selfspawny - 281
  SpawnExactParticle
  
//------------------------------------------------------------------------------------
End					// All done
//------------------------------------------------------------------------------------
