diff --git a/MultiversalDiplomacy/Adjudicate/MovementPhaseAdjudicator.cs b/MultiversalDiplomacy/Adjudicate/MovementPhaseAdjudicator.cs index 75bf374..0a3cfcc 100644 --- a/MultiversalDiplomacy/Adjudicate/MovementPhaseAdjudicator.cs +++ b/MultiversalDiplomacy/Adjudicate/MovementPhaseAdjudicator.cs @@ -194,6 +194,21 @@ public class MovementPhaseAdjudicator : IPhaseAdjudicator // unit can move to the destination. List supportMoveOrders = unitOrders.OfType().ToList(); + // Trivial check: armies cannot move to water and fleets cannot move to land. + AdjudicatorHelpers.InvalidateIfNotMatching( + order => (order.Target.Type == UnitType.Army && order.Location.Type == LocationType.Land) + || (order.Target.Type == UnitType.Fleet && order.Location.Type == LocationType.Water), + ValidationReason.IllegalDestinationType, + ref supportMoveOrders, + ref validationResults); + + // Trivial check: a unit cannot move to where it already is. + AdjudicatorHelpers.InvalidateIfNotMatching( + order => !(order.Location.Key == order.Target.Location && order.Season == order.Unit.Season), + ValidationReason.DestinationMatchesOrigin, + ref supportMoveOrders, + ref validationResults); + // Support-move orders are invalid if the unit supports a move to any location in its own // province. AdjudicatorHelpers.InvalidateIfNotMatching( diff --git a/MultiversalDiplomacyTests/Scripts/DATC/6.A.5.txt b/MultiversalDiplomacyTests/Scripts/DATC/6.A.5.txt index 807cffe..ce96511 100644 --- a/MultiversalDiplomacyTests/Scripts/DATC/6.A.5.txt +++ b/MultiversalDiplomacyTests/Scripts/DATC/6.A.5.txt @@ -1,9 +1,6 @@ # 6.A.5. TEST CASE, MOVE TO OWN SECTOR WITH CONVOY # Moving to the same sector is still illegal with convoy (2023 rulebook, page 7, "Note: An Army can move across water provinces from one coastal province to another..."). -# TODO convoy order parsing -#test:skip - unit England F North Sea unit England A Yorkshire unit England A Liverpool diff --git a/MultiversalDiplomacyTests/Scripts/DATC/6.A.7.txt b/MultiversalDiplomacyTests/Scripts/DATC/6.A.7.txt index 1ec1303..7660e18 100644 --- a/MultiversalDiplomacyTests/Scripts/DATC/6.A.7.txt +++ b/MultiversalDiplomacyTests/Scripts/DATC/6.A.7.txt @@ -1,9 +1,6 @@ # 6.A.7. TEST CASE, ONLY ARMIES CAN BE CONVOYED # A fleet cannot be convoyed. -# TODO convoy order parsing -#test:skip - unit England F London unit England F North Sea