5dplomacy/MultiversalDiplomacy/Orders/MoveOrder.cs

46 lines
1.3 KiB
C#

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.
/// TODO replace this with timeline and turn individually so ToString can do the proper format
/// </summary>
public string Season { get; }
/// <summary>
/// The destination location to which the unit should move.
/// </summary>
public Location Location { get; }
/// <summary>
/// The destination province to which the unit should move.
/// </summary>
public Province Province => this.Location.Province;
public MoveOrder(Power power, Unit unit, string season, Location location)
: base (power, unit)
{
this.Season = season;
this.Location = location;
}
public override string ToString()
{
return $"{this.Unit} -> {this.Season} {this.Province}";
}
/// <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
&& this.Province == other.Province;
}