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 2017-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
28AddTrigger("mcz-3328-1853", -- Source: "Minister-Conferenz-Kanzlei MCZ 3328/1853".
29	function()
30		if (SyncRand(10) ~= 0) then -- 10% chance this will trigger every time it is checked (and 10% for each player it is checked for, for a chance of 1% for a player that matches the conditions
31			return false
32		end
33		for i=0,(PlayerMax - 2) do
34			if (
35				GetPlayerData(i, "TotalNumUnitsConstructed") > 0
36				and SyncRand(10) == 0
37				and GetPlayerData(i, "RaceName") == "teuton"
38				and CheckDependency(i, "unit-road") -- the act is about labor requirement for road construction
39				and GetPlayerData(i, "Allow", "upgrade-deity-christian-god") == "R" -- discusses a complaint by the bishop of Agram
40				and GetPlayerData(i, "UnitTypesCount", "unit-teuton-priest") >= 1 -- one of the event's options makes the player lose a priest
41				and GetPlayerData(i, "Resources", "copper") >= 500 -- one of the event's options makes the player lose 500 copper
42				and GetPlayerData(i, "HasSettlement", "zagreb")
43			) then
44				trigger_player = i
45				return true
46			end
47		end
48		return false
49	end,
50	function()
51		CallDialogue("mcz-3328-1853", trigger_player)
52		return false
53	end
54)
55