public static Path CalculatePathBetween(Game game, Tile startTile, Tile endTile, UnitGAS domain, int moveFactor, Civilization owner, bool alpine, bool ignoreZoc) { if (startTile.Z != endTile.Z || !endTile.Visibility[owner.Id]) { return(null); } switch (domain) { case UnitGAS.Ground when startTile.Island != endTile.Island && startTile.Neighbours().All(t => t.Island != endTile.Island): case UnitGAS.Sea when !OnCompatibleSea(startTile, endTile): return(null); } var rules = game.Rules; Func <Tile, Tile, int> costFunction = domain switch { UnitGAS.Ground => BuildGroundMovementFunction(rules.Cosmic, alpine, moveFactor), UnitGAS.Air => (source, dest) => rules.Cosmic.MovementMultiplier, UnitGAS.Sea => (source, dest) => dest == endTile || dest.Type == TerrainType.Ocean || (dest.CityHere is { } && dest.CityHere.OwnerId == owner.Id)
internal static bool IsNextToEnemy(Tile tile, Civilization civ, UnitGAS domain) { return(tile.Neighbours().Any(t => t.UnitsHere.Any(u => u.Owner != civ && u.InShip == null && u.Domain == domain))); }