RequestPlayerRevealCardFromHand() private method

private RequestPlayerRevealCardFromHand ( CardPredicate acceptableCard, GameState gameState ) : Dominion.Card
acceptableCard CardPredicate
gameState GameState
return Dominion.Card
Beispiel #1
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            Card revealedCard = currentPlayer.RequestPlayerRevealCardFromHand(acceptableCard => true, gameState);
            if (revealedCard == null)
            {
                return;
            }

            currentPlayer.MoveRevealedCardToHand(revealedCard);

            int maxReturnCount = 1;
            if (currentPlayer.Hand.CountWhere(card => card.Equals(revealedCard)) > 1)
            {
                maxReturnCount++;
            }

            int returnCount = currentPlayer.actions.GetCountToReturnToSupply(revealedCard, gameState);
            returnCount = Math.Min(returnCount, maxReturnCount);
            returnCount = Math.Max(returnCount, 0);

            for (int i = 0; i < returnCount; ++i)
            {
                currentPlayer.ReturnCardFromHandToSupply(revealedCard, gameState);
            }

            foreach (PlayerState otherPlayer in gameState.players.OtherPlayers)
            {
                if (!otherPlayer.IsAffectedByAttacks(gameState))
                {
                    otherPlayer.GainCardFromSupply(gameState, revealedCard);
                }
            }
        }
Beispiel #2
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            Card revealedCard = currentPlayer.RequestPlayerRevealCardFromHand(acceptableCard => true, gameState);
            PlayerState.AttackAction attackAction = this.DoEmptyAttack;

            if (revealedCard != null && !revealedCard.isShelter)
            {
                int maxReturnCount = Math.Max(currentPlayer.Hand.CountOf(revealedCard), 2);

                int returnCount = currentPlayer.actions.GetCountToReturnToSupply(revealedCard, gameState);
                returnCount = Math.Min(returnCount, maxReturnCount);
                returnCount = Math.Max(returnCount, 0);

                for (int i = 0; i < returnCount; ++i)
                {
                    if (currentPlayer.hand.HasCard(revealedCard))
                    {
                        currentPlayer.ReturnCardFromHandToSupply(revealedCard, gameState);
                    }
                }

                attackAction = delegate(PlayerState currentPlayer2, PlayerState otherPlayer, GameState gameState2)
                {
                    otherPlayer.GainCardFromSupply(gameState, revealedCard);
                };
            }

            currentPlayer.AttackOtherPlayers(gameState, attackAction);
        }
Beispiel #3
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);
     }
 }
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            Card revealedCard = currentPlayer.RequestPlayerRevealCardFromHand(card => card.isTreasure, gameState);

            if (revealedCard != null)
            {
                currentPlayer.GainCardFromSupply(gameState, revealedCard);
            }
        }
        public override void DoSpecializedAttack(PlayerState currentPlayer, PlayerState otherPlayer, GameState gameState)
        {
            Card baneCard = gameState.BaneCard;
            bool wasBaneRevelaed = otherPlayer.RequestPlayerRevealCardFromHand(card => card == baneCard, gameState) != null;

            if (!wasBaneRevelaed)
            {
                otherPlayer.GainCardFromSupply(Curse.card, gameState);
            }
        }
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            bool someOtherPlayerRevealedProvince = false;

            bool didRevealProvince = currentPlayer.RequestPlayerRevealCardFromHand(card => card == Cards.Province, gameState) != null;

            foreach (PlayerState player in gameState.players.OtherPlayers)
            {
                someOtherPlayerRevealedProvince |= player.RequestPlayerRevealCardFromHand(card => card == Cards.Province, gameState) != null;
                player.MoveAllRevealedCardsToHand();
            }

            if (didRevealProvince)
            {
                currentPlayer.RequestPlayerGainCardFromSupply(gameState,
                    card => card == Cards.Duchy || card.IsType(Cards.Prize),
                    "Must gain a duchy or a prize",
                    isOptional: false,
                    defaultLocation: DeckPlacement.TopOfDeck);
            }

            if (!someOtherPlayerRevealedProvince)
            {
                currentPlayer.DrawOneCardIntoHand(gameState);
                currentPlayer.AddCoins(1);
            }
        }