RequestPlayerGainCardFromTrash() private method

private RequestPlayerGainCardFromTrash ( GameState gameState, CardPredicate acceptableCard, string description, bool isOptional = false, DeckPlacement defaultLocation = DeckPlacement.Discard ) : Dominion.Card
gameState GameState
acceptableCard CardPredicate
description string
isOptional bool
defaultLocation DeckPlacement
return Dominion.Card
Esempio n. 1
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            PlayerActionChoice choice = currentPlayer.RequestPlayerChooseBetween(gameState,
                acceptableChoice => acceptableChoice == PlayerActionChoice.GainCard || acceptableChoice == PlayerActionChoice.Trash);

            if (choice == PlayerActionChoice.GainCard)
            {
                currentPlayer.RequestPlayerGainCardFromTrash(gameState,
                    acceptableCard => CardValidToGainFromTrash(acceptableCard, currentPlayer),
                    "Must gain a card costing between 3 and 6",
                    defaultLocation: DeckPlacement.TopOfDeck);
            }
            else
            {
                Card trashedCard = currentPlayer.RequestPlayerTrashCardFromHand(gameState, acceptableCard => CardValidToTrash(acceptableCard), isOptional: false);
                if (trashedCard != null)
                {
                    int maxCost = trashedCard.CurrentCoinCost(currentPlayer) + 3;
                    currentPlayer.RequestPlayerGainCardFromSupply(gameState,
                        acceptableCard => acceptableCard.CurrentCoinCost(currentPlayer) <= maxCost && acceptableCard.potionCost <= trashedCard.potionCost,
                        "gain a card costing up to 3 more than the trashed card");
                }
            }
        }
Esempio n. 2
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            PlayerState.AttackAction attackAction = this.DoEmptyAttack;

            CardPredicate acceptableCard = card => Card.DoesCardCost3To6(card, currentPlayer);
            if (gameState.trash.AnyWhere(acceptableCard))
            {
                currentPlayer.RequestPlayerGainCardFromTrash(gameState, acceptableCard, "Card from 3 to 6");
            }
            else
            {
                attackAction = Rogue.AttackAction;
            }

            currentPlayer.AttackOtherPlayers(gameState, attackAction);
        }