diff --git a/MultiversalDiplomacy/Adjudicate/Decision/MovementDecisions.cs b/MultiversalDiplomacy/Adjudicate/Decision/MovementDecisions.cs index 3e4db9b..d63d65a 100644 --- a/MultiversalDiplomacy/Adjudicate/Decision/MovementDecisions.cs +++ b/MultiversalDiplomacy/Adjudicate/Decision/MovementDecisions.cs @@ -8,7 +8,7 @@ public class MovementDecisions public Dictionary IsDislodged { get; } public Dictionary HasPath { get; } public Dictionary GivesSupport { get; } - public Dictionary<(Province, string), HoldStrength> HoldStrength { get; } + public Dictionary<(string, string), HoldStrength> HoldStrength { get; } public Dictionary AttackStrength { get; } public Dictionary DefendStrength { get; } public Dictionary PreventStrength { get; } @@ -91,10 +91,10 @@ public class MovementDecisions .Distinct() .ToList(); - (Province province, string season) UnitPoint(Unit unit) - => (world.Map.GetLocation(unit.Location).Province, unit.Season.Key); - (Province province, string season) MovePoint(MoveOrder move) - => (move.Province, move.Season.Key); + (string province, string season) UnitPoint(Unit unit) + => (world.Map.GetLocation(unit.Location).Province.Name, unit.Season.Key); + (string province, string season) MovePoint(MoveOrder move) + => (move.Location.Province.Name, move.Season.Key); // Create a hold strength decision with an associated order for every province with a unit. foreach (UnitOrder order in relevantOrders) @@ -108,13 +108,13 @@ public class MovementDecisions bool IsIncoming(UnitOrder me, MoveOrder other) => me != other && other.Season == me.Unit.Season - && other.Province == world.Map.GetLocation(me.Unit).Province; + && other.Location.Province.Name == world.Map.GetLocation(me.Unit).Province.Name; bool AreOpposing(MoveOrder one, MoveOrder two) => one.Season == two.Unit.Season && two.Season == one.Unit.Season - && one.Province == world.Map.GetLocation(two.Unit).Province - && two.Province == world.Map.GetLocation(one.Unit).Province; + && one.Location.Province.Name == world.Map.GetLocation(two.Unit).Province.Name + && two.Location.Province.Name == world.Map.GetLocation(one.Unit).Province.Name; // Create all other relevant decisions for each order in the affected timelines. foreach (UnitOrder order in relevantOrders) @@ -153,7 +153,7 @@ public class MovementDecisions DoesMove[move] = new(move, opposingMove, competing); // Ensure a hold strength decision exists for the destination. - HoldStrength.Ensure(MovePoint(move), () => new(move.Province, move.Season)); + HoldStrength.Ensure(MovePoint(move), () => new(move.Location.Province, move.Season)); } else if (order is SupportOrder support) { @@ -173,7 +173,7 @@ public class MovementDecisions { // Ensure a hold strength decision exists for the target's destination. HoldStrength.Ensure( - (supportMove.Province, supportMove.Season.Key), + (supportMove.Province.Name, supportMove.Season.Key), () => new(supportMove.Province, supportMove.Season)); } } diff --git a/MultiversalDiplomacy/Adjudicate/MovementPhaseAdjudicator.cs b/MultiversalDiplomacy/Adjudicate/MovementPhaseAdjudicator.cs index c221c22..74ac569 100644 --- a/MultiversalDiplomacy/Adjudicate/MovementPhaseAdjudicator.cs +++ b/MultiversalDiplomacy/Adjudicate/MovementPhaseAdjudicator.cs @@ -776,7 +776,7 @@ public class MovementPhaseAdjudicator : IPhaseAdjudicator // If there is a head to head battle, a unit at the destination that isn't moving away, or // a unit at the destination that will fail to move away, then the attacking unit will have // to dislodge it. - UnitOrder? destOrder = decisions.HoldStrength[(decision.Order.Province, decision.Order.Season.Key)].Order; + UnitOrder? destOrder = decisions.HoldStrength[(decision.Order.Location.Province.Name, decision.Order.Season.Key)].Order; DoesMove? destMoveAway = destOrder is MoveOrder moveAway ? decisions.DoesMove[moveAway] : null; @@ -955,7 +955,7 @@ public class MovementPhaseAdjudicator : IPhaseAdjudicator // strength. NumericAdjudicationDecision defense = decision.OpposingMove != null ? decisions.DefendStrength[decision.OpposingMove] - : decisions.HoldStrength[(decision.Order.Province, decision.Order.Season.Key)]; + : decisions.HoldStrength[(decision.Order.Location.Province.Name, decision.Order.Season.Key)]; progress |= ResolveDecision(defense, world, decisions, depth + 1); // If the attack doesn't beat the defense, resolve the move to false. diff --git a/MultiversalDiplomacy/Orders/MoveOrder.cs b/MultiversalDiplomacy/Orders/MoveOrder.cs index de5cec3..ebc75cf 100644 --- a/MultiversalDiplomacy/Orders/MoveOrder.cs +++ b/MultiversalDiplomacy/Orders/MoveOrder.cs @@ -17,11 +17,6 @@ public class MoveOrder : UnitOrder /// public Location Location { get; } - /// - /// The destination province to which the unit should move. - /// - public Province Province => this.Location.Province; - public MoveOrder(string power, Unit unit, Season season, Location location) : base (power, unit) { @@ -31,7 +26,7 @@ public class MoveOrder : UnitOrder public override string ToString() { - return $"{this.Unit} -> {Season.Timeline}-{Province}@{Season.Turn}"; + return $"{this.Unit} -> {Season.Timeline}-{Location.Province}@{Season.Turn}"; } /// @@ -40,5 +35,5 @@ public class MoveOrder : UnitOrder public bool IsCompeting(MoveOrder other) => this != other && this.Season == other.Season - && this.Province == other.Province; + && this.Location.Province == other.Location.Province; }