40 lines
1.1 KiB
C#
40 lines
1.1 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.
|
|
/// </summary>
|
|
public Season Season { get; }
|
|
|
|
/// <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)
|
|
: base (power, unit)
|
|
{
|
|
this.Season = season;
|
|
this.Location = location;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"{this.Unit} -> {Season.Timeline}-{Location.Province}@{Season.Turn}";
|
|
}
|
|
|
|
/// <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.Location.Province == other.Location.Province;
|
|
}
|