/// <summary>Gets the regions that are enermies for the owner excluding neutral.</summary> public static IEnumerable <Region> GetRegionsForPlayerWithOpponents(this IEnumerable <Region> regions, PlayerType owner, MapState state) { return(regions.Where(region => state.HasOwner(region, owner) && region.Neighbors .Any(neighbor => !state.HasOwner(neighbor, owner)))); }
public static IEnumerable <SuperRegion> GetConquerables(this IEnumerable <SuperRegion> superregions, PlayerType player, MapState state) { return(superregions .Where(s => s.SelfAndNeighbors .Any(region => state.HasOwner(region, player)) && s.SelfAndNeighbors .Any(region => !state.HasOwner(region, player)))); }
/// <summary>Gets the regions that are enermies for the owner excluding neutral.</summary> public static IEnumerable <Region> GetRegionsForPlayerWithEnermies(this IEnumerable <Region> regions, PlayerType owner, MapState state) { return(regions.Where(region => state.HasOwner(region, owner) && region.Neighbors .Any(neighbor => state.Owner(neighbor) != PlayerType.neutral && !state.HasOwner(neighbor, owner)))); }
/// <summary>Returns true if all regions have the specified owener.</summary> public static bool HaveOwner(this IEnumerable <Region> regions, PlayerType owner, MapState state) { return(regions.All(region => state.HasOwner(region, owner))); }
/// <summary>Gets the region count that are opponents for the owner inlcuding neutral.</summary> public static int GetOpponentCountForPlayer(this IEnumerable <Region> regions, PlayerType owner, MapState state) { return(regions.Count(region => !state.HasOwner(region, owner))); }
/// <summary>Gets the regions that are enermies for the owner excluding neutral.</summary> public static IEnumerable <Region> GetEnemriesForPlayer(this IEnumerable <Region> regions, PlayerType owner, MapState state) { return(regions.Where(region => state.Owner(region) != PlayerType.neutral && !state.HasOwner(region, owner))); }
/// <summary>Gets the regions that are opponents for the owner inlcuding neutral.</summary> public static IEnumerable <Region> GetOpponentsForPlayer(this IEnumerable <Region> regions, PlayerType owner, MapState state) { return(regions.Where(region => !state.HasOwner(region, owner))); }
/// <summary>Gets the super region bonus for a player excluding the default stack.</summary> public int GetSuperRegionBonus(PlayerType player, MapState state) { return(this.SuperRegions .Where(super => super.All(region => state.HasOwner(region, player))) .Sum(super => super.BonusArmiesReward)); }