//------------------------------------------------------------------------------
//STATUE AI
IfSpawned
  tmpargument = 1
  ChangeArmor
  KeepAction
  tmpx = selfspawnx
  tmpy = selfspawny
  ClearWaypoints
  AddWaypoint
  tmpargument = 0
  SetFlyHeight

//------------------------------------------------------------------------------
//BOSS AI
tmpargument = 1
IfArmorIs
  IfOrdered
    tmpx = [WATC]           //Become alive?
    tmpy = selforder
    IfXIsEqualToY
      tmpargument = 0
      ChangeArmor
      UnkeepAction
      tmpargument = 40
      SetFlyHeight
Else
  //Backstabbing!
  IfBackstabbed
    SetTargetToWhoeverAttacked
    GetDamageType
    tmpdistance = tmpargument
    tmpargument = targetdex
    TargetDamageSelf
    tmpargument = 1
    SendMessageNear

  // ZZ> Death and let the player team win
  IfKilled
    tmpargument = 0
    SendMessageNear
    PlaySound
    SpawnPoof

    //Reduce size
    tmpargument = 40
    SetBumpSize
    tmpargument = 35
    SetBumpHeight

    // Drop money
    tmpargument = selfmoney
    DropMoney

    //Tell the dracolich we are dead
    tmpargument = [BDIE]
    IssueOrder


  //Ouch
  IfAttacked				// Counter attack
    SetTargetToWhoeverAttacked		  //
      IfTargetIsOnHatedTeam		    //
        BecomeLeader			      //
        tmpargument = 1			      // Enter combat mode
        SetState				      //
        SetTurnModeToWatchTarget
      Else				    //
        SetTargetToOldTarget		      //
    tmpargument = rand & 1 + 1		  //
    PlaySound


  IfTargetKilled				// Return to watch mode
    tmpargument = 0			  //
    SetState				  //

  IfBumped				// Attack whoever it bumped
    SetTargetToWhoeverBumped		  //
    IfTargetIsOnHatedTeam			  // Make sure it's an enemy
      DoNothing
    Else					  // Scooch around friendly
      tmpx = rand & 255 + targetx - 128	    //
      tmpy = rand & 255 + targety - 128	    //
      ClearWaypoints			    //
      AddWaypoint				    //
      SetTargetToOldTarget		    //

  IfTimeOut				// This is done every so often
    IfStateIs0
      tmpx = selfspawnx
      tmpy = selfspawny
      tmpdistance = 128*10
      SetTargetToDistantEnemy
        IfFacingTarget
          SetTurnModeToWatchTarget
          tmpargument = 1
          SetState
        Else
          SetTurnModeToSpin
    IfStateIs1

      //Shoot
      IfFacingTarget

        tmpx = selfx
        tmpy = selfy
        tmpdistance = 128
        tmpturn = selfturn
        Compass
        tmpdistance = selfz + 50
        tmpargument = 3           //Gas
        SpawnExactParticle
        tmpargument = 4           //Daze
        SpawnExactParticle
        tmpargument = 5           //Freeze
        SpawnExactParticle
        tmpargument = 6           //Burn
        SpawnExactParticle
        tmpargument = rand % 3 + 1	//Randomize ray

      tmpx = targetdistance
      tmpy = 128*30
      IfXIsLessThanY
        tmpargument = targetaltitude + 30
        SetFlyHeight
        tmpx = targetx
        tmpy = targety
        tmpdistance = 0 - 800
        tmpturn = rand
        Compass
      Else
        tmpx = selfspawnx
        tmpy = selfspawny
        tmpargument = 0
        SetState
    ClearWaypoints			  //
    AddWaypoint				  //
    tmpargument = rand & 15 + 50		  // Wait a while and try again
    SetTime				  //

End					// Finished with this character
  