-
Notifications
You must be signed in to change notification settings - Fork 0
/
CoalitionEraTracker.cs
107 lines (96 loc) · 4.17 KB
/
CoalitionEraTracker.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WDS_Dispatches {
internal class CoalitionEraTracker {
static SortedDictionary<
(int StartYear, int EndYear),
List<string[]>
> CoalitionsByEra;
public static bool AreNationsAllied(int year, string nation1, string nation2) {
if (nation1 == nation2) { return true; }
if (CoalitionEraTracker.CoalitionsByEra == null) {
CoalitionEraTracker.CoalitionsByEra = new SortedDictionary<
(int StartYear, int EndYear),
List<string[]>
>();
// Renaissance
CoalitionEraTracker.CoalitionsByEra.Add(
(1500, 1617),
new List<string[]>() {
new string[] {
"France", "Scotland", "Dutch", "Swiss/Mercenary",
"Italian States/Mercenary", "Portugal", "Ferrara", "Ottoman Turks"
},
new string[] {
"Imperialist/Spain", "England", "Swiss", "Italian States",
"Hungary", "Mamelukes", "Navarre/Huguenots"
}
}
);
// Thirty Years War
CoalitionEraTracker.CoalitionsByEra.Add(
(1618, 1648),
new List<string[]>() {
new string[] {
"Imperialist", "Bavaria", "Hapsburg", "Poland", "Spain", "Saxon", "Catholic"
},
new string[] {
"Anti-Imperialist", "Bohemia", "Transylvania", "Dutch", "Denmark",
"Saxon Rebels", "France", "Sweden", "Ottoman Turks"
}
}
);
// Great Northern War
CoalitionEraTracker.CoalitionsByEra.Add(
(1700, 1721),
new List<string[]>() {
new string[] {
"Lithuanian Crown", "Turks", "Sweden", "Poland/Pro-Swedish"
},
new string[] {
"Prussia", "Saxony", "Lithuanian Republic", "Poland/Pro-Russian",
"Denmark", "Russia"
}
}
);
// Seven Years War
CoalitionEraTracker.CoalitionsByEra.Add(
(1756, 1763),
new List<string[]>() {
new string[] { "Sweden", "Reichsarmee", "Russia", "France", "Austria"},
new string[] { "Britain", "Prussia", "Army of Observation" }
}
);
// American War of Independence
CoalitionEraTracker.CoalitionsByEra.Add(
(1775, 1783),
new List<string[]>() {
new string[] { "American", "French" }
}
);
// French Revolutionary & Napoleonic Wars
CoalitionEraTracker.CoalitionsByEra.Add(
(1792, 1815),
new List<string[]>() {
new string[] { "British", "Spanish", "Portuguese", "Prussian", "Austrian", "Russian", "Dutch" }
}
);
}
// Determine if both nations are in a coalition in the year of this scenario
foreach (var key in CoalitionEraTracker.CoalitionsByEra.Keys) {
if (year >= key.StartYear && year <= key.EndYear) {
List<string[]> coalitions = CoalitionEraTracker.CoalitionsByEra[key];
foreach (string[] coalition in coalitions) {
if (coalition.Contains(nation1) && coalition.Contains(nation2)) {
return true;
}
}
}
}
return false;
}
}
}