/*
   CGF mission, occurring at the Urban map.
   The player is tasked to take out Sabotage, a manager of clandestine
   software copying business. He is said to be hiding in the big tower.
   Rumours are that the streets are aggressively being patrolled by
   Sabotage's 'Protection' team and maybe a sniper.
   For your assistance, team Decoy (a single buddy) will autonomously
   patrol the streets as well, and try to keep Sabotage's protection
   busy...

   Can you be DA HITMAN who takes evil Sabotage out?

*/

mission "urban hitman"
{
  author
    "William";

  description
    "you're the hitman!\neliminate Sabotage (in the highest building)\nhe is guarded though";

  rules
  {
    respawn = none;
  };

  map "urban"
  { 
    style = open, dark, urban;

    annotation = "

    ^N
  W     E            map by Gerbil!
     S               n.b. annotation is just for clarity, thus is optional

 +----------+-----+=============----+------+----+--------------------------+
 |  low     |@@   |         |   .   +------+    |                          |
 | buildings|@@   |         |   .   |##    |    +                          |
 |          |@@   |         |   .   |      |    +--------------------+-----|
 |  @@  @@  |     |         |   .   |      |   #+--------+           |     |
 |          +-----+---+     |   .   |      |             | -AQ-sign- |     |
 |--------------------+.....+-------+      +-------------+-----------+     |
 |  dead-end alley          a                                        | @@  |
 |----------+--------------+l +----------------+                     |     |
 |          |              |l |                |                     |     |
 | sniper   |              |e |                |                     |     |
 | room     |              |y |                |                     | @@  |
 |--+---| |-+--------------+==+                |                     +-----|
 |  |       |                 |                |                     |     |
 |  |       |                 +----------------+                     | @@  |
 |  +-------+                     alley                              |     |
 |                        +----------------------+                 +-------|
 | +--------+             |  @@           @@     |                 |       |
 | |parking |             |                      |                 |       |
 | | . .    |             | center building roof |                 |       |
 | | . .    |             |  unreachable without |-----------------|       |
 | | . .    |             |     trick jumps      |  @@@@@@@@@@     | @@    |
 | +--------+             |  @@             +----|    bridge       | @@    |
 |                        |                 |    |    OO           | @@@@  |
 |   +-----+              |        +--------+    |-----------------|       |
 |   |     |              |        |             |                 |       |
 |   |    !|              +--------+-------------+                 +-------|
 |   |    !|Coke                                                    alley  |
 |   |    !|sign                                                   +-------|
 |   +-----+                                                       |       |
 |                                                                 |       |
 |                     +-------------+     +--| |------------------|       |
 |----------------+    | @@ south @@ |     _                       |       |
 |                |    |   center    |     _              .....    |       |
 |  @@      @@    |   #| building @@ |     |              .....    |       |
 |  south corner  |    +-------HH----+     |                       |       |
 |  building      |            HH          |   THE high roof       |       |
 |  @@      @@    +------------HH---+------|                       |       |
 |                                 #|     #| south east high roof  |       |  
 +----------------------------------+--------------------------------------+
 "; 

    /*
    locations
    */ 

    // sniper room locations (north west)
    location NW_SniperRoom_Rooftop         = <-1346,   634,  280>;
    location NW_SniperRoom                 = <-1273,   879,  316>;

    // parking
    location W_Parking_TopFloor            = <-1337,   268,  432>;
    location W_Parking_SndFloor            = <-1406,   210,  296>;
    location W_Parking_TopFloorSniperRoom  = <-1450,   305,  425>;

    // coke billboard building
    location W_Behind_CokeSign             = <-1365,  -262,  472>;

    // corner building with four air vents
    location SW_CenterAtCornerBuilding     = <-1201, -1129,  472>;
    location SW_SWAtCornerBuilding         = <-1498, -1116,  472>;

    // building with ladder and ramp close to largest building
    location S_SouthCenterBuildingTop      = < -866,  -743,  408>;

    // street level, underneath ramp
    location S_SouthCenterUnderneathRamp   = < -672, -1151,   40>;

    // largest building (south east high roof)
    location SE_HighBuildingSniperRoom     = < -310,  -768,  680>;
    location SE_HighBuildingRoofTopCorner  = <  157, -1240,  792>;
    location SE_HighBuildingRoofTopEdge    = < -322,  -762,  792>;
    location SE_HighBuildingRoofTopCenter  = < -233, -1010,  792>;
    location SE_HighBuildingSniperWindow1  = < -351,  -766,  680>;
    location SE_HighBuildingSniperWindow2  = < -185,  -736,  680>;
    location SE_HighLadderToRoofTop        = < -307, -1258,  792>;

    // north side, low roofs
    location NW_LowBuildingsRoofTop        = <-1065,  1432,  280>;

    // bridge (across street), east side of the map
    location E_UnderBridge                 = < -182,   173,   40>;
    location E_AtBridge                    = <  -42,    35,  232>;
    location E_StairsToBridge              = <  476,    66,  216>;

    // near northeast AQ2 sign
    location NE_StreatUnderneathAQ2Sign    = <  182,  1107,   40>;
    location NE_BehindBuildingNearAQ2Sign  = < -379,  1316,   40>;


    /*
    areas (for patrol purposes)
    */ 
    area area_NW_SniperRoom
    { style     = roof; // combine using open, closed, roof
      locations = NW_SniperRoom_Rooftop;
      // use height cut off instead of radius
    };

    area area_E_AtBridge
      { style     = open; // combine using open, closed, roof
        locations = E_AtBridge;
        radius    = 250;  // max distance to listed locations
      };

    area area_SE_HighBuildingSniperRoom
    { style     = closed; // combine using open, closed, roof
      locations = SE_HighBuildingSniperRoom;
      radius    = 100;  // max distance to listed locations
    };

    area area_NW_LowBuildingsRoofTop
    { style     = open; // combine using open, closed, roof
      locations = NW_LowBuildingsRoofTop;
      radius    = 100;  // max distance to listed locations
    };

    area area_SW_CenterAtCornerBuilding
    { style     = open; // combine using open, closed, roof
      locations = SW_CenterAtCornerBuilding;
      radius    = 100;  // max distance to listed locations
    };

  };

  force "Warez Dudes"
  {
    team "Clandestine Management"
    { npc "Sabotage" "male/sabotage" 
        { 
          weapon "Dual MK23 Pistols";
          ammo   "M4 Clip" = 2;
          skill  = 3;
        };
    };

    team "High Precision"
    { 
      npc "Precision-1" "terror/swatsnipe" 
        { 
          ammo   "AP Sniper Ammo" = 10;
          weapon "Sniper Rifle";
          skill  = 2;
        };
    };

    team "Protection Copy"
    { 
      npc "Protection-1" "terror/terror" 
        { 
          weapon "M3 Super 90 Assault Shotgun";
          ammo   "12 Gauge Shells" = 7;
          skill  = 2;
        };
      npc "Protection-2" "terror/terror" 
        { 
          weapon "M3 Super 90 Assault Shotgun";
          ammo   "12 Gauge Shells" = 7;
          skill  = 2;
        };
      npc "Protection-3" "terror/terror" 
        { 
          weapon "M3 Super 90 Assault Shotgun";
          ammo   "12 Gauge Shells" = 7;
          skill  = 2;
        };
      npc "Protection-4" "terror/terror" 
        { 
          weapon "M3 Super 90 Assault Shotgun";
          ammo   "12 Gauge Shells" = 7;
          skill  = 2;
        };
    };

  };

  force "A kind of Law"
  {
    team "Hitman"
    { 
      player "Hitman" "male/reservoir" 
        { 
          weapon "M3 Super 90 Assault Shotgun";
          ammo   "12 Gauge Shells" = 7;

          item   "Kevlar Vest";
        };
    };

    team "Decoy"
    { 
      npc "Buddy" "male/adidas" 
        { 
          weapon "M4 Assault Rifle";
          ammo   "M4 Clip" = 2;
          skill  = 2.5;
        };
    };
  };

  objectives
  {
    failure
      ( "A kind of Law",
        "you're supposed to be a hitman!"
      )
    = eliminated("A kind of Law")
      -> {"urban_map_2.cgf"};

    success
      ( "A kind of Law",
        "you sure are da HITMAN!"
      )
    = eliminated("Sabotage")
      -> {"urban_map_2.cgf"};

    failure
      ( "A kind of Law",
        "this is taking way too long"
      )
    = timeout(300)
      -> {"urban_map_2.cgf"};
  };

  plan "Clandestine Management"
  {
     insert at SE_HighBuildingSniperRoom using "column";
     wait until ready;
     
     spread towards SE_HighBuildingRoofTopCenter within 1; // time in seconds
     wait until ready;

    // wait, defend and repeat 
    phase "wait for business";
     on (contact)
     {
       abort; // stop doing whatever he is doing
       defend towards SE_HighBuildingRoofTopCenter from SE_HighBuildingSniperRoom;
       wait until ready;
       continue with phase "wait for business";
     }
     wait forever;  // wait until contact
  };

  plan "Protection Copy"
  {
     insert at SW_CenterAtCornerBuilding using "column";
     wait until ready;
     
     patrol;
  };

  plan "High Precision"
  {
     insert at SE_HighBuildingRoofTopCenter using "column";
     wait until ready;

     snipe from SE_HighBuildingRoofTopEdge towards S_SouthCenterBuildingTop;
  };

  plan "Hitman"
  {
     insert at NE_BehindBuildingNearAQ2Sign using "column";
     wait until ready;

     // player, so nothing to do here
  };

  plan "Decoy"
  {
     insert at NW_LowBuildingsRoofTop using "column";
     wait until ready;
     
     patrol;
  };
}