// Victory Points returned from the number of wonderstages built from each neighbour including the player private static int GetVictoryAllWonders(Player p, Player east, Player west) { return p.getBoard().getStagesBuilt() + east.getBoard().getStagesBuilt() + west.getBoard().getStagesBuilt(); }
// Returns the number of coins awarded with the basis of Wonder stages built private static int GetCoinWonder(Player p, int amount) { return p.getBoard().getStagesBuilt() * amount; }
// Returns the total score of the player, with the card or no card public static int GetScore(Player p, Player east, Player west, string cardID) { // Score for victory is automatically computing the Victory points for // Blue cards, Wonder stages, int score = 0; int schoiceCount = 0; Dictionary<Score, int> oldScore = new Dictionary<Score, int>(); List<Card> played = new List<Card>(); foreach (KeyValuePair<Score, int> k in p.getScore()) oldScore[k.Key] = k.Value; foreach (string card in p.getPlayed()) played.Add(CardLibrary.getCard(card)); // Card isn't NULL - returns the score of the player with the hypothetical card in the players // Played card list if (cardID != null) { Card card = CardLibrary.getCard(cardID); if (!p.cardPlayed(cardID)) played.Add(card); } // Check Wonder board effects first // This way if a player has guildCopy, it will take into account that the scientist guild // card is added into the players played hand and counted for (int i = 0; i < p.getBoard().getStagesBuilt(); i++) { foreach (Effect e in p.getBoard().getSide().getStageEffects(i)) { if (e.type.Equals(Effect.TypeType.SCHOICE)) schoiceCount += 1; // Loop through Wonder Effects for the players // GUILD COPY - not finished else if (e.type.Equals(Effect.TypeType.GUILD)) { played.Add(GetGuildCopyCard(p, east, west)); } } // Foreach loop through Wondestage effects } // For loop through the stages // Looping through the player's played cards foreach (Card card in played) { // Looping through the effects of each Card for End Game purposes foreach (Effect e in card.effects) { // Victory Points if (e.type.Equals(Effect.TypeType.VICTORY)) { // FROM: NEIGHBORS // and BASIS: CardColour, Wonderstages, Defeat if (e.from != Effect.FromType.NONE && e.from.Equals(Effect.FromType.NEIGHBOURS)) { // Apply victory points awarded for each // Wonderstage neigboring cities own if (e.basis.Equals(Effect.BasisType.WONDER)) score += GetVictoryAllWonders(p, east, west); //Victory points given per neighbor's conlfict token else if (e.basis.Equals(Effect.BasisType.DEFEAT)) score += GetVictoryNeighboursConflict(east, west); // Victory points awarded per certain structure built by neighbours else score += GetVictoryNeighboursColour(east, west, cardType[e.basis], e.amount); } // FROM: PLAYER // BASIS: CardColour, Wonderstages, else if (e.from != Effect.FromType.NONE && e.from.Equals(Effect.FromType.PLAYER)) { if (e.basis.Equals(Effect.BasisType.WONDER)) score += p.getBoard().getStagesBuilt(); else score += GetVictoryColour(p, cardType[e.basis], e.amount); } // FROM: ALL // BASIS: Wonderstages else if (e.from != Effect.FromType.NONE && e.from.Equals(Effect.FromType.ALL)) score += GetVictoryAllWonders(p, east, west); } // End Victory Points // SCIENCE CHOICE else if (e.type.Equals(Effect.TypeType.SCHOICE)) schoiceCount += 1; } // End Effect Loop for Cards } // End Current Player's Card Loop for (int i = 0; i < p.getBoard().getStagesBuilt(); i++) { foreach (Effect e in p.getBoard().getSide().getStageEffects(i)) { if (e.type.Equals(Effect.TypeType.VICTORY)) score += e.amount; } } // Max Function, will add onto the max science value foreach (KeyValuePair<Score, int> k in GetBestScienceChoice(p, schoiceCount)) { oldScore[k.Key] += k.Value; } score += CalculateScience(oldScore[Score.GEAR], oldScore[Score.COMPASS], oldScore[Score.TABLET]); score += p.getScoreNum(Score.CONFLICT); score += GetTreasuryScore(p); return score; }
// Victory Points awarded from the number of wonderstages the player has built private static void AddVictoryWonder(Player p) { p.addScore(Score.VICTORY, p.getBoard().getStagesBuilt()); }
// Commercial structures // Some commercial structures from Age III grant victory points // Return the victory points from Commercial structures public static int GetCommercialScore(Player p) { int commercial = 0; foreach (string c in p.getPlayed()) { Card current = CardLibrary.getCard(c); if (current.colour.Equals(CardColour.YELLOW) && current.age.Equals(3)) foreach (Effect e in current.effects) { if (e.type.Equals(Effect.TypeType.VICTORY) && e.from.Equals(Effect.FromType.PLAYER)) { if (e.basis.Equals(Effect.BasisType.WONDER)) commercial += p.getBoard().getStagesBuilt(); else commercial += GetVictoryColour(p, cardType[e.basis], e.amount); } } } return commercial; }