예제 #1
0
        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();
        }
예제 #2
0
        internal void DoPlayAction(Card currentCard, GameState gameState, int countTimes = 1)
        {
            if (!currentCard.isAction)
            {
                throw new Exception("Can't play a card that isn't a action");
            }

            this.gameLog.PlayedCard(this, currentCard);
            this.gameLog.PushScope();
            this.cardsBeingPlayed.AddCardToTop(currentCard);

            for (int i = 0; i < countTimes; ++i)
            {
                this.AddActions(currentCard.plusAction);
                this.AddBuys(currentCard.plusBuy);
                this.AddCoins(currentCard.plusCoin);
                this.victoryTokenCount += currentCard.plusVictoryToken;
                this.DrawAdditionalCardsIntoHand(currentCard.plusCard);

                if (currentCard.isAttack && currentCard.isAttackBeforeAction)
                {
                    AttackOtherPlayers(gameState, currentCard.DoSpecializedAttack);
                }

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

                if (currentCard.isAttack && !currentCard.attackDependsOnPlayerChoice && !currentCard.isAttackBeforeAction)
                {
                    AttackOtherPlayers(gameState, currentCard.DoSpecializedAttack);
                }
            }

            CardHasBeenPlayed();

            this.gameLog.PopScope();
        }