Exemplo n.º 1
0
        internal List <DessertCard> RemoveDessertAtIndexes(List <int> indexes)
        {
            List <DessertCard> cards = new List <DessertCard>();

            foreach (int index in indexes)
            {
                cards.Add(this._buffet.ElementAt(index));
            }
            int d = 0;

            foreach (int index in indexes)
            {
                d++;
                for (int i = index + 1; i < BuffetSize; i++)
                {
                    this._buffet[i - d] = this._buffet[i];
                }
            }
            for (; d > 0; d--)
            {
                if (DessertDeck.RemainingCards > 0)
                {
                    this._buffet[this.BuffetSize - d] = DessertDeck.Draw();
                }
                else
                {
                    this._buffet[this.BuffetSize - d] = null;
                }
            }
            return(cards);
        }
Exemplo n.º 2
0
 private void RevealCards(int amount)
 {
     for (int i = 0; i < this.BuffetSize; i++)
     {
         this._buffet.Add(DessertDeck.Draw());
     }
 }
Exemplo n.º 3
0
 internal DessertBuffet(int buffer_size, DessertDeck deck)
 {
     this.BuffetSize  = buffer_size;
     _buffet          = new List <DessertCard>(buffer_size);
     this.Buffet      = new ReadOnlyCollection <DessertCard>(_buffet);
     this.DessertDeck = deck;
     this.RevealCards(this.BuffetSize);
 }
Exemplo n.º 4
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();
        }