--     ____                _       __               
--    / __ )____  _____   | |     / /___ ___________
--   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
--  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  ) 
-- /_____/\____/____/     |__/|__/\__,_/_/  /____/  
--                                              
--       A futuristic real-time strategy game.
--          This file is part of Bos Wars.
--
--  level02.sms  -  Tutorial map 2.
--
--  (c) Copyright 2006 by Francois Berteen
--
--      This program is free software; you can redistribute it and/or modify
--      it under the terms of the GNU General Public License as published by
--      the Free Software Foundation; either version 2 of the License, or
--      (at your option) any later version.
--  
--      This program is distributed in the hope that it will be useful,
--      but WITHOUT ANY WARRANTY; without even the implied warranty of
--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--      GNU General Public License for more details.
--  
--      You should have received a copy of the GNU General Public License
--      along with this program; if not, write to the Free Software
--      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
--
--=============================================================================
--  Define level 02 Map Presentation
--

Load("maps/tutorial.map/setup.sms")

unit= CreateUnit("unit-buggy", 0, {23, 44})
unit= CreateUnit("unit-engineer", 0, {25, 44})

DisallowAllUnits()
DefineAllow("unit-engineer", AllowAll)
DefineAllow("unit-powerplant", AllowAll)

function GetOwnUnitsAmount(type)
  return ThisPlayer.UnitTypesCount[UnitTypeByIdent(type).Slot]
end
AddTrigger(
  function() return ThisPlayer.TotalNumUnits == 0 end,
  function() return StopGame(GameDefeat) end)

AddTrigger(
  function() 
    local e = GetOwnUnitsAmount("unit-engineer")
    local g = GetOwnUnitsAmount("unit-powerplant")
    return (e == 3 and g == 1) end,
  function() return StopGame(GameVictory) end)

AddCampaignFinalAssault(4000,
  "Commander LL says:  Too late !"
)

