// 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; }