diff --git a/server/Adjudication/Validation/AdjacencyValidator.cs b/server/Adjudication/Validation/AdjacencyValidator.cs index 80f1d13..9a4c746 100644 --- a/server/Adjudication/Validation/AdjacencyValidator.cs +++ b/server/Adjudication/Validation/AdjacencyValidator.cs @@ -69,27 +69,25 @@ public bool IsValidIntraBoardMove(Unit unit, Location location, Location destina if (allowDestinationSibling) { - if (destinationRegion.ParentId != null) - { - var destinationRegionSiblings = regions.Where(r => - r != destinationRegion - && r.ParentId == destinationRegion.ParentId); + var destinationRegionSiblings = regions.Where(r => + r != destinationRegion + && (destinationRegion.ParentId != null || r.ParentId != null) + && (r.ParentId == destinationRegion.ParentId || r.ParentId == destinationRegion.Id || r.Id == destinationRegion.ParentId)); - foreach (var siblingRegion in destinationRegionSiblings) + foreach (var siblingRegion in destinationRegionSiblings) + { + var sibling = new Location + { + Timeline = destination.Timeline, + Year = destination.Year, + Phase = destination.Phase, + RegionId = siblingRegion.Id, + }; + + var isValidMove = IsValidIntraBoardMove(unit, location, sibling, false, false); + if (isValidMove) { - var sibling = new Location - { - Timeline = destination.Timeline, - Year = destination.Year, - Phase = destination.Phase, - RegionId = siblingRegion.Id, - }; - - var isValidMove = IsValidIntraBoardMove(unit, location, sibling, false, false); - if (isValidMove) - { - return true; - } + return true; } } }