GainCardFromSupply() private méthode

private GainCardFromSupply ( GameState gameState, Dominion.Card cardType, DeckPlacement defaultLocation = DeckPlacement.Discard ) : Dominion.Card
gameState GameState
cardType Dominion.Card
defaultLocation DeckPlacement
Résultat Dominion.Card
Exemple #1
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     if (currentPlayer.RequestPlayerDiscardCardFromHand(gameState, acceptableCard => acceptableCard == Estate.card, isOptional: true))
     {
         currentPlayer.AddCoins(4);
     }
     else
     {
         currentPlayer.GainCardFromSupply(Estate.card, gameState);
     }
 }
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            PlayerActionChoice actionChoice = currentPlayer.RequestPlayerChooseBetween(
                gameState,
                acceptableChoice => acceptableChoice == PlayerActionChoice.GainCard ||
                                    acceptableChoice == PlayerActionChoice.PlusCoin ||
                                    acceptableChoice == PlayerActionChoice.Trash);

            switch (actionChoice)
            {
                case PlayerActionChoice.GainCard: currentPlayer.GainCardFromSupply(Silver.card, gameState); break;
                case PlayerActionChoice.PlusCoin: currentPlayer.AddCoins(1); break;
                case PlayerActionChoice.Trash: currentPlayer.RequestPlayerTrashCardsFromHand(gameState, 1, false); break;
                default: throw new Exception("Invalid case");
            }
        }
Exemple #3
0
        public override void DoSpecializedAttack(PlayerState currentPlayer, PlayerState otherPlayer, GameState gameState)
        {
            otherPlayer.RevealCardsFromDeck(2);

            Card cardtoTrash = null;
            CardPredicate acceptableCards = card => card == Silver.card || card == Gold.card;
            if (otherPlayer.cardsBeingRevealed.HasCard(acceptableCards))
            {
                Card cardTypeToTrash = currentPlayer.actions.GetCardFromRevealedCardsToTrash(gameState, otherPlayer, acceptableCards);

                cardtoTrash = otherPlayer.cardsBeingRevealed.RemoveCard(cardTypeToTrash);
                if (cardtoTrash == null)
                {
                    throw new Exception("Must choose a revealed card to trash");
                }

                if (!acceptableCards(cardtoTrash))
                {
                    throw new Exception("Player Must choose a treasure card to trash");
                }

                otherPlayer.MoveCardToTrash(cardtoTrash, gameState);
            }

            if (!otherPlayer.CardsBeingRevealed.Where(card => card.isTreasure).Any())
            {
                otherPlayer.GainCardFromSupply(Copper.card, gameState);
            }

            if (cardtoTrash != null)
            {
                Card cardToGain = gameState.trash.RemoveCard(cardtoTrash);
                currentPlayer.GainCard(gameState, cardToGain, DeckPlacement.Trash, DeckPlacement.Discard);
            }

            otherPlayer.MoveRevealedCardsToDiscard(gameState);
        }
Exemple #4
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            PlayerActionChoice choice = currentPlayer.RequestPlayerChooseBetween(gameState,
                acceptableChoice =>
                    acceptableChoice == PlayerActionChoice.PlusAction ||
                    acceptableChoice == PlayerActionChoice.PlusBuy ||
                    acceptableChoice == PlayerActionChoice.GainCard);

            switch (choice)
            {
                case PlayerActionChoice.PlusAction: currentPlayer.AddActions(2); break;
                case PlayerActionChoice.PlusBuy: currentPlayer.AddBuys(2); break;
                case PlayerActionChoice.GainCard: currentPlayer.GainCardFromSupply(Cards.Silver, gameState); break;
                default: throw new Exception();
            }
        }
Exemple #5
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            currentPlayer.GainCardFromSupply(Silver.card, gameState);

            // look at the top card of the deck and discard or put it back
            Card card = currentPlayer.DrawAndLookAtOneCardFromDeck();
            if (card != null)
            {
                if (currentPlayer.actions.ShouldPlayerDiscardCardFromDeck(gameState, currentPlayer, card))
                {
                    currentPlayer.gameLog.PushScope();
                    currentPlayer.MoveLookedAtCardsToDiscard(gameState);
                    currentPlayer.gameLog.PlayerDiscardCard(currentPlayer, card);
                    currentPlayer.gameLog.PopScope();
                }
                else
                {
                    currentPlayer.MoveLookedAtCardToTopOfDeck(card);
                }
            }

            currentPlayer.DrawUntilCountInHand(5);

            currentPlayer.RequestPlayerTrashCardFromHand(gameState, acceptableCard => !acceptableCard.isTreasure, isOptional: true);
        }
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.GainCardFromSupply(Cards.Gold, gameState);
     currentPlayer.GainCardFromSupply(Cards.Copper, gameState);
 }
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            Card revealedCard = currentPlayer.DrawAndRevealOneCardFromDeck(gameState);
            if (revealedCard.isTreasure)
            {
                currentPlayer.MoveAllRevealedCardsToHand();
            }
            else
            {
                currentPlayer.MoveRevealedCardToTopOfDeck();
            }

            if (revealedCard.isAction || revealedCard.isVictory)
            {
                currentPlayer.GainCardFromSupply(Cards.Magpie, gameState);
            }
        }
Exemple #8
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            PlayerActionChoice playerChoice = currentPlayer.RequestPlayerChooseBetween(gameState, acceptableChoice =>
                acceptableChoice == PlayerActionChoice.GainCard ||
                acceptableChoice == PlayerActionChoice.PlusCard ||
                acceptableChoice == PlayerActionChoice.Trash);

            switch (playerChoice)
            {
                case PlayerActionChoice.PlusCard:
                    {
                        currentPlayer.DrawAdditionalCardsIntoHand(3, gameState);
                        foreach (PlayerState otherPlayer in gameState.players.OtherPlayers)
                        {
                            otherPlayer.DrawAdditionalCardsIntoHand(1, gameState);
                        }
                        break;
                    }
                case PlayerActionChoice.GainCard:
                    {
                        currentPlayer.GainCardFromSupply(gameState, Gold.card);
                        foreach (PlayerState otherPlayer in gameState.players.OtherPlayers)
                        {
                            otherPlayer.GainCardFromSupply(gameState, Silver.card);
                        }
                        break;
                    }
                case PlayerActionChoice.Trash:
                    {
                        currentPlayer.RequestPlayerTrashCardFromHandAndGainCard(
                            gameState,
                            acceptableCardsToTrash => true,
                            CostConstraint.Exactly,
                            2,
                            CardRelativeCost.RelativeCost,
                            isOptionalToTrash: true,
                            isOptionalToGain: false);

                        foreach (PlayerState otherPlayer in gameState.players.OtherPlayers)
                        {
                            otherPlayer.RequestPlayerTrashCardFromHandAndGainCard(
                                gameState,
                                acceptableCardsToTrash => true,
                                CostConstraint.Exactly,
                                1,
                                CardRelativeCost.RelativeCost,
                                isOptionalToTrash: true,
                                isOptionalToGain: false);
                        }
                        break;
                    }
            }
        }
Exemple #9
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            PlayerActionChoice choice = currentPlayer.RequestPlayerChooseBetween(gameState,
                acceptableChoice => acceptableChoice == PlayerActionChoice.Discard ||
                                    acceptableChoice == PlayerActionChoice.GainCard ||
                                    acceptableChoice == PlayerActionChoice.TopDeck);

            switch (choice)
            {
                case PlayerActionChoice.Discard: currentPlayer.RequestPlayerDiscardCardsFromHand(gameState, 2, isOptional: false); break;
                case PlayerActionChoice.GainCard: currentPlayer.GainCardFromSupply(Cards.Copper, gameState); break;
                case PlayerActionChoice.TopDeck: currentPlayer.RequestPlayerTopDeckCardFromHand(gameState, acceptableCard => true, isOptional: false); break;
            }

            PlayerActionChoice choice2 = currentPlayer.RequestPlayerChooseBetween(gameState,
                acceptableChoice => acceptableChoice == PlayerActionChoice.PlusCoin ||
                                    acceptableChoice == PlayerActionChoice.Trash ||
                                    acceptableChoice == PlayerActionChoice.GainCard);

            switch (choice2)
            {
                case PlayerActionChoice.PlusCoin: currentPlayer.AddCoins(3); break;
                case PlayerActionChoice.Trash: currentPlayer.TrashHand(gameState); break;
                case PlayerActionChoice.GainCard: currentPlayer.GainCardFromSupply(Cards.Duchy, gameState); break;
            }
        }
 public override void DoSpecializedAttack(PlayerState currentPlayer, PlayerState otherPlayer, GameState gameState)
 {
     if (!otherPlayer.RequestPlayerDiscardCardFromHand(gameState, card => card.isCurse, true))
     {
         otherPlayer.GainCardFromSupply(Cards.Curse, gameState);
         otherPlayer.GainCardFromSupply(Cards.Copper, gameState);
     }
 }
 private new void DoSpecializedActionOnBuyWhileInPlay(PlayerState currentPlayer, GameState gameState, Card boughtCard)
 {
     if (boughtCard.CurrentCoinCost(currentPlayer) <= 4 && boughtCard.potionCost == 0 && !boughtCard.isVictory)
     {
         currentPlayer.GainCardFromSupply(gameState, boughtCard);
     }
 }
 private new void DoSpecializedActionOnBuyWhileInPlay(PlayerState currentPlayer, GameState gameState, Card boughtCard)
 {
     if (boughtCard.isVictory)
     {
         currentPlayer.GainCardFromSupply(gameState, Cards.Gold);
     }
 }
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            Card revealedCard = currentPlayer.RequestPlayerRevealCardFromHand(card => card.isTreasure, gameState);

            if (revealedCard != null)
            {
                currentPlayer.GainCardFromSupply(gameState, revealedCard);
            }
        }
Exemple #14
0
        private new bool DoSpecializedActionOnTrashWhileInHand(PlayerState currentPlayer, GameState gameState, Card gainedCard)
        {
            if (currentPlayer.actions.ShouldPlayerDiscardCardFromHand(gameState, currentPlayer, this))
            {
                currentPlayer.DiscardCardFromHand(gameState, this);
                currentPlayer.GainCardFromSupply(Gold.card, gameState);
                return true;
            }

            return false;
        }
Exemple #15
0
 public override void DoSpecializedDiscardFromPlay(PlayerState currentPlayer, GameState gameState)
 {
     if (currentPlayer.turnCounters.BuysUsed == 0)
     {
         currentPlayer.MoveCardBeingDiscardedToTrash(gameState);
         currentPlayer.GainCardFromSupply(Cards.Madman, gameState);
     }
 }
Exemple #16
0
 public override DeckPlacement DoSpecializedWhenGain(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.GainCardFromSupply(Cards.Ruins, gameState);
     currentPlayer.GainCardFromSupply(Cards.Ruins, gameState);
     return DeckPlacement.Default;
 }
Exemple #17
0
        public new DeckPlacement DoSpecializedActionOnGainWhileInHand(PlayerState currentPlayer, GameState gameState, Card gainedCard)
        {
            if (currentPlayer.actions.ShouldRevealCardFromHandForCard(gameState, this, gainedCard))
            {
                currentPlayer.RevealAndReturnCardToHand(this, gameState);
                currentPlayer.GainCardFromSupply(Silver.card, gameState);
                return DeckPlacement.None;
            }

            return DeckPlacement.Default;
        }
Exemple #18
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     if (currentPlayer.RequestPlayerRevealCardFromHand(card => card == Province.card, gameState) != null)
     {
         currentPlayer.GainCardFromSupply(Gold.card, gameState);
     }
     else
     {
         currentPlayer.GainCardFromSupply(Silver.card, gameState);
     }
 }
Exemple #19
0
 public override void DoSpecializedDiscardNonCleanup(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.GainCardFromSupply(Gold.card, gameState);
 }
Exemple #20
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.GainCardFromSupply(Silver.card, gameState, DeckPlacement.TopOfDeck);
 }
Exemple #21
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            Card trashedCard = currentPlayer.RequestPlayerTrashCardFromHand(gameState, acceptableCard => true, isOptional: false);

            if (trashedCard.isAction)
                currentPlayer.GainCardFromSupply(Duchy.card, gameState);

            if (trashedCard.isTreasure)
                currentPlayer.GainCardFromSupply(Transmute.card, gameState);

            if (trashedCard.isVictory)
                currentPlayer.GainCardFromSupply(Gold.card, gameState);
        }
Exemple #22
0
        public override bool DoReactionToAttackWhileInHand(PlayerState currentPlayer, GameState gameState, out bool cancelsAttack)
        {
            cancelsAttack = false;

            bool wasDiscarded = currentPlayer.RequestPlayerDiscardCardFromHand(gameState, card => card == Beggar.card, isOptional: true);
            if (!wasDiscarded)
            {
                return false;
            }

            currentPlayer.GainCardsFromSupply(gameState, Cards.Silver, 1, defaultLocation: DeckPlacement.TopOfDeck);
            currentPlayer.GainCardFromSupply(Cards.Silver, gameState);
            return true;
        }
Exemple #23
0
 public override void DoSpecializedAttack(PlayerState currentPlayer, PlayerState otherPlayer, GameState gameState)
 {
     otherPlayer.DiscardCardFromTopOfDeck();
     otherPlayer.GainCardFromSupply(Curse.card, gameState, DeckPlacement.TopOfDeck);
 }
Exemple #24
0
        public override void DoSpecializedAttack(PlayerState currentPlayer, PlayerState otherPlayer, GameState gameState)
        {
            PlayerActionChoice playerChoice = otherPlayer.RequestPlayerChooseBetween(
                gameState,
                acceptableChoice => acceptableChoice == PlayerActionChoice.Discard ||
                                    acceptableChoice == PlayerActionChoice.GainCard);

            switch (playerChoice)
            {
                case PlayerActionChoice.Discard: otherPlayer.RequestPlayerDiscardCardsFromHand(gameState, 2, isOptional: false); break;
                case PlayerActionChoice.GainCard: otherPlayer.GainCardFromSupply(Curse.card, gameState, DeckPlacement.Hand); break;
                default: throw new Exception("Invalid Choice");
            }
        }
Exemple #25
0
 public override void DoSpecializedAttack(PlayerState currentPlayer, PlayerState otherPlayer, GameState gameState)
 {
     otherPlayer.GainCardFromSupply(Curse.card, gameState);
 }
Exemple #26
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     // Trash 2 cards from your hand
     if (currentPlayer.RequestPlayerTrashCardsFromHand(gameState, 2, isOptional: false).Length == 2)
     {
         // If you do, gain a silver card; put it into your hand
         currentPlayer.GainCardFromSupply(Silver.card, gameState, DeckPlacement.Hand);
     }
 }
Exemple #27
0
 public override void DoSpecializedAttack(PlayerState currentPlayer, PlayerState otherPlayer, GameState gameState)
 {
     Card discardedCard = otherPlayer.DiscardCardFromTopOfDeck();
     if (discardedCard != null)
     {
         if (discardedCard.isVictory)
         {
             otherPlayer.GainCardFromSupply(Cards.Curse, gameState);
         }
         else if (currentPlayer.actions.ShouldGainCard(gameState, discardedCard))
         {
             currentPlayer.GainCardFromSupply(gameState, discardedCard);
         }
         else
         {
             otherPlayer.GainCardFromSupply(gameState, discardedCard);
         }
     }
 }
Exemple #28
0
 public override void DoSpecializedAttack(PlayerState currentPlayer, PlayerState otherPlayer, GameState gameState)
 {
     if (otherPlayer.GainCardFromSupply(Curse.card, gameState))
     {
         otherPlayer.DrawAdditionalCardsIntoHand(1, gameState);
     }
 }
 public override void DoSpecializedWhenBuy(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.GainCardFromSupply(Cards.Port, gameState);
 }
Exemple #30
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.GainCardFromSupply(Cards.Rats, gameState);
     CardPredicate cardsToTrash = card => card != Rats.card;
     if (currentPlayer.Hand.HasCard(cardsToTrash))
     {
         currentPlayer.RequestPlayerTrashCardFromHand(gameState, cardsToTrash, isOptional: false);
     }
     else
     {
         currentPlayer.RevealHand();
     }
 }