Add better ToString overrides to decision classes

This commit is contained in:
Jaculabilis 2022-11-06 21:58:21 -08:00
parent 25d707b3b8
commit a565ee1b05
9 changed files with 26 additions and 5 deletions

View File

@ -8,6 +8,9 @@ public class AttackStrength : NumericAdjudicationDecision
public List<SupportMoveOrder> Supports { get; } public List<SupportMoveOrder> Supports { get; }
public MoveOrder? OpposingMove { get; } public MoveOrder? OpposingMove { get; }
public override string ToString()
=> $"AttackStrength({Order})";
public AttackStrength(MoveOrder order, IEnumerable<SupportMoveOrder> supports, MoveOrder? opposingMove = null) public AttackStrength(MoveOrder order, IEnumerable<SupportMoveOrder> supports, MoveOrder? opposingMove = null)
{ {
this.Order = order; this.Order = order;

View File

@ -6,11 +6,6 @@ public abstract class BinaryAdjudicationDecision : AdjudicationDecision
public override bool Resolved => this.Outcome != null; public override bool Resolved => this.Outcome != null;
public override string ToString()
{
return $"{this.GetType().Name}={this.Outcome}";
}
public bool Update(bool outcome) public bool Update(bool outcome)
{ {
if (this.Outcome == null) if (this.Outcome == null)

View File

@ -7,6 +7,9 @@ public class DefendStrength : NumericAdjudicationDecision
public MoveOrder Order { get; } public MoveOrder Order { get; }
public List<SupportMoveOrder> Supports { get; } public List<SupportMoveOrder> Supports { get; }
public override string ToString()
=> $"DefendStrength({Order})";
public DefendStrength(MoveOrder order, IEnumerable<SupportMoveOrder> supports) public DefendStrength(MoveOrder order, IEnumerable<SupportMoveOrder> supports)
{ {
this.Order = order; this.Order = order;

View File

@ -8,6 +8,9 @@ public class DoesMove : BinaryAdjudicationDecision
public MoveOrder? OpposingMove { get; } public MoveOrder? OpposingMove { get; }
public List<MoveOrder> Competing { get; } public List<MoveOrder> Competing { get; }
public override string ToString()
=> $"DoesMove({Order})";
public DoesMove(MoveOrder order, MoveOrder? opposingMove, IEnumerable<MoveOrder> competing) public DoesMove(MoveOrder order, MoveOrder? opposingMove, IEnumerable<MoveOrder> competing)
{ {
this.Order = order; this.Order = order;

View File

@ -7,6 +7,9 @@ public class GivesSupport : BinaryAdjudicationDecision
public SupportOrder Order { get; } public SupportOrder Order { get; }
public List<MoveOrder> Cuts { get; } public List<MoveOrder> Cuts { get; }
public override string ToString()
=> $"GivesSupport({Order})";
public GivesSupport(SupportOrder order, IEnumerable<MoveOrder> cuts) public GivesSupport(SupportOrder order, IEnumerable<MoveOrder> cuts)
{ {
this.Order = order; this.Order = order;

View File

@ -6,6 +6,9 @@ public class HasPath : BinaryAdjudicationDecision
{ {
public MoveOrder Order { get; } public MoveOrder Order { get; }
public override string ToString()
=> $"HasPath({Order})";
public HasPath(MoveOrder order) public HasPath(MoveOrder order)
{ {
this.Order = order; this.Order = order;

View File

@ -10,6 +10,11 @@ public class HoldStrength : NumericAdjudicationDecision
public UnitOrder? Order { get; } public UnitOrder? Order { get; }
public List<SupportHoldOrder> Supports { get; } public List<SupportHoldOrder> Supports { get; }
public override string ToString()
=> Order is null
? $"HoldStrength({Province.Abbreviations[0]})"
: $"HoldStrength({Order.Unit})";
public HoldStrength(Province province, Season season, UnitOrder? order = null) public HoldStrength(Province province, Season season, UnitOrder? order = null)
{ {
this.Province = province; this.Province = province;

View File

@ -7,6 +7,9 @@ public class IsDislodged : BinaryAdjudicationDecision
public UnitOrder Order { get; } public UnitOrder Order { get; }
public List<MoveOrder> Incoming { get; } public List<MoveOrder> Incoming { get; }
public override string ToString()
=> $"IsDislodged({Order.Unit})";
public IsDislodged(UnitOrder order, IEnumerable<MoveOrder> incoming) public IsDislodged(UnitOrder order, IEnumerable<MoveOrder> incoming)
{ {
this.Order = order; this.Order = order;

View File

@ -8,6 +8,9 @@ public class PreventStrength : NumericAdjudicationDecision
public List<SupportMoveOrder> Supports { get; } public List<SupportMoveOrder> Supports { get; }
public MoveOrder? OpposingMove { get; } public MoveOrder? OpposingMove { get; }
public override string ToString()
=> $"PreventStrength({Order})";
public PreventStrength(MoveOrder order, IEnumerable<SupportMoveOrder> supports, MoveOrder? opposingMove = null) public PreventStrength(MoveOrder order, IEnumerable<SupportMoveOrder> supports, MoveOrder? opposingMove = null)
{ {
this.Order = order; this.Order = order;