RequestPlayerTrashOtherPlayersRevealedCard() private method

private RequestPlayerTrashOtherPlayersRevealedCard ( GameState gameState, CardPredicate acceptableCard, PlayerState otherPlayer ) : Dominion.Card
gameState GameState
acceptableCard CardPredicate
otherPlayer PlayerState
return Dominion.Card
Beispiel #1
0
        public override void DoSpecializedAttack(PlayerState currentPlayer, PlayerState otherPlayer, GameState gameState)
        {
            otherPlayer.RevealCardsFromDeck(2, gameState);

            Card trashedCard = currentPlayer.RequestPlayerTrashOtherPlayersRevealedCard(gameState, card => card.isTreasure, otherPlayer);

            if (trashedCard != null)
            {
                if (currentPlayer.actions.ShouldGainCard(gameState, trashedCard))
                {
                    Card cardToGain = gameState.trash.RemoveCard(trashedCard);
                    currentPlayer.GainCard(gameState, cardToGain, originalLocation:DeckPlacement.Trash, defaultPlacement:DeckPlacement.Discard);
                }
            }

            otherPlayer.MoveRevealedCardsToDiscard(gameState);
        }
        public override void DoSpecializedAttack(PlayerState currentPlayer, PlayerState otherPlayer, GameState gameState)
        {
            otherPlayer.RevealCardsFromDeck(2, gameState);

            if (!otherPlayer.CardsBeingRevealed.AnyWhere(card => card.isTreasure))
            {
                otherPlayer.GainCardFromSupply(Copper.card, gameState);
            }
            else
            {
                CardPredicate acceptableCard = card => card == Silver.card || card == Gold.card;
                Card trashedCard = currentPlayer.RequestPlayerTrashOtherPlayersRevealedCard(gameState, acceptableCard, otherPlayer);
                if (trashedCard != null)
                {
                    Card cardToGain = gameState.trash.RemoveCard(trashedCard);
                    currentPlayer.GainCard(gameState, cardToGain, DeckPlacement.Trash, DeckPlacement.Discard);
                }
            }

            otherPlayer.MoveRevealedCardsToDiscard(gameState);
        }