MoveRevealedCardToTrash() private method

private MoveRevealedCardToTrash ( Dominion.Card typeOfCard, GameState gameState ) : void
typeOfCard Dominion.Card
gameState GameState
return void
Beispiel #1
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            Card cardType = currentPlayer.RequestPlayerNameACard(gameState);
            currentPlayer.RevealCardsFromDeck(3, gameState);

            while (currentPlayer.cardsBeingRevealed.HasCard(cardType))
            {
                currentPlayer.MoveRevealedCardToTrash(cardType, gameState);
            }

            currentPlayer.RequestPlayerPutRevealedCardsBackOnDeck(gameState);
        }
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            while (true)
            {
                Card revealedCard = currentPlayer.DrawAndRevealOneCardFromDeck(gameState);
                if (revealedCard == null)
                    break;
                if (revealedCard.isTreasure)
                {
                    if (currentPlayer.actions.ShouldTrashCard(gameState, revealedCard))
                    {
                        currentPlayer.MoveRevealedCardToTrash(revealedCard, gameState);
                    }
                    else
                    {
                        currentPlayer.MoveRevealedCardToDiscard(revealedCard, gameState);
                    }
                    break;
                }
            }

            currentPlayer.MoveRevealedCardsToDiscard(gameState);
        }
Beispiel #3
0
        public override void DoSpecializedAttack(PlayerState currentPlayer, PlayerState otherPlayer, GameState gameState)
        {
            // Each other player reveals cards from the top of his deck
            Card revealedCard = otherPlayer.DrawAndRevealOneCardFromDeck();
            while (revealedCard != null)
            {
                // until revealing one costing 3 or more
                if (revealedCard.CurrentCoinCost(otherPlayer) >= 3)
                {
                    break;
                }
                revealedCard = otherPlayer.DrawAndRevealOneCardFromDeck();
            }

            if (revealedCard != null)
            {
                // He trashess that card and
                otherPlayer.MoveRevealedCardToTrash(revealedCard, gameState);
                // may gain a card costing at most 2 less than it.
                otherPlayer.RequestPlayerGainCardFromSupply(
                    gameState,
                    acceptableCard => acceptableCard.CurrentCoinCost(currentPlayer) <= revealedCard.CurrentCoinCost(currentPlayer) - 2 &&
                                      acceptableCard.potionCost <= revealedCard.potionCost,
                    "Must gain a card costing at most 2 less than the trashed card",
                    isOptional: true);
            }

            // he discards the other revealed cards
            otherPlayer.MoveRevealedCardsToDiscard(gameState);
        }
Beispiel #4
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            Card cardType = currentPlayer.RequestPlayerNameACard(gameState);

            Card foundCard = null;
            gameState.gameLog.PushScope();
            while (true)
            {
                foundCard = currentPlayer.DrawAndRevealOneCardFromDeck();
                if (foundCard == null)
                    break;

                if (foundCard.isVictory && foundCard != cardType)
                {
                    break;
                }
            }
            currentPlayer.MoveRevealedCardsToDiscard(cardToMove => !cardToMove.Equals(foundCard), gameState);
            gameState.gameLog.PopScope();

            if (foundCard != null)
            {
                int cardCost = foundCard.CurrentCoinCost(currentPlayer);
                currentPlayer.MoveRevealedCardToTrash(foundCard, gameState);
                currentPlayer.RequestPlayerGainCardFromSupply(gameState,
                    acceptableCard => acceptableCard.isVictory && acceptableCard.CurrentCoinCost(currentPlayer) <= cardCost + 3 && acceptableCard.potionCost == foundCard.potionCost,
                    "Gain a victory card costing up to 3 more than the trashed card.");
            }
        }