Skip to content

Commit

Permalink
Fix fleets supporting armies into territories with 2 coasts
Browse files Browse the repository at this point in the history
  • Loading branch information
penteract committed Oct 3, 2024
1 parent f043bfe commit 734ff8e
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions server/Adjudication/Validation/AdjacencyValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit 734ff8e

Please sign in to comment.