2022-11-04 00:32:39 +00:00
|
|
|
namespace MultiversalDiplomacy.Model;
|
|
|
|
|
|
|
|
public static class ModelExtensions
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Short representation of a <see cref="UnitType"/>.
|
|
|
|
/// </summary>
|
|
|
|
public static string ToShort(this UnitType unitType)
|
|
|
|
=> unitType switch
|
|
|
|
{
|
|
|
|
UnitType.Army => "A",
|
|
|
|
UnitType.Fleet => "F",
|
|
|
|
_ => throw new NotSupportedException($"Unknown unit type {unitType}"),
|
|
|
|
};
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Short representation of a multiversal location.
|
|
|
|
/// </summary>
|
|
|
|
public static string ToShort(this (Province province, Season season) coord)
|
|
|
|
{
|
|
|
|
return $"{coord.season.Timeline}-{coord.province.Abbreviations[0]}@{coord.season.Turn}";
|
|
|
|
}
|
2024-08-13 22:24:40 +00:00
|
|
|
|
|
|
|
public static World ContinueOrFork(this World world, Season season, out Season future)
|
|
|
|
{
|
|
|
|
future = world.ContinueOrFork(season);
|
|
|
|
return world.Update(seasons: world.Seasons.Append(future));
|
|
|
|
}
|
|
|
|
}
|