--	Stratagus Map - Single player campaign

Load("campaigns/orc/level01o_c2.sms")

Briefing(
  title,
  objectives,
  "../campaigns/orc/interface/introscreen1.png",
  "campaigns/orc/level01o.txt",
  {"campaigns/orc/level01o-intro1.wav"}
)

AddTrigger(
  function() return GetPlayerData(GetThisPlayer(), "UnitTypesCount", "unit-pig-farm") >= 4 and
    GetPlayerData(GetThisPlayer(), "UnitTypesCount", "unit-orc-barracks") >= 1 end,
  function() return ActionVictory() end)
AddTrigger(
  function() return GetPlayerData(GetThisPlayer(), "TotalNumUnits") == 0 end,
  function() return ActionDefeat() end)

-- Units

local allowedHumanUnits = {"unit-farm",
	"unit-town-hall", "unit-peasant",
	"unit-human-barracks", "unit-footman"
}
local allowedOrcUnits = {"unit-pig-farm",
	"unit-great-hall", "unit-peon",
	"unit-orc-barracks", "unit-grunt"
}
local function DefineAllowTable(table, flags)
	for i, unitName in ipairs(table) do
		DefineAllow(unitName, flags)
	end
end

DefineAllowNormalHumanUnits("FFFFFFFFFFFFFFFF")
DefineAllowExtraHumanUnits("FFFFFFFFFFFFFFFF")
DefineAllowNormalOrcUnits("FFFFFFFFFFFFFFFF")
DefineAllowExtraOrcUnits("FFFFFFFFFFFFFFFF")
DefineAllowSpecialUnits("FFFFFFFFFFFFFFFF")
DefineAllowHumanAlways()
DefineAllowOrcAlways()
DefineAllowTable(allowedHumanUnits, "AAAAAAAAAAAAAAAA")
DefineAllowTable(allowedOrcUnits, "AAAAAAAAAAAAAAAA")

Load("campaigns/orc/level01o.sms")
