private void ScorePreferencesAndLoyalty() { foreach (PlayerBase player in this.Players) { PublicBoard.SetUndesiredRestaurantOfTheWeek(player, _preferenceCards[player].Undesired); LoyaltyCard loyalty = _loyaltyCards[player]; int visitsToLoyalty = 0; foreach (DayOfWeek day in Extensions.Weekdays) { if (PublicBoard.VisitedPlaces[player][day] is RestaurantPlace && (PublicBoard.VisitedPlaces[player][day] as RestaurantPlace).Identifier == loyalty.Restaurant) { visitsToLoyalty++; } if (PublicBoard.RestaurantWithMajority(day) == _preferenceCards[player].FirstPreference && PublicBoard.IsPlayerInMajority(day, player)) { PublicBoard.AddVictoryPointsToPlayer(_preferenceCards[player].FirstPreferenceBonus, player, VictoryPointsSource.PreferenceCard); } if (PublicBoard.RestaurantWithMajority(day) == _preferenceCards[player].SecondPreference && PublicBoard.IsPlayerInMajority(day, player)) { PublicBoard.AddVictoryPointsToPlayer(_preferenceCards[player].SecondPreferenceBonus, player, VictoryPointsSource.PreferenceCard); } if (PublicBoard.Restaurants[_preferenceCards[player].Undesired].Visitors[day].Contains(player)) { ApplyPunishment(_preferenceCards[player].Punishment, player); } if (PublicBoard.IsPlayerAlone(day, player.Left)) { ApplyPunishment(_preferenceCards[player].SideBan, player.Left); } if (PublicBoard.IsPlayerAlone(day, player.Right)) { ApplyPunishment(_preferenceCards[player].SideBan, player.Right); } } PublicBoard.AddVictoryPointsToPlayer(loyalty.VictoryPoints[visitsToLoyalty], player, VictoryPointsSource.LoyaltyCard); switch (_loyaltyCards[player].Type) { case LoyaltyType.VIP: LoyaltyCardVIP cardVIP = _loyaltyCards[player] as LoyaltyCardVIP; if (visitsToLoyalty >= 2) { List <int> desserts = player.ChooseDessert(PublicBoard, DessertBuffet.TakeChoices(cardVIP.DessertOptions), cardVIP.DessertTakeCount); List <DessertCard> chosenCards = this.DessertBuffet.RemoveDessertAtIndexes(desserts); _dessertCards[player].AddRange(chosenCards); } break; case LoyaltyType.GOLD: LoyaltyCardGOLD cardGOLD = _loyaltyCards[player] as LoyaltyCardGOLD; if (visitsToLoyalty >= 3) { PublicBoard.AddCashToPlayer(cardGOLD.ExtraCash, player); } break; } } }
private void ScoreVPs(DayOfWeek day) { foreach (Restaurant restaurant in Extensions.Restaurants) { foreach (PlayerBase player in PublicBoard.Restaurants[restaurant].Visitors[day]) { foreach (FoodType food in PublicBoard.FavoriteFood[player]) { if (PublicBoard.Restaurants[restaurant].Menu.Contains(food)) { PublicBoard.AddVictoryPointsToPlayer(1, player, VictoryPointsSource.Food); } } } } Players.ActionForCharacter(Character.HR, player => { if (PublicBoard.IsPlayerInMajority(day, player)) { if (player.ShouldSwitchCashForVPAndTP(PublicBoard, -1, 1, 0)) { PublicBoard.AddCashToPlayer(-1, player); PublicBoard.AddVictoryPointsToPlayer(1, player, VictoryPointsSource.Character); } } }); Players.ActionForCharacter(Character.Marketing, player => { if (!PublicBoard.IsPlayerInMajority(day, player)) { if (player.ShouldSwitchCashForVPAndTP(PublicBoard, -3, 2, 1)) { PublicBoard.AddCashToPlayer(-3, player); PublicBoard.AddVictoryPointsToPlayer(2, player, VictoryPointsSource.Character); PublicBoard.AddTeamScore(1); } } }); Players.ActionForCharacter(Character.Programmer, player => { if (!PublicBoard.IsPlayerInMajority(day, player) && !PublicBoard.IsPlayerAlone(day, player)) { PublicBoard.AddVictoryPointsToPlayer(3, player, VictoryPointsSource.Character); } }); Players.ActionForCharacter(Character.Environment, player => { if (PublicBoard.VisitedPlaces[player][day].Menu.Contains(FoodType.Vegetarian)) { PublicBoard.AddVictoryPointsToPlayer(2, player, VictoryPointsSource.Character); } }); }