RequestPlayerDiscardCardFromHand() private method

private RequestPlayerDiscardCardFromHand ( GameState gameState, CardPredicate acceptableCardsToDiscard, bool isOptional ) : bool
gameState GameState
acceptableCardsToDiscard CardPredicate
isOptional bool
return bool
Beispiel #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);
     }
 }
Beispiel #2
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            currentPlayer.numberOfCardsToBeDrawn = 0;
            while (!currentPlayer.hand.IsEmpty)
            {
                if (!currentPlayer.RequestPlayerDiscardCardFromHand(gameState, acceptableCard => true, isOptional: true))
                {
                    break;
                }
                ++currentPlayer.numberOfCardsToBeDrawn;
            }

            currentPlayer.DrawAdditionalCardsIntoHand(currentPlayer.numberOfCardsToBeDrawn, gameState);
            currentPlayer.numberOfCardsToBeDrawn = 0;
        }
Beispiel #3
0
 public override void DoSpecializedAttack(PlayerState currentPlayer, PlayerState otherPlayer, GameState gameState)
 {
     if (!otherPlayer.RequestPlayerDiscardCardFromHand(gameState, card => card == Copper.card, isOptional: false))
     {
         otherPlayer.RevealHand();
     }
 }
Beispiel #4
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            int countCardsDiscarded = 0;
            while (!currentPlayer.hand.IsEmpty)
            {
                if (!currentPlayer.RequestPlayerDiscardCardFromHand(gameState, acceptableCard => true, isOptional: true))
                {
                    break;
                }
                ++countCardsDiscarded;
            }

            currentPlayer.DrawAdditionalCardsIntoHand(countCardsDiscarded);
        }
Beispiel #5
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     if (currentPlayer.RequestPlayerDiscardCardFromHand(gameState, card => card.isTreasure, isOptional: true))
     {
         currentPlayer.DrawAdditionalCardsIntoHand(3);
         currentPlayer.AddActions(1);
     }
 }
Beispiel #6
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.RequestPlayerDiscardCardFromHand(gameState, acceptableCard => true, isOptional: false);
 }
Beispiel #7
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     // TODO:  How does the player know whether he is discarding for action or buy?
     if (currentPlayer.RequestPlayerDiscardCardFromHand(gameState, card => true, isOptional: true))
     {
         currentPlayer.AddActions(1);
     }
     if (currentPlayer.RequestPlayerDiscardCardFromHand(gameState, card => true, isOptional: true))
     {
         currentPlayer.AddBuys(1);
     }
 }
Beispiel #8
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     while (!currentPlayer.hand.IsEmpty)
     {
         if (!currentPlayer.RequestPlayerDiscardCardFromHand(gameState, acceptableCard => true, isOptional: true))
         {
             break;
         }
         currentPlayer.AddCoins(1);
     }
 }
 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);
     }
 }
Beispiel #10
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;
        }