5dplomacy/MultiversalDiplomacy/Orders/SupportMoveOrder.cs

46 lines
1.3 KiB
C#
Raw Normal View History

2022-02-19 00:58:16 +00:00
using MultiversalDiplomacy.Model;
namespace MultiversalDiplomacy.Orders;
/// <summary>
/// An order for a unit to support another unit's move order.
/// </summary>
public class SupportMoveOrder : SupportOrder
2022-02-19 00:58:16 +00:00
{
/// <summary>
/// The destination season to which the target is moving.
/// </summary>
public Season Season { get; }
/// <summary>
/// The destination location to which the target is moving.
/// </summary>
public Location Location { get; }
/// <summary>
/// The destination province to which the target is moving.
/// </summary>
public Province Province => this.Location.Province;
/// <summary>
/// The target's destination's spatiotemporal location as a province-season tuple.
/// </summary>
public (Province province, Season season) Point => (this.Province, this.Season);
2024-08-15 14:30:43 +00:00
public SupportMoveOrder(string power, Unit unit, Unit target, Season season, Location location)
: base(power, unit, target)
2022-02-19 00:58:16 +00:00
{
this.Season = season;
this.Location = location;
}
2022-04-07 22:58:17 +00:00
public override string ToString()
{
return $"{this.Unit} S {this.Target} -> {(this.Province, this.Season).ToShort()}";
2022-04-07 22:58:17 +00:00
}
public bool IsSupportFor(MoveOrder move)
=> this.Target == move.Unit
2024-08-15 13:52:08 +00:00
&& this.Season.Key == move.Season
&& this.Location == move.Location;
2022-02-19 00:58:16 +00:00
}