5dplomacy/MultiversalDiplomacy/Orders/MoveOrder.cs

40 lines
1.1 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 move to another province.
/// </summary>
public class MoveOrder : UnitOrder
{
/// <summary>
/// The destination season to which the unit should move.
/// </summary>
public Season Season { get; }
2022-02-19 00:58:16 +00:00
/// <summary>
/// The destination location to which the unit should move.
/// </summary>
public Location Location { get; }
public MoveOrder(string power, Unit unit, Season season, Location location)
2022-02-19 00:58:16 +00:00
: base (power, unit)
{
this.Season = season;
this.Location = location;
}
2022-04-07 22:58:17 +00:00
public override string ToString()
{
2024-08-16 04:48:41 +00:00
return $"{this.Unit} -> {Season.Timeline}-{Location.Province}@{Season.Turn}";
2022-04-07 22:58:17 +00:00
}
/// <summary>
/// Returns whether another move order has the same destination as this order.
/// </summary>
public bool IsCompeting(MoveOrder other)
=> this != other
&& this.Season == other.Season
2024-08-16 04:48:41 +00:00
&& this.Location.Province == other.Location.Province;
2022-02-19 00:58:16 +00:00
}