示例#1
0
        internal void MoveCardToTrash(Card card, GameState gameState)
        {
            this.gameLog.PlayerTrashedCard(this, card);
            this.gameLog.PushScope();
            gameState.cardContextStack.PushCardContext(this, card, CardContextReason.CardBeingTrashed);

            if (card.DoSpecializedTrash(this, gameState))
            {
                gameState.trash.AddCard(card);
            }

            // cards in hand react to trashing.
            if (this.ownsCardWithSpecializedActionOnTrashWhileInHand)
            {
                bool stateHasChanged = true;
                while (stateHasChanged)
                {
                    stateHasChanged = false;
                    foreach (Card cardInHand in this.hand)
                    {
                        gameState.cardContextStack.PushCardContext(this, cardInHand, CardContextReason.CardReacting);
                        stateHasChanged = cardInHand.DoSpecializedActionOnTrashWhileInHand(this, gameState, cardInHand);
                        gameState.cardContextStack.Pop();
                        if (stateHasChanged)
                            break;
                    }
                }
            }
            gameState.cardContextStack.Pop();
            this.gameLog.PopScope();
        }
示例#2
0
        internal void MoveCardToTrash(Card card, GameState gameState)
        {
            this.gameLog.PlayerTrashedCard(this, card);
            gameState.trash.AddCard(card);
            this.gameLog.PushScope();

            card.DoSpecializedTrash(gameState.players.CurrentPlayer, gameState);

            // cards in hand react to trashing.
            if (this.ownsCardWithSpecializedActionOnTrashWhileInHand)
            {
                bool stateHasChanged = true;
                while (stateHasChanged)
                {
                    stateHasChanged = false;
                    foreach (Card cardInHand in this.hand)
                    {
                        stateHasChanged = cardInHand.DoSpecializedActionOnTrashWhileInHand(this, gameState, cardInHand);
                        if (stateHasChanged)
                            break;
                    }
                }
            }

            this.gameLog.PopScope();
        }