Add ToString overrides for orders

This commit is contained in:
Jaculabilis 2022-04-07 15:58:17 -07:00
parent 5e74ffc19f
commit 105c372779
5 changed files with 25 additions and 0 deletions

View File

@ -34,4 +34,9 @@ public class ConvoyOrder : UnitOrder
this.Season = season; this.Season = season;
this.Location = location; this.Location = location;
} }
public override string ToString()
{
return $"{this.Unit} convoys {this.Target} -> {this.Province} {this.Season}";
}
} }

View File

@ -9,4 +9,9 @@ public class HoldOrder : UnitOrder
{ {
public HoldOrder(Power power, Unit unit) public HoldOrder(Power power, Unit unit)
: base (power, unit) {} : base (power, unit) {}
public override string ToString()
{
return $"{this.Unit} holds";
}
} }

View File

@ -34,6 +34,11 @@ public class MoveOrder : UnitOrder
this.Location = location; this.Location = location;
} }
public override string ToString()
{
return $"{this.Unit} -> {this.Province} {this.Season}";
}
/// <summary> /// <summary>
/// Returns whether another move order is in a head-to-head battle with this order. /// Returns whether another move order is in a head-to-head battle with this order.
/// </summary> /// </summary>

View File

@ -11,4 +11,9 @@ public class SupportHoldOrder : SupportOrder
: base (power, unit, target) : base (power, unit, target)
{ {
} }
public override string ToString()
{
return $"{this.Unit} supports {this.Target}";
}
} }

View File

@ -34,6 +34,11 @@ public class SupportMoveOrder : SupportOrder
this.Location = location; this.Location = location;
} }
public override string ToString()
{
return $"{this.Unit} supports {this.Target} -> {this.Province} {this.Season}";
}
public bool IsSupportFor(MoveOrder move) public bool IsSupportFor(MoveOrder move)
=> this.Target == move.Unit => this.Target == move.Unit
&& this.Season == move.Season && this.Season == move.Season