1--       _________ __                 __
2--      /   _____//  |_____________ _/  |______     ____  __ __  ______
3--      \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
4--      /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
5--     /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
6--             \/                  \/          \//_____/            \/
7--  ______________________                           ______________________
8--                        T H E   W A R   B E G I N S
9--         Stratagus - A free fantasy real time strategy game engine
10--
11--      (c) Copyright 2015-2019 by Andrettin
12--
13--      This program is free software; you can redistribute it and/or modify
14--      it under the terms of the GNU General Public License as published by
15--      the Free Software Foundation; either version 2 of the License, or
16--      (at your option) any later version.
17--
18--      This program is distributed in the hope that it will be useful,
19--      but WITHOUT ANY WARRANTY; without even the implied warranty of
20--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21--      GNU General Public License for more details.
22--
23--      You should have received a copy of the GNU General Public License
24--      along with this program; if not, write to the Free Software
25--      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26--
27
28if (LoadedGame == false) then
29	SetPlayerData(0, "Resources", "copper", 5000)
30	SetPlayerData(0, "Resources", "lumber", 5000)
31	SetPlayerData(0, "Resources", "stone", 2500)
32	SetPlayerData(0, "Resources", "oil", 0)
33	SetAiType(0, "land-attack")
34	SetPlayerData(1, "Resources", "copper", 2000)
35	SetPlayerData(1, "Resources", "lumber", 2000)
36	SetPlayerData(1, "Resources", "stone", 1000)
37	SetPlayerData(1, "Resources", "oil", 0)
38	SetAiType(1, "land-attack")
39
40	SetPlayerData(0, "Faction", "bavarian-tribe")
41	SetPlayerData(1, "Faction", "rome")
42	SetPlayerData(1, "Allow", "upgrade-masonry", "R")
43
44	unit = CreateUnit("unit-teuton-swordsman", 0, {Players[0].StartPos.x, Players[0].StartPos.y})
45	SetUnitVariable(unit, "Active", false)
46	unit = CreateUnit("unit-teuton-swordsman", 0, {Players[0].StartPos.x, Players[0].StartPos.y})
47	SetUnitVariable(unit, "Active", false)
48	unit = CreateUnit("unit-teuton-archer", 0, {Players[0].StartPos.x, Players[0].StartPos.y})
49	SetUnitVariable(unit, "Active", false)
50
51	unit = CreateUnit("unit-latin-javelineer", 1, {Players[1].StartPos.x, Players[1].StartPos.y})
52	SetUnitVariable(unit, "Active", false)
53	unit = CreateUnit("unit-latin-javelineer", 1, {Players[1].StartPos.x, Players[1].StartPos.y})
54	SetUnitVariable(unit, "Active", false)
55	unit = CreateUnit("unit-teuton-catapult", 1, {Players[1].StartPos.x, Players[1].StartPos.y})
56	SetUnitVariable(unit, "Active", false)
57end
58
59-- The Blue Danube introduction
60AddTrigger("the-blue-danube-introduction",
61	function()
62		if (GameCycle == 0) then
63			return false
64		end
65		if (GetFactionExists("Bavarian Tribe") and PlayerHasObjective(GetFactionPlayer("Bavarian Tribe"), "- Defeat the Roman remnants") == false) then
66			player = GetFactionPlayer("Bavarian Tribe")
67			return true
68		end
69		return false
70	end,
71	function()
72		Event(
73			"",
74			"As time passed, our ancestors, the Marcomanni, came to be more and more known by their place of dwelling - Bohemia. Thus did our name of \"Bavarians\" originate - it means \"men from Bohemia\". Expelled from those lands by the Lombards, we must now seek a home on the margins of the Danube.",
75			player,
76			{"~!Continue"},
77			{function(s)
78			Event(
79				"",
80				"After a long time traveling south, we are now close to the great river. Our scouts report that remnant forces of the crumbling Roman Empire can be found here - we must locate and destroy them, to make way for our settlement in these lands.",
81				player,
82				{"~!Continue"},
83				{function(s)
84					RemovePlayerObjective(player, "- Defeat your rivals")
85					AddPlayerObjective(player, "- Defeat the Roman remnants")
86				end}
87			)
88			end}
89		)
90		return false
91	end
92)
93
94AddTrigger("the-blue-danube-victory",
95	function()
96		if (GameCycle == 0) then
97			return false
98		end
99		if (GetFactionExists("Bavarian Tribe") and PlayerHasObjective(GetFactionPlayer("Bavarian Tribe"), "- Defeat the Roman remnants") and GetNumRivals(GetFactionPlayer("Bavarian Tribe")) == 0) then
100			player = GetFactionPlayer("Bavarian Tribe")
101			return true
102		end
103		return false
104	end,
105	function()
106		Event(
107			"",
108			"The Romans of this area have been fully subjected to us. Long has been our journey, and pleasant shall be our new home. Already marriages are occurring between our people and the locals, who begin to learn our tongue. A new land has been born, Bavaria!",
109			player,
110			{"~!Continue"},
111			{function(s)
112				if (player == GetThisPlayer()) then
113					ActionVictory()
114					if (GrandStrategy == false) then
115						SetQuestCompleted("the-blue-danube", GameSettings.Difficulty)
116					end
117				end
118			end}
119		)
120		return false
121	end
122)
123