//------------------------------------------------------------------------------
// ZZ> Death and let the player team win
IfKilled
  tmpargument = 35
  SetBumpHeight
  IfTargetIsOnHatedTeam
    tmpargument = 0
    SendMessageNear


  // Award quest experience
  tmpargument = 100
  tmpdistance = EXPQUEST
  GiveExperienceToTargetTeam


  // Finish it up
  BeatModule
  EnableExport
  // Mark this module as beaten, hidden modules may open up
  tmpargument = [BEAT]
  AddIDSZ
  // Fix the end text
  ClearEndMessage
  tmpargument = 2
  AddEndMessage
  tmpargument = 3
  AddEndMessage
  tmpargument = 4
  AddEndMessage
  tmpargument = 5
  AddEndMessage


  //Victory tune
  SetTargetToWideEnemy
    tmpargument = 11		//Music track
    tmpdistance = 0		//Fade in time
    PlayMusic



//------------------------------------------------------------------------------
// ZZ> Make the GrubMum do the decoy dance at the beginning of the module.
//     This lets the players know what the target of the quest is.
IfSpawned
  DisableExport
  ClearWaypoints
  tmpx = 2112
  tmpy = 6208
  AddWaypoint
//  tmpx = 2624
//  tmpy = 6336
//  AddWaypoint
  tmpx = 4032
  tmpy = 6080
  AddWaypoint
  tmpx = 4032
  tmpy = 5668
  AddWaypoint


//------------------------------------------------------------------------------
// ZZ> Handle wandering around
IfStateIs1
  // Wander around the boss room
  IfAtWaypoint
    CleanUp
    tmpx = rand % 1332 + 508
    tmpy = rand % 1594 + 462
    ClearWaypoints
    AddWaypoint

  //Play dramatic boss music
  SetTargetToWideEnemy
    tmpargument = 6		//Music track
    tmpdistance = 0		//Fade in time
    PlayMusic

Else
  // Teleport from the waterway to the boss room
  IfAtLastWaypoint
    IfSpawned
      DoNothing
    Else
      tmpx = 1280
      tmpy = 1280
      tmpargument = 1
      SendMessageNear
      Teleport
        ClearWaypoints
        AddWaypoint

        Sneak
        tmpargument = 1
        SetState

        ShowMap
        ShowYouAreHere


//------------------------------------------------------------------------------
// ZZ> Damage anyone that touches the Mum
IfBumped
  SetTargetToWhoeverBumped
  IfTargetIsOnHatedTeam
    tmpargument = 900
    DamageTarget


//------------------------------------------------------------------------------
// ZZ> Let the characters know where she is...
tmpx = selfx
tmpy = selfy
tmpargument = GREEN
ShowBlipXY


//------------------------------------------------------------------------------
End
//------------------------------------------------------------------------------
