GainCardFromSupply() private method

private GainCardFromSupply ( GameState gameState, Dominion.Card cardType, DeckPlacement defaultLocation = DeckPlacement.Discard ) : Dominion.Card
gameState GameState
cardType Dominion.Card
defaultLocation DeckPlacement
return Dominion.Card
コード例 #1
0
ファイル: Intrigue.cs プロジェクト: peterhal/Dominulator
 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);
     }
 }
コード例 #2
0
        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");
            }
        }
コード例 #3
0
ファイル: Hinterlands.cs プロジェクト: peterhal/Dominulator
        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);
        }
コード例 #4
0
ファイル: DarkAges.cs プロジェクト: peterhal/Dominulator
        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();
            }
        }
コード例 #5
0
ファイル: Hinterlands.cs プロジェクト: peterhal/Dominulator
        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);
        }
コード例 #6
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.GainCardFromSupply(Cards.Gold, gameState);
     currentPlayer.GainCardFromSupply(Cards.Copper, gameState);
 }
コード例 #7
0
        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);
            }
        }
コード例 #8
0
ファイル: Promo.cs プロジェクト: NathanTeeuwen/Dominulator
        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;
                    }
            }
        }
コード例 #9
0
ファイル: DarkAges.cs プロジェクト: peterhal/Dominulator
        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;
            }
        }
コード例 #10
0
 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);
     }
 }
コード例 #11
0
 private new void DoSpecializedActionOnBuyWhileInPlay(PlayerState currentPlayer, GameState gameState, Card boughtCard)
 {
     if (boughtCard.CurrentCoinCost(currentPlayer) <= 4 && boughtCard.potionCost == 0 && !boughtCard.isVictory)
     {
         currentPlayer.GainCardFromSupply(gameState, boughtCard);
     }
 }
コード例 #12
0
 private new void DoSpecializedActionOnBuyWhileInPlay(PlayerState currentPlayer, GameState gameState, Card boughtCard)
 {
     if (boughtCard.isVictory)
     {
         currentPlayer.GainCardFromSupply(gameState, Cards.Gold);
     }
 }
コード例 #13
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            Card revealedCard = currentPlayer.RequestPlayerRevealCardFromHand(card => card.isTreasure, gameState);

            if (revealedCard != null)
            {
                currentPlayer.GainCardFromSupply(gameState, revealedCard);
            }
        }
コード例 #14
0
ファイル: DarkAges.cs プロジェクト: peterhal/Dominulator
        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;
        }
コード例 #15
0
ファイル: DarkAges.cs プロジェクト: peterhal/Dominulator
 public override void DoSpecializedDiscardFromPlay(PlayerState currentPlayer, GameState gameState)
 {
     if (currentPlayer.turnCounters.BuysUsed == 0)
     {
         currentPlayer.MoveCardBeingDiscardedToTrash(gameState);
         currentPlayer.GainCardFromSupply(Cards.Madman, gameState);
     }
 }
コード例 #16
0
ファイル: DarkAges.cs プロジェクト: peterhal/Dominulator
 public override DeckPlacement DoSpecializedWhenGain(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.GainCardFromSupply(Cards.Ruins, gameState);
     currentPlayer.GainCardFromSupply(Cards.Ruins, gameState);
     return DeckPlacement.Default;
 }
コード例 #17
0
ファイル: Hinterlands.cs プロジェクト: peterhal/Dominulator
        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;
        }
コード例 #18
0
ファイル: Seaside.cs プロジェクト: peterhal/Dominulator
 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);
     }
 }
コード例 #19
0
ファイル: Hinterlands.cs プロジェクト: peterhal/Dominulator
 public override void DoSpecializedDiscardNonCleanup(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.GainCardFromSupply(Gold.card, gameState);
 }
コード例 #20
0
ファイル: BaseSet.cs プロジェクト: NathanTeeuwen/Dominulator
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.GainCardFromSupply(Silver.card, gameState, DeckPlacement.TopOfDeck);
 }
コード例 #21
0
ファイル: Alchemy.cs プロジェクト: NathanTeeuwen/Dominulator
        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);
        }
コード例 #22
0
ファイル: DarkAges.cs プロジェクト: peterhal/Dominulator
        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;
        }
コード例 #23
0
ファイル: Seaside.cs プロジェクト: peterhal/Dominulator
 public override void DoSpecializedAttack(PlayerState currentPlayer, PlayerState otherPlayer, GameState gameState)
 {
     otherPlayer.DiscardCardFromTopOfDeck();
     otherPlayer.GainCardFromSupply(Curse.card, gameState, DeckPlacement.TopOfDeck);
 }
コード例 #24
0
ファイル: Intrigue.cs プロジェクト: peterhal/Dominulator
        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");
            }
        }
コード例 #25
0
ファイル: BaseSet.cs プロジェクト: NathanTeeuwen/Dominulator
 public override void DoSpecializedAttack(PlayerState currentPlayer, PlayerState otherPlayer, GameState gameState)
 {
     otherPlayer.GainCardFromSupply(Curse.card, gameState);
 }
コード例 #26
0
ファイル: Intrigue.cs プロジェクト: peterhal/Dominulator
 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);
     }
 }
コード例 #27
0
ファイル: Cornucopia.cs プロジェクト: peterhal/Dominulator
 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);
         }
     }
 }
コード例 #28
0
ファイル: Guilds.cs プロジェクト: NathanTeeuwen/Dominulator
 public override void DoSpecializedAttack(PlayerState currentPlayer, PlayerState otherPlayer, GameState gameState)
 {
     if (otherPlayer.GainCardFromSupply(Curse.card, gameState))
     {
         otherPlayer.DrawAdditionalCardsIntoHand(1, gameState);
     }
 }
コード例 #29
0
 public override void DoSpecializedWhenBuy(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.GainCardFromSupply(Cards.Port, gameState);
 }
コード例 #30
0
ファイル: DarkAges.cs プロジェクト: peterhal/Dominulator
 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();
     }
 }