5dplomacy/MultiversalDiplomacy/Model/World.cs

759 lines
30 KiB
C#
Raw Normal View History

using System.Collections.ObjectModel;
using MultiversalDiplomacy.Orders;
namespace MultiversalDiplomacy.Model;
/// <summary>
/// The global game state.
/// </summary>
public class World
{
/// <summary>
/// The game map.
/// </summary>
public ReadOnlyCollection<Province> Provinces { get; }
/// <summary>
/// The game powers.
/// </summary>
public ReadOnlyCollection<Power> Powers { get; }
/// <summary>
/// The state of the multiverse.
/// </summary>
public ReadOnlyCollection<Season> Seasons { get; }
/// <summary>
/// The first season of the game.
/// </summary>
public Season RootSeason { get; }
/// <summary>
/// All units in the multiverse.
/// </summary>
public ReadOnlyCollection<Unit> Units { get; }
/// <summary>
/// All retreating units in the multiverse.
/// </summary>
public ReadOnlyCollection<RetreatingUnit> RetreatingUnits { get; }
/// <summary>
/// Orders given to units in each season.
/// </summary>
2022-11-09 00:25:47 +00:00
public ReadOnlyDictionary<Season, OrderHistory> OrderHistory { get; }
2022-03-13 07:15:26 +00:00
/// <summary>
/// Immutable game options.
/// </summary>
public Options Options { get; }
/// <summary>
/// Create a new World, providing all state data.
/// </summary>
private World(
ReadOnlyCollection<Province> provinces,
ReadOnlyCollection<Power> powers,
ReadOnlyCollection<Season> seasons,
Season rootSeason,
ReadOnlyCollection<Unit> units,
ReadOnlyCollection<RetreatingUnit> retreatingUnits,
2022-11-09 00:25:47 +00:00
ReadOnlyDictionary<Season, OrderHistory> orderHistory,
2022-03-13 07:15:26 +00:00
Options options)
{
this.Provinces = provinces;
this.Powers = powers;
this.Seasons = seasons;
this.RootSeason = rootSeason;
this.Units = units;
this.RetreatingUnits = retreatingUnits;
2022-11-09 00:25:47 +00:00
this.OrderHistory = orderHistory;
2022-03-13 07:15:26 +00:00
this.Options = options;
}
/// <summary>
/// Create a new World from a previous one, replacing some state data.
/// </summary>
private World(
World previous,
ReadOnlyCollection<Province>? provinces = null,
ReadOnlyCollection<Power>? powers = null,
ReadOnlyCollection<Season>? seasons = null,
ReadOnlyCollection<Unit>? units = null,
ReadOnlyCollection<RetreatingUnit>? retreatingUnits = null,
2022-11-09 00:25:47 +00:00
ReadOnlyDictionary<Season, OrderHistory>? orderHistory = null,
Options? options = null)
: this(
provinces ?? previous.Provinces,
powers ?? previous.Powers,
seasons ?? previous.Seasons,
previous.RootSeason, // Can't change the root season
units ?? previous.Units,
retreatingUnits ?? previous.RetreatingUnits,
2022-11-09 00:25:47 +00:00
orderHistory ?? previous.OrderHistory,
options ?? previous.Options)
{
}
/// <summary>
/// Create a new world with specified provinces and powers and an initial season.
2022-03-13 07:15:26 +00:00
/// </summary>
public static World WithMap(IEnumerable<Province> provinces, IEnumerable<Power> powers)
{
Season root = Season.MakeRoot();
return new World(
new(provinces.ToList()),
new(powers.ToList()),
new(new List<Season> { root }),
root,
new(new List<Unit>()),
new(new List<RetreatingUnit>()),
2022-11-09 00:25:47 +00:00
new(new Dictionary<Season, OrderHistory>()),
new Options());
}
/// <summary>
/// Create a new world with the standard Diplomacy provinces and powers.
/// </summary>
public static World WithStandardMap()
=> WithMap(StandardProvinces, StandardPowers);
public World Update(
IEnumerable<Season>? seasons = null,
IEnumerable<Unit>? units = null,
IEnumerable<RetreatingUnit>? retreats = null,
2022-11-09 00:25:47 +00:00
IEnumerable<KeyValuePair<Season, OrderHistory>>? orders = null)
=> new World(
previous: this,
seasons: seasons == null
? this.Seasons
: new(seasons.ToList()),
units: units == null
? this.Units
: new(units.ToList()),
retreatingUnits: retreats == null
? this.RetreatingUnits
: new(retreats.ToList()),
2022-11-09 00:25:47 +00:00
orderHistory: orders == null
? this.OrderHistory
: new(orders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value)));
/// <summary>
/// Create a new world with new units created from unit specs. Units specs are in the format
/// "<power> <A/F> <province> [<coast>]". If the province or coast name has a space in it, the
/// abbreviation should be used. Unit specs always describe units in the root season.
/// </summary>
public World AddUnits(params string[] unitSpecs)
{
IEnumerable<Unit> units = unitSpecs.Select(spec =>
{
string[] splits = spec.Split(' ', 4);
Power power = this.GetPower(splits[0]);
UnitType type = splits[1] switch
{
"A" => UnitType.Army,
"F" => UnitType.Fleet,
2022-03-23 04:27:06 +00:00
_ => throw new ApplicationException($"Unknown unit type {splits[1]}")
};
Location location = type == UnitType.Army
? this.GetLand(splits[2])
: splits.Length == 3
? this.GetWater(splits[2])
: this.GetWater(splits[2], splits[3]);
Unit unit = Unit.Build(location, this.RootSeason, power, type);
return unit;
});
return this.Update(units: units);
}
/// <summary>
/// Create a new world with standard Diplomacy initial unit placements.
/// </summary>
public World AddStandardUnits()
{
return this.AddUnits(
"Austria A Bud",
"Austria A Vir",
"Austria F Tri",
"England A Lvp",
"England F Edi",
"England F Lon",
"France A Mar",
"France A Par",
"France F Bre",
"Germany A Ber",
"Germany A Mun",
"Germany F Kie",
"Italy A Rom",
"Italy A Ven",
"Italy F Nap",
"Russia A Mos",
"Russia A War",
"Russia F Sev",
"Russia F Stp wc",
"Turkey A Con",
"Turkey A Smy",
"Turkey F Ank"
);
}
2022-03-13 07:15:26 +00:00
/// <summary>
/// A standard Diplomacy game setup.
2022-03-13 07:15:26 +00:00
/// </summary>
public static World Standard => World
2022-03-13 07:15:26 +00:00
.WithStandardMap()
.AddStandardUnits();
2022-03-13 07:15:26 +00:00
/// <summary>
/// Get a province by name. Throws if the province is not found.
/// </summary>
private Province GetProvince(string provinceName)
2022-03-23 04:27:06 +00:00
=> GetProvince(provinceName, this.Provinces);
/// <summary>
/// Get a province by name. Throws if the province is not found.
/// </summary>
private static Province GetProvince(string provinceName, IEnumerable<Province> provinces)
2022-03-13 07:15:26 +00:00
{
string provinceNameUpper = provinceName.ToUpperInvariant();
2022-03-23 04:27:06 +00:00
Province? foundProvince = provinces.SingleOrDefault(
p => p!.Name.ToUpperInvariant() == provinceNameUpper
|| p.Abbreviations.Any(a => a.ToUpperInvariant() == provinceNameUpper),
2022-03-13 07:15:26 +00:00
null);
2022-03-23 04:27:06 +00:00
if (foundProvince == null) throw new KeyNotFoundException(
2022-03-13 07:15:26 +00:00
$"Province {provinceName} not found");
return foundProvince;
}
/// <summary>
/// Get the location in a province matching a predicate. Throws if there is not exactly one
/// such location.
/// </summary>
private Location GetLocation(string provinceName, Func<Location, bool> predicate)
{
Location? foundLocation = GetProvince(provinceName).Locations.SingleOrDefault(
l => l != null && predicate(l), null);
2022-03-23 04:27:06 +00:00
if (foundLocation == null) throw new KeyNotFoundException(
2022-03-13 07:15:26 +00:00
$"No such location in {provinceName}");
return foundLocation;
}
/// <summary>
/// Get the sole land location of a province.
/// </summary>
public Location GetLand(string provinceName)
=> GetLocation(provinceName, l => l.Type == LocationType.Land);
/// <summary>
/// Get the sole water location of a province, optionally specifying a named coast.
/// </summary>
public Location GetWater(string provinceName, string? coastName = null)
=> coastName == null
? GetLocation(provinceName, l => l.Type == LocationType.Water)
: GetLocation(provinceName, l => l.Name == coastName || l.Abbreviation == coastName);
2022-03-30 00:16:00 +00:00
/// <summary>
/// Get a season by coordinate. Throws if the season is not found.
/// </summary>
2022-11-10 18:11:44 +00:00
public Season GetSeason(Turn turn, int timeline)
2022-03-30 00:16:00 +00:00
{
Season? foundSeason = this.Seasons.SingleOrDefault(
s => s!.Turn == turn && s.Timeline == timeline,
2022-03-30 00:16:00 +00:00
null);
if (foundSeason == null) throw new KeyNotFoundException(
$"Season {turn}:{timeline} not found");
return foundSeason;
}
2022-03-13 07:15:26 +00:00
/// <summary>
/// Get a power by name. Throws if there is not exactly one such power.
2022-03-13 07:15:26 +00:00
/// </summary>
public Power GetPower(string powerName)
{
Power? foundPower = this.Powers.SingleOrDefault(
p => p!.Name == powerName || p.Name.StartsWith(powerName),
2022-03-13 07:15:26 +00:00
null);
2022-03-23 04:27:06 +00:00
if (foundPower == null) throw new KeyNotFoundException(
2022-03-13 07:15:26 +00:00
$"Power {powerName} not found");
return foundPower;
}
/// <summary>
2022-03-30 00:16:00 +00:00
/// Returns a unit in a province. Throws if there are duplicate units.
2022-03-13 07:15:26 +00:00
/// </summary>
2022-11-10 18:11:44 +00:00
public Unit GetUnitAt(string provinceName, (Turn turn, int timeline)? seasonCoord = null)
2022-03-13 07:15:26 +00:00
{
Province province = GetProvince(provinceName);
2022-03-30 00:16:00 +00:00
seasonCoord ??= (this.RootSeason.Turn, this.RootSeason.Timeline);
Season season = GetSeason(seasonCoord.Value.turn, seasonCoord.Value.timeline);
Unit? foundUnit = this.Units.SingleOrDefault(
u => u!.Province == province && u.Season == season,
null);
2022-03-30 00:16:00 +00:00
if (foundUnit == null) throw new KeyNotFoundException(
$"Unit at {province} at {season} not found");
return foundUnit;
2022-03-13 07:15:26 +00:00
}
/// <summary>
/// The standard Diplomacy provinces.
2022-03-13 07:15:26 +00:00
/// </summary>
public static ReadOnlyCollection<Province> StandardProvinces
2022-03-13 07:15:26 +00:00
{
get
2022-03-13 07:15:26 +00:00
{
// Define the provinces of the standard world map.
List<Province> standardProvinces = new List<Province>
2022-03-13 07:15:26 +00:00
{
Province.Empty("North Africa", "NAF")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Tunis", "TUN")
.AddLandLocation()
.AddCoastLocation(),
Province.Empty("Bohemia", "BOH")
.AddLandLocation(),
Province.Supply("Budapest", "BUD")
.AddLandLocation(),
Province.Empty("Galacia", "GAL")
.AddLandLocation(),
Province.Supply("Trieste", "TRI")
.AddLandLocation()
.AddCoastLocation(),
Province.Empty("Tyrolia", "TYR")
.AddLandLocation(),
Province.Time("Vienna", "VIE")
.AddLandLocation(),
Province.Empty("Albania", "ALB")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Bulgaria", "BUL")
.AddLandLocation()
.AddCoastLocation("east coast", "ec")
.AddCoastLocation("south coast", "sc"),
Province.Supply("Greece", "GRE")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Rumania", "RUM", "RMA")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Serbia", "SER")
.AddLandLocation(),
Province.Empty("Clyde", "CLY")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Edinburgh", "EDI")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Liverpool", "LVP", "LPL")
.AddLandLocation()
.AddCoastLocation(),
Province.Time("London", "LON")
.AddLandLocation()
.AddCoastLocation(),
Province.Empty("Wales", "WAL")
.AddLandLocation()
.AddCoastLocation(),
Province.Empty("Yorkshire", "YOR")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Brest", "BRE")
.AddLandLocation()
.AddCoastLocation(),
Province.Empty("Burgundy", "BUR")
.AddLandLocation(),
Province.Empty("Gascony", "GAS")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Marseilles", "MAR")
.AddLandLocation()
.AddCoastLocation(),
Province.Time("Paris", "PAR")
.AddLandLocation(),
Province.Empty("Picardy", "PIC")
.AddLandLocation()
.AddCoastLocation(),
Province.Time("Berlin", "BER")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Kiel", "KIE")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Munich", "MUN")
.AddLandLocation(),
Province.Empty("Prussia", "PRU")
.AddLandLocation()
.AddCoastLocation(),
Province.Empty("Ruhr", "RUH", "RHR")
.AddLandLocation(),
Province.Empty("Silesia", "SIL")
.AddLandLocation(),
Province.Supply("Spain", "SPA")
.AddLandLocation()
.AddCoastLocation("north coast", "nc")
.AddCoastLocation("south coast", "sc"),
Province.Supply("Portugal", "POR")
.AddLandLocation()
.AddCoastLocation(),
Province.Empty("Apulia", "APU")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Naples", "NAP")
.AddLandLocation()
.AddCoastLocation(),
Province.Empty("Piedmont", "PIE")
.AddLandLocation()
.AddCoastLocation(),
Province.Time("Rome", "ROM", "RME")
.AddLandLocation()
.AddCoastLocation(),
Province.Empty("Tuscany", "TUS")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Venice", "VEN")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Belgium", "BEL")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Holland", "HOL")
.AddLandLocation()
.AddCoastLocation(),
Province.Empty("Finland", "FIN")
.AddLandLocation()
.AddCoastLocation(),
Province.Empty("Livonia", "LVN", "LVA")
.AddLandLocation()
.AddCoastLocation(),
Province.Time("Moscow", "MOS")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Sevastopol", "SEV")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Saint Petersburg", "STP")
.AddLandLocation()
.AddCoastLocation("north coast", "nc")
.AddCoastLocation("west coast", "wc"),
Province.Empty("Ukraine", "UKR")
.AddLandLocation(),
Province.Supply("Warsaw", "WAR")
.AddLandLocation(),
Province.Supply("Denmark", "DEN")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Norway", "NWY")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Sweden", "SWE")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Ankara", "ANK")
.AddLandLocation()
.AddCoastLocation(),
Province.Empty("Armenia", "ARM")
.AddLandLocation()
.AddCoastLocation(),
Province.Time("Constantinople", "CON")
.AddLandLocation()
.AddCoastLocation(),
Province.Supply("Smyrna", "SMY")
.AddLandLocation()
.AddCoastLocation(),
Province.Empty("Syria", "SYR")
.AddLandLocation()
.AddCoastLocation(),
Province.Empty("Barents Sea", "BAR")
.AddOceanLocation(),
Province.Empty("English Channel", "ENC", "ECH")
.AddOceanLocation(),
Province.Empty("Heligoland Bight", "HEL", "HGB")
.AddOceanLocation(),
Province.Empty("Irish Sea", "IRS", "IRI")
.AddOceanLocation(),
Province.Empty("Mid-Atlantic Ocean", "MAO", "MID")
.AddOceanLocation(),
Province.Empty("North Atlantic Ocean", "NAO", "NAT")
.AddOceanLocation(),
Province.Empty("North Sea", "NTH", "NTS")
.AddOceanLocation(),
Province.Empty("Norwegian Sea", "NWS", "NWG")
.AddOceanLocation(),
Province.Empty("Skagerrak", "SKA", "SKG")
.AddOceanLocation(),
Province.Empty("Baltic Sea", "BAL")
.AddOceanLocation(),
Province.Empty("Guld of Bothnia", "GOB", "BOT")
.AddOceanLocation(),
Province.Empty("Adriatic Sea", "ADS", "ADR")
.AddOceanLocation(),
Province.Empty("Aegean Sea", "AEG")
.AddOceanLocation(),
Province.Empty("Black Sea", "BLA")
.AddOceanLocation(),
Province.Empty("Eastern Mediterranean Sea", "EMS", "EAS")
.AddOceanLocation(),
Province.Empty("Gulf of Lyons", "GOL", "LYO")
.AddOceanLocation(),
Province.Empty("Ionian Sea", "IOS", "ION", "INS")
.AddOceanLocation(),
Province.Empty("Tyrrhenian Sea", "TYS", "TYN")
.AddOceanLocation(),
Province.Empty("Western Mediterranean Sea", "WMS", "WES")
.AddOceanLocation(),
2022-03-13 07:15:26 +00:00
};
// Declare some helpers for border definitions
2022-03-23 04:27:06 +00:00
Location Land(string provinceName) => GetProvince(provinceName, standardProvinces)
.Locations.Single(l => l.Type == LocationType.Land);
2022-03-23 04:27:06 +00:00
Location Water(string provinceName) => GetProvince(provinceName, standardProvinces)
.Locations.Single(l => l.Type == LocationType.Water);
2022-03-23 04:27:06 +00:00
Location Coast(string provinceName, string coastName)
=> GetProvince(provinceName, standardProvinces)
.Locations.Single(l => l.Name == coastName || l.Abbreviation == coastName);
2022-03-23 18:17:02 +00:00
static void AddBordersTo(Location location, Func<string, Location> LocationType, params string[] borders)
{
foreach (string bordering in borders)
{
location.AddBorder(LocationType(bordering));
}
}
void AddBorders(string provinceName, Func<string, Location> LocationType, params string[] borders)
=> AddBordersTo(LocationType(provinceName), LocationType, borders);
AddBorders("NAF", Land, "TUN");
AddBorders("NAF", Water, "MAO", "WES", "TUN");
AddBorders("TUN", Land, "NAF");
AddBorders("TUN", Water, "NAF", "WES", "TYS", "ION");
AddBorders("BOH", Land, "MUN", "SIL", "GAL", "VIE", "TYR");
AddBorders("BUD", Land, "VIE", "GAL", "RUM", "SER", "TRI");
AddBorders("GAL", Land, "BOH", "SIL", "WAR", "UKR", "RUM", "BUD", "VIE");
AddBorders("TRI", Land, "TYR", "VIE", "BUD", "SER", "ALB");
AddBorders("TRI", Water, "ALB", "ADR", "VEN");
AddBorders("TYR", Land, "MUN", "BOH", "VIE", "TRI", "VEN", "PIE");
AddBorders("VIE", Land, "TYR", "BOH", "GAL", "BUD", "TRI");
AddBorders("ALB", Land, "TRI", "SER", "GRE");
AddBorders("ALB", Water, "TRI", "ADR", "ION", "GRE");
AddBorders("BUL", Land, "GRE", "SER", "RUM", "CON");
AddBordersTo(Coast("BUL", "ec"), Water, "BLA", "CON");
AddBordersTo(Coast("BUL", "sc"), Water, "CON", "AEG", "GRE");
AddBorders("GRE", Land, "ALB", "SER", "BUL");
AddBorders("GRE", Water, "ALB", "ION", "AEG");
Water("GRE").AddBorder(Coast("BUL", "sc"));
2022-03-23 18:17:02 +00:00
AddBorders("RUM", Land, "BUL", "SER", "BUD", "GAL", "UKR", "SEV");
AddBorders("RUM", Water, "SEV", "BLA");
Water("RUM").AddBorder(Coast("BUL", "ec"));
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("SER", Land, "BUD", "RUM", "BUL", "GRE", "ALB", "TRI");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("CLY", Land, "EDI", "LVP");
AddBorders("CLY", Water, "LVP", "NAO", "NWG", "EDI");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("EDI", Land, "YOR", "LVP", "CLY");
AddBorders("EDI", Water, "CLY", "NWG", "NTH", "YOR");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("LVP", Land, "CLY", "EDI", "YOR", "WAL");
AddBorders("LVP", Water, "WAL", "IRS", "NAO", "CLY");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("LON", Land, "WAL", "YOR");
AddBorders("LON", Water, "WAL", "ENC", "NTH", "YOR");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("WAL", Land, "LVP", "YOR", "LON");
AddBorders("WAL", Water, "LON", "ENC", "IRS", "LVP");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("YOR", Land, "LON", "WAL", "LVP", "EDI");
AddBorders("YOR", Water, "EDI", "NTH", "LON");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("BRE", Land, "PIC", "PAR", "GAS");
AddBorders("BRE", Water, "GAS", "MAO", "ENC", "PIC");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("BUR", Land, "BEL", "RUH", "MUN", "MAR", "GAS", "PAR", "PIC");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("GAS", Land, "BRE", "PAR", "BUR", "MAR", "SPA");
AddBorders("GAS", Water, "MAO", "BRE");
Water("GAS").AddBorder(Coast("SPA", "nc"));
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("MAR", Land, "SPA", "GAS", "BUR", "PIE");
AddBorders("MAR", Water, "LYO", "PIE");
Water("MAR").AddBorder(Coast("SPA", "sc"));
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("PAR", Land, "PIC", "BUR", "GAS", "BRE");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("PIC", Land, "BEL", "BUR", "PAR", "BRE");
AddBorders("PIC", Water, "BRE", "ENC", "BEL");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("BER", Land, "PRU", "SIL", "MUN", "KIE");
AddBorders("BER", Water, "KIE", "BAL", "PRU");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("KIE", Land, "BER", "MUN", "RUH", "HOL", "DEN");
AddBorders("KIE", Water, "HOL", "HEL", "DEN", "BAL", "BER");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("MUN", Land, "BUR", "RUH", "KIE", "BER", "SIL", "BOH", "TYR");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("PRU", Land, "LVN", "WAR", "SIL", "BER");
AddBorders("PRU", Water, "BER", "BAL", "LVN");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("RUH", Land, "KIE", "MUN", "BUR", "BEL", "HOL");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("SIL", Land, "PRU", "WAR", "GAL", "BOH", "MUN", "BER");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("SPA", Land, "POR", "GAS", "MAR");
AddBordersTo(Coast("SPA", "nc"), Water, "POR", "MAO", "GAS");
AddBordersTo(Coast("SPA", "sc"), Water, "POR", "MAO", "WES", "LYO", "MAR");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("POR", Land, "SPA");
AddBorders("POR", Water, "MAO");
Water("POR").AddBorder(Coast("SPA", "nc"));
Water("POR").AddBorder(Coast("SPA", "sc"));
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("APU", Land, "NAP", "ROM", "VEN");
AddBorders("APU", Water, "VEN", "ADR", "IOS", "NAP");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("NAP", Land, "ROM", "APU");
AddBorders("NAP", Water, "APU", "IOS", "TYS", "ROM");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("PIE", Land, "MAR", "TYR", "VEN", "TUS");
AddBorders("PIE", Water, "TUS", "LYO", "MAR");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("ROM", Land, "TUS", "VEN", "APU", "NAP");
AddBorders("ROM", Water, "NAP", "TYS", "TUS");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("TUS", Land, "PIE", "VEN", "ROM");
AddBorders("TUS", Water, "ROM", "TYS", "LYO", "PIE");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("VEN", Land, "APU", "ROM", "TUS", "PIE", "TYR", "TRI");
AddBorders("VEN", Water, "TRI", "ADR", "APU");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("BEL", Land, "HOL", "RUH", "BUR", "PIC");
AddBorders("BEL", Water, "PIC", "ENC", "NTH", "HOL");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("HOL", Land, "BEL", "RUH", "KIE");
AddBorders("HOL", Water, "NTH", "HEL");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("FIN", Land, "SWE", "NWY", "STP");
AddBorders("FIN", Water, "SWE", "BOT");
Water("FIN").AddBorder(Coast("STP", "wc"));
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("LVN", Land, "STP", "MOS", "WAR", "PRU");
AddBorders("LVN", Water, "PRU", "BAL", "BOT");
Water("LVN").AddBorder(Coast("STP", "wc"));
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("MOS", Land, "SEV", "UKR", "WAR", "LVN", "STP");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("SEV", Land, "RUM", "UKR", "MOS", "ARM");
AddBorders("SEV", Water, "ARM", "BLA", "RUM");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("STP", Land, "MOS", "LVN", "FIN");
AddBordersTo(Coast("STP", "nc"), Water, "BAR", "NWY");
AddBordersTo(Coast("STP", "wc"), Water, "LVN", "BOT", "FIN");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("UKR", Land, "MOS", "SEV", "RUM", "GAL", "WAR");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("WAR", Land, "PRU", "LVN", "MOS", "UKR", "GAL", "SIL");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("DEN", Land, "KIE", "SWE");
AddBorders("DEN", Water, "KIE", "HEL", "NTH", "SKA", "BAL", "SWE");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("NWY", Land, "STP", "FIN", "SWE");
AddBorders("NWY", Water, "BAR", "NWG", "NTH", "SKA", "SWE");
Water("NWY").AddBorder(Coast("STP", "nc"));
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("SWE", Land, "NWY", "FIN", "DEN");
AddBorders("SWE", Water, "FIN", "BOT", "BAL", "DEN", "SKA", "NWY");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("ANK", Land, "ARM", "SMY", "CON");
AddBorders("ANK", Water, "CON", "BLA", "ARM");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("ARM", Land, "SEV", "SYR", "SMY", "ANK");
AddBorders("ARM", Water, "ANK", "BLA", "SEV");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("CON", Land, "BUL", "ANK", "SMY");
AddBorders("CON", Water, "BLA", "ANK", "SMY", "AEG");
Water("CON").AddBorder(Coast("BUL", "ec"));
Water("CON").AddBorder(Coast("BUL", "sc"));
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("SMY", Land, "CON", "ANK", "ARM", "SYR");
AddBorders("SMY", Water, "SYR", "EAS", "AEG", "CON");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("SYR", Land, "SMY", "ARM");
AddBorders("SYR", Water, "EAS", "SMY");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("BAR", Water, "NWG", "NWY");
Water("BAR").AddBorder(Coast("STP", "nc"));
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("ENC", Water, "LON", "NTH", "BEL", "PIC", "BRE", "MAO", "IRS", "WAL");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("HEL", Water, "NTH", "DEN", "BAL", "KIE", "HOL");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("IRS", Water, "NAO", "LVP", "WAL", "ENC", "MAO");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("MAO", Water, "NAO", "IRS", "ENC", "BRE", "GAS", "POR", "NAF");
Water("MAO").AddBorder(Coast("SPA", "nc"));
Water("MAO").AddBorder(Coast("SPA", "sc"));
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("NAO", Water, "NWG", "CLY", "LVP", "IRS", "MAO");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("NTH", Water, "NWG", "NWY", "SKA", "DEN", "HEL", "HOL", "BEL", "ENC", "LON", "YOR", "EDI");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("NWG", Water, "BAR", "NWY", "NTH", "EDI", "CLY", "NAO");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("SKA", Water, "NWY", "SWE", "BAL", "DEN", "NTH");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("BAL", Water, "BOT", "LVN", "PRU", "BER", "KIE", "HEL", "DEN", "SWE");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("BOT", Water, "LVN", "BAL", "SWE", "FIN");
Water("BOT").AddBorder(Coast("STP", "wc"));
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("ADR", Water, "IOS", "APU", "VEN", "TRI", "ALB");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("AEG", Water, "CON", "SMY", "EAS", "IOS", "GRE");
Water("AEG").AddBorder(Coast("BUL", "sc"));
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("BLA", Water, "RUM", "SEV", "ARM", "ANK", "CON");
Water("BLA").AddBorder(Coast("BUL", "ec"));
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("EAS", Water, "IOS", "AEG", "SMY", "SYR");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("LYO", Water, "MAR", "PIE", "TUS", "TYS", "WES");
Water("LYO").AddBorder(Coast("SPA", "sc"));
2022-03-23 18:17:02 +00:00
AddBorders("IOS", Water, "TUN", "TYS", "NAP", "APU", "ADR", "ALB", "GRE", "AEG");
2022-03-23 18:17:02 +00:00
AddBorders("TYS", Water, "LYO", "TUS", "ROM", "NAP", "IOS", "TUN", "WES");
2022-03-23 04:27:06 +00:00
2022-03-23 18:17:02 +00:00
AddBorders("WES", Water, "LYO", "TYS", "TUN", "NAF", "MAO");
Water("WES").AddBorder(Coast("SPA", "sc"));
return new(standardProvinces);
}
}
2022-03-13 07:15:26 +00:00
/// <summary>
/// The standard Diplomacy powers.
2022-03-13 07:15:26 +00:00
/// </summary>
public static ReadOnlyCollection<Power> StandardPowers
2022-03-13 07:15:26 +00:00
{
get => new(new List<Power>
{
new Power("Austria"),
new Power("England"),
new Power("France"),
new Power("Germany"),
new Power("Italy"),
new Power("Russia"),
new Power("Turkey"),
});
}
}