5dplomacy/MultiversalDiplomacy/Model/Season.cs

55 lines
1.6 KiB
C#
Raw Normal View History

2024-08-12 22:25:23 +00:00
using System.Text.Json.Serialization;
namespace MultiversalDiplomacy.Model;
/// <summary>
/// Represents a state of the map produced by a set of move orders on a previous season.
/// </summary>
public class Season
{
/// <summary>
/// The first turn number.
/// </summary>
public const int FIRST_TURN = 0;
/// <summary>
/// The designation of the season immediately preceding this season.
/// If this season is an alternate timeline root, the past is from the origin timeline.
/// The initial season does not have a past.
/// </summary>
2024-08-12 21:52:50 +00:00
public string? Past { get; }
/// <summary>
/// The current turn, beginning at 0. Each season (spring and fall) is one turn.
/// Phases that only occur after the fall phase occur when Turn % 2 == 1.
/// The current year is (Turn / 2) + 1901.
/// </summary>
public int Turn { get; }
/// <summary>
/// The timeline to which this season belongs.
/// </summary>
public string Timeline { get; }
2022-03-30 00:16:00 +00:00
/// <summary>
2024-08-12 22:25:23 +00:00
/// The multiversal designation of this season.
2022-03-30 00:16:00 +00:00
/// </summary>
2024-08-12 22:25:23 +00:00
[JsonIgnore]
public string Designation => $"{this.Timeline}{this.Turn}";
2022-03-30 00:16:00 +00:00
/// <summary>
2024-08-12 22:25:23 +00:00
/// The season's multiversal location as a timeline-turn tuple for convenience.
/// </summary>
2024-08-12 22:25:23 +00:00
[JsonIgnore]
public (string Timeline, int Turn) Coord => (this.Timeline, this.Turn);
public Season(string? past, int turn, string timeline)
{
2024-08-12 22:27:20 +00:00
this.Past = past;
this.Turn = turn;
this.Timeline = timeline;
}
2024-08-12 22:25:23 +00:00
public override string ToString() => Designation;
}