private static VariantOffer CheckBuildAndMoveNavy(Context context, PlayerInfoCM player, AIOptions options, int restOfGold) { VariantOfferPackage package = new VariantOfferPackage(); int restUnits = Math.Min(Constants.maxArmyCount - context.map.Navy.Where(e => e.OwnerID == player.ID).Count(), Constants.armyPrices.Count); if (restUnits < 1) return null; List<IslandCM> enemyNeibourIslands = Library.Map.GetEnemyNeibourIslands(context.map, player.ID, false); float maxNeedBridgeVP = 0; for (int i = 0; i < enemyNeibourIslands.Count; ++i) { IslandCM enemyIsland = enemyNeibourIslands[i]; float vp = Library.Map.GetIslandPriceVP(context.map, enemyIsland.ID, player.ID, options) * options.coefficients.BridgeToIslandPriceCoeff; if (vp > maxNeedBridgeVP) maxNeedBridgeVP = vp; } if (maxNeedBridgeVP > 0) package.Add(new VariantOffer(0, maxNeedBridgeVP)); if (Library.Map.GetAccessibleSeaHorns(context.map, player.ID, false, false).Count > 0) package.Add(new VariantOffer(Constants.moveNavyCost + Constants.navyPrices[1], options.coefficients.HornVPT * options.turnsToEnd)); return package.GetSum(); }
protected override Enum TestImpl(Context context) { if (playerID != context.CurrentPlayerID) return TestResult.NotCurrentPlayer; player = context.players.GetPlayer(playerID); return TestImplContext(context); }
private static VariantOffer CheckNeedBuild(Context context, PlayerInfoCM player, AIOptions options, int restOfGold) { VariantOfferPackage package = new VariantOfferPackage(); package.Add(AuctionCommon.CheckNeedBuild(context, player, options, Build.Poseidon, restOfGold)); package.CheckAll(options); return package.GetAvg(); }
public static VariantOffer CheckNeedBuild(Context context, PlayerInfoCM player, AIOptions options, Build build, int restOfGold) { if (restOfGold < Cyclades.Constants.buildingCost) return null; if (!Library.Map.HasPlayerPlaceForBuilding(context.map, player.ID)) return null; bool isNeed = Library.Map.IsNeedBuild(context.map, player.ID, build); return new VariantOffer(Cyclades.Constants.buildingCost, (isNeed ? options.coefficients.NeedBuildVP : options.coefficients.NotNeedBuildVP)); }
internal PlayerInfoCM AddPlayer() { PlayerInfoCM player = new PlayerInfoCM(); player.ID = PlayersCount; Players.Add(player); if (OnAddPlayer != null) OnAddPlayer(); return player; }
private static VariantOffer CheckNeedBuild(Context context, PlayerInfoCM player, AIOptions options, int restOfGold) { VariantOfferPackage package = new VariantOfferPackage(); package.Add(AuctionCommon.CheckNeedBuild(context, player, options, Build.Zeus, restOfGold)); if (restOfGold >= Cyclades.Constants.buildingCost) package.Add(new VariantOffer(Cyclades.Constants.buildingCost, options.coefficients.TempleVPT * options.turnsToEnd)); package.CheckAll(options); return package.GetAvg(); }
public static void AddVariant(AIVariantPackage variants, Context context, PlayerInfoCM player, AIOptions options) { AuctionCM.Bet maxBet = context.auction.GetMaxBetForGod(God.Appolon); int bet = (maxBet == null ? 1 : maxBet.bet + 1); AIAuctionVariant variant = new AIAuctionVariant(God.Appolon, bet); float vp = 0f; vp += options.coefficients.GoldVP * (context.map.GetIslandsByOwner(player.ID).Count > 1 ? Constants.apolloSmallIncome : Constants.apolloBigIncome); if (bet == 1) vp += options.coefficients.HornVPT * options.turnsToEnd; variant.offer = new VariantOffer(0, vp); variants.AddVariant(variant); }
protected bool CheckGodVariant(God god, AIVariantPackage variants, Context context, PlayerInfoCM player, AIOptions options, out int minBetGold) { minBetGold = 0; if (!context.auction.GodsOrder.Contains(god)) return false; if (!context.auction.GodPossibleToBet(player.ID, god)) return false; AuctionCM.Bet maxBet = context.auction.GetMaxBetForGod(god); minBetGold = AuctionCM.GoldForBet(player, (maxBet == null ? 1 : maxBet.bet + 1)); if (minBetGold > player.Gold) return false; return true; }
public static void AddVariant(AIVariantPackage variants, Context context, PlayerInfoCM player, AIOptions options, int minBetGold) { AIAuctionVariant variant = new AIAuctionVariant(God.Poseidon, minBetGold + player.Priests); int restOfGold = player.Gold - minBetGold; VariantOfferPackage offers = new VariantOfferPackage(); offers.Add(CheckNeedBuild(context, player, options, restOfGold)); offers.Add(CheckBuildAndMoveNavy(context, player, options, restOfGold)); offers.CheckAll(options); VariantOffer offer = offers.GetTheBestSumWithCostLimit(restOfGold); offer.cost += minBetGold; variant.offer = offer; variants.AddVariant(variant); }
private static VariantOffer CheckPhilosopher(Context context, PlayerInfoCM player, AIOptions options, int restOfGold) { VariantOfferPackage package = new VariantOfferPackage(); for (int i = 0; i < Cyclades.Constants.philosopherPrices.Count; ++i) { int cost = Cyclades.Constants.philosopherPrices[i]; if (cost > restOfGold) break; package.Add(new VariantOffer(cost, options.coefficients.PhilosopherVP)); restOfGold -= cost; } package.CheckAll(options); return package.GetSum(); }
public static int GoldForBet(PlayerInfoCM player, int bet) { return Math.Max(bet - player.Priests, 1); }