Пример #1
0
        public Card PlayerGainCardFromSupply(Card cardType, PlayerState playerState, DeckPlacement defaultLocation = DeckPlacement.Discard, GainReason gainReason = GainReason.Gain)
        {
            PileOfCards pile = this.GetPile(cardType);

            if (pile == null)
            {
                return(null);
            }

            if (GetPile(this.supplyPiles, cardType) != null)
            {
                this.hasPileEverBeenGained[pile] = true;
            }

            Card card = pile.DrawCardFromTop();

            if (card == null)
            {
                return(null);
            }

            playerState.GainCard(this, card, DeckPlacement.Supply, defaultLocation, gainReason);

            return(card);
        }
Пример #2
0
        public Card PlayerGainCardFromSupply(Card cardType, PlayerState playerState, DeckPlacement defaultLocation = DeckPlacement.Discard, GainReason gainReason = GainReason.Gain)
        {
            bool        canGainCardFromSupply = CanGainCardFromSupply(cardType);
            PileOfCards pile = this.GetPile(cardType);

            if (pile == null)
            {
                System.Diagnostics.Debug.Assert(!canGainCardFromSupply);
                return(null);
            }

            if (GetPile(this.supplyPiles, cardType) != null)
            {
                this.hasPileEverBeenGained[pile] = true;
            }

            if (pile.TopCard() != cardType)
            {
                System.Diagnostics.Debug.Assert(!canGainCardFromSupply);
                return(null);
            }

            Card card = pile.DrawCardFromTop();

            if (card == null)
            {
                System.Diagnostics.Debug.Assert(!canGainCardFromSupply);
                return(null);
            }

            System.Diagnostics.Debug.Assert(canGainCardFromSupply);

            playerState.GainCard(this, card, DeckPlacement.Supply, defaultLocation, gainReason);


            return(card);
        }