Наследование: CollectionCards
Пример #1
0
        internal PlayerState(IPlayerAction actions, int playerIndex, Game game)
        {
            this.game = game;

            CardGameSubset gameSubset = game.CardGameSubset;
            this.actions = new PlayerActionWithSelf(actions, this);
            this.EnterPhase(PlayPhase.NotMyTurn);
            this.playerIndex = playerIndex;

            // duplicates
            this.allOwnedCards = new BagOfCards(gameSubset);
            this.cardsInPlay = new BagOfCards(gameSubset, this.allOwnedCards);
            this.cardsInPlayAtBeginningOfCleanupPhase = new BagOfCards(gameSubset);

            // partition
            this.islandMat = new BagOfCards(gameSubset, this.allOwnedCards);
            this.nativeVillageMat = new BagOfCards(gameSubset, this.allOwnedCards);
            this.tavernMat = new BagOfCards(gameSubset, this.allOwnedCards);
            this.deck = new ListOfCards(gameSubset, this.allOwnedCards);
            this.discard = new BagOfCards(gameSubset, this.allOwnedCards);
            this.cardsBeingPlayed = new ListOfCards(gameSubset, this.allOwnedCards);  // a stack for recursion
            this.cardsBeingRevealed = new BagOfCards(gameSubset, this.allOwnedCards);
            this.hand = new BagOfCards(gameSubset, this.allOwnedCards);
            this.cardsPlayed = new BagOfCards(gameSubset, this.cardsInPlay);
            this.durationCards = new BagOfCards(gameSubset, this.cardsInPlay);
            this.cardsToReturnToHandAtStartOfTurn = new BagOfCards(gameSubset, this.allOwnedCards);
            this.cardToPass = new SingletonCardHolder(this.allOwnedCards);
            this.cardBeingDiscarded = new ListOfCards(gameSubset, this.allOwnedCards);
            this.cardsSetAside = new BagOfCards(gameSubset, this.allOwnedCards);

            this.turnCounters = new PlayerTurnCounters(gameSubset);
        }
Пример #2
0
        private static PileOfCards CreateRuins(CardGameSubset gameSubset, int ruinsCount, Random random)
        {
            int ruinCountPerPile = 10;
            var allRuinsCards    = new ListOfCards(gameSubset);

            allRuinsCards.AddNCardsToTop(Cards.AbandonedMine, ruinCountPerPile);
            allRuinsCards.AddNCardsToTop(Cards.RuinedMarket, ruinCountPerPile);
            allRuinsCards.AddNCardsToTop(Cards.RuinedLibrary, ruinCountPerPile);
            allRuinsCards.AddNCardsToTop(Cards.RuinedVillage, ruinCountPerPile);
            allRuinsCards.AddNCardsToTop(Cards.Survivors, ruinCountPerPile);

            allRuinsCards.Shuffle(random);

            var result = new PileOfCards(gameSubset, Cards.Ruins);

            for (int i = 0; i < ruinsCount; ++i)
            {
                Card card = allRuinsCards.DrawCardFromTop();
                if (card == null)
                {
                    throw new Exception("Not enough ruins available.");
                }
                result.AddCardToTop(card);
            }
            result.EraseKnownCountKnowledge();

            return(result);
        }
Пример #3
0
        private static PileOfCards CreateRuins(CardGameSubset gameSubset, int ruinsCount, Random random)
        {
            if (gameSubset.isInitializing)
            {
                gameSubset.AddCard(Cards.Ruins);
                gameSubset.AddCard(Cards.AbandonedMine);
                gameSubset.AddCard(Cards.RuinedMarket);
                gameSubset.AddCard(Cards.RuinedLibrary);
                gameSubset.AddCard(Cards.RuinedVillage);
                gameSubset.AddCard(Cards.Survivors);
                return null;
            }
            else
            {
                int ruinCountPerPile = 10;
                var allRuinsCards = new ListOfCards(gameSubset);
                allRuinsCards.AddNCardsToTop(Cards.AbandonedMine, ruinCountPerPile);
                allRuinsCards.AddNCardsToTop(Cards.RuinedMarket, ruinCountPerPile);
                allRuinsCards.AddNCardsToTop(Cards.RuinedLibrary, ruinCountPerPile);
                allRuinsCards.AddNCardsToTop(Cards.RuinedVillage, ruinCountPerPile);
                allRuinsCards.AddNCardsToTop(Cards.Survivors, ruinCountPerPile);

                allRuinsCards.Shuffle(random);

                var result = new PileOfCards(gameSubset, Cards.Ruins);

                for (int i = 0; i < ruinsCount; ++i)
                {
                    Card card = allRuinsCards.DrawCardFromTop();
                    if (card == null)
                    {
                        throw new Exception("Not enough ruins available.");
                    }
                    result.AddCardToTop(card);
                }
                result.EraseKnownCountKnowledge();

                return result;
            }
        }