Dominion.PlayerState.DoPlayTreasure C# (CSharp) Method

DoPlayTreasure() private method

private DoPlayTreasure ( Dominion.Card currentCard, GameState gameState ) : void
currentCard Dominion.Card
gameState GameState
return void
        internal void DoPlayTreasure(Card currentCard, GameState gameState)
        {
            if (!currentCard.isTreasure)
            {
                throw new Exception("Can't play a card that isn't a treasure");
            }

            this.gameLog.PlayedCard(this, currentCard);
            this.gameLog.PushScope();
            this.cardsBeingPlayed.AddCardToTop(currentCard);
            gameState.cardContextStack.PushCardContext(this, currentCard, CardContextReason.CardBeingPlayed);

            this.AddBuys(currentCard.plusBuy);
            this.AddCoins(currentCard.plusCoin);
            if (currentCard == Cards.Copper)
            {
                this.AddCoins(this.turnCounters.copperAdditionalValue);
            }

            currentCard.DoSpecializedAction(gameState.players.CurrentPlayer, gameState);

            CardHasBeenPlayed(currentCard, 1);
            gameState.cardContextStack.Pop();
            this.gameLog.PopScope();
        }

Usage Example

Ejemplo n.º 1
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            Card cardToPlay = null;
            while (true)
            {
                Card revealedCard = currentPlayer.DrawAndRevealOneCardFromDeck(gameState);
                if (revealedCard == null)
                {
                    break;
                }
                if (revealedCard.isTreasure)
                {
                    cardToPlay = currentPlayer.cardsBeingRevealed.RemoveCard(revealedCard);
                    break;
                }
            }
            currentPlayer.MoveRevealedCardsToDiscard(gameState);

            if (cardToPlay != null)
            {
                currentPlayer.DoPlayTreasure(cardToPlay, gameState);
            }
        }
All Usage Examples Of Dominion.PlayerState::DoPlayTreasure
PlayerState