Exemple #1
0
        public Game(List <PlayerBase> players, DifficultyLevel difficulty)
        {
            this._players = players;
            for (int i = 0; i < players.Count; i++)
            {
                this._players[i].SetBoard(PublicBoard);
                this._players[i].Right = this._players[(i + 1) % players.Count];
                this._players[i].Left  = this._players[(i + players.Count - 1) % players.Count];
            }
            this._dessertCards = new Dictionary <PlayerBase, List <DessertCard> >();
            players.ForEach(player => _dessertCards.Add(player, new List <DessertCard>()));

            PublicBoard = new PublicBoard(players, difficulty)
            {
                DessertsHandler = (player) => _dessertCards[player]
            };
            FoodDeck                    = new FavoriteFoodDeck();
            LoyaltyDeck                 = new LoyaltyDeck();
            PreferencesDeck             = new PreferencesDeck();
            TeamBonusDeck               = new TeamBonusDeck();
            PlayerBonusDeck             = new PlayerBonusDeck();
            RestaurantDailyModifierDeck = new RestaurantDailyModifierDeck();
            DessertDeck                 = new DessertDeck(players.Count + 3);
            DessertBuffet               = new DessertBuffet(DESSERT_BUFFET_SIZE, DessertDeck);

            PublicBoard.CurrentDay = 0;

            for (int i = 0; i < MAX_WEEKS; i++)
            {
                PublicBoard.CurrentDay++;
                PublicBoard.ClearVisitedPlaces();
                PublicBoard.ClearFavoriteFood();
                _preferenceCards = new Dictionary <PlayerBase, PreferenceCard>();
                _loyaltyCards    = new Dictionary <PlayerBase, LoyaltyCard>();

                CreateRestaurantMenu();
                RevealPlayerWeeklyObjectives(i);
                RevealTeamObjective();
                RevealDailyModifiers();
                DealCardsToPlayers();
                ChooseAFavoriteMeal();
                ChooseRestaurantPreferences();

                for (int day = 0; day < DAYS_IN_WEEK; day++)
                {
                    PublicBoard.CurrentDay++;
                    DayOfWeek weekday = Extensions.Weekdays[day];

                    ChooseRestaurant(weekday);
                    AdvanceRestaurantTracks(weekday);
                    PayForLunchAndSetMarkers(weekday);
                    ScoreTeamPoints(weekday);
                    ScoreDailyModifiers(weekday);
                    ScoreVPs(weekday);
                    FirstPlayerIndex = (FirstPlayerIndex + 1) % this.Players.Count();
                }

                PublicBoard.CurrentDay++;
                ReadjustRestaurantPrices();
                ScorePreferencesAndLoyalty();
                ScoreTeamBonus();
                ScorePlayerBonus();
            }

            CalculateFinalScore();
        }