RequestPlayerChooseBetween() private method

private RequestPlayerChooseBetween ( GameState gameState, IsValidChoice acceptableChoice ) : PlayerActionChoice
gameState GameState
acceptableChoice IsValidChoice
return PlayerActionChoice
Example #1
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");
            }
        }
Example #2
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            PlayerActionChoice choice = currentPlayer.RequestPlayerChooseBetween(gameState,
                acceptableChoice => acceptableChoice == PlayerActionChoice.PutNativeVillageMatInHand ||
                    acceptableChoice == PlayerActionChoice.SetAsideTopCardOnNativeVillageMat);

            if (choice == PlayerActionChoice.PutNativeVillageMatInHand)
            {
                currentPlayer.MoveNativeVillageMatToHand();
            }
            else if (choice == PlayerActionChoice.SetAsideTopCardOnNativeVillageMat)
            {
                currentPlayer.MoveCardFromPlayedCardToNativeVillageMatt(this);
                currentPlayer.PutOnNativeVillageMatCardFromTopOfDeck();
            }
        }
Example #3
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;
                    }
            }
        }
Example #4
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            if (currentPlayer.RequestPlayerTrashCardFromHand(gameState, card => card.isTreasure, isOptional:true) != null)
            {
                PlayerActionChoice choice = currentPlayer.RequestPlayerChooseBetween(
                    gameState,
                    acceptableChoice => acceptableChoice == PlayerActionChoice.PlusCard || acceptableChoice == PlayerActionChoice.PlusCoin);

                switch (choice)
                {
                    case PlayerActionChoice.PlusCard:
                    {
                        currentPlayer.DrawAdditionalCardsIntoHand(2);
                        currentPlayer.AddActions(1);
                        break;
                    }
                    case PlayerActionChoice.PlusCoin:
                    {
                        currentPlayer.AddCoins(2);
                        currentPlayer.AddBuys(1);
                        break;
                    }
                    default:
                        throw new Exception();
                }
            }
        }
Example #5
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");
            }
        }
Example #6
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            IsValidChoice acceptableFirstChoice = delegate(PlayerActionChoice acceptableChoice)
            {
                return acceptableChoice == PlayerActionChoice.PlusCard ||
                       acceptableChoice == PlayerActionChoice.PlusAction ||
                       acceptableChoice == PlayerActionChoice.PlusBuy ||
                       acceptableChoice == PlayerActionChoice.PlusCoin;
            };

            PlayerActionChoice firstChoice = currentPlayer.RequestPlayerChooseBetween(
                gameState,
                acceptableFirstChoice);

            PlayerActionChoice secondChoice = currentPlayer.RequestPlayerChooseBetween(
                gameState,
                acceptableSecondChoice => acceptableSecondChoice != firstChoice && acceptableFirstChoice(acceptableSecondChoice));

            DoActionChoice(currentPlayer, firstChoice);
            DoActionChoice(currentPlayer, secondChoice);
        }
Example #7
0
        public override void OverpayOnPurchase(PlayerState currentPlayer, GameState gameState, int overpayAmount)
        {
            for (int i = 0; i < overpayAmount; ++i)
            {
                if (!currentPlayer.deck.Any())
                    break;

                currentPlayer.LookAtCardsFromDeck(1);

                PlayerActionChoice choice = currentPlayer.RequestPlayerChooseBetween(gameState,
                    acceptableChoice => acceptableChoice == PlayerActionChoice.Trash ||
                                        acceptableChoice == PlayerActionChoice.Discard ||
                                        acceptableChoice == PlayerActionChoice.TopDeck);

                switch (choice)
                {
                    case PlayerActionChoice.Trash:
                        currentPlayer.RequestPlayerTrashLookedAtCard(gameState);
                        break;
                    case PlayerActionChoice.Discard:
                        currentPlayer.MoveLookedAtCardsToDiscard(gameState);
                        break;
                    case PlayerActionChoice.TopDeck:
                        currentPlayer.MoveLookedAtCardToTopOfDeck();
                        break;
                    default:
                        throw new Exception("Unhandled case");
                }
            }
        }
Example #8
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;
            }
        }
Example #9
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();
            }
        }
Example #10
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.RevealCardsFromDeck(3);
     PlayerActionChoice choice = currentPlayer.RequestPlayerChooseBetween(gameState, actionChoice => actionChoice == PlayerActionChoice.Discard || actionChoice == PlayerActionChoice.PutInHand);
     switch (choice)
     {
         case PlayerActionChoice.Discard:
             {
                 currentPlayer.MoveRevealedCardsToDiscard(gameState);
                 currentPlayer.DrawAdditionalCardsIntoHand(3);
                 break;
             }
         case PlayerActionChoice.PutInHand:
             {
                 currentPlayer.MoveAllRevealedCardsToHand();
                 break;
             }
         default:
             throw new Exception();
     }
 }
Example #11
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            IsValidChoice choices = delegate(PlayerActionChoice choice)
            {
                return choice == PlayerActionChoice.PlusCard ||
                       choice == PlayerActionChoice.PlusAction ||
                       choice == PlayerActionChoice.PlusCoin ||
                       choice == PlayerActionChoice.GainCard;
            };

            PlayerActionChoice choice1 = currentPlayer.RequestPlayerChooseBetween(gameState, choices);
            PlayerActionChoice choice2 = currentPlayer.RequestPlayerChooseBetween(gameState, c => choices(c) && c != choice1);

            ApplyChoice(choice1, currentPlayer, gameState);
            ApplyChoice(choice2, currentPlayer, gameState);
        }
Example #12
0
 public override void DoSpecializedAttack(PlayerState currentPlayer, PlayerState otherPlayer, GameState gameState)
 {
     otherPlayer.RevealCardsFromDeck(2, gameState);
     PlayerActionChoice choice = currentPlayer.RequestPlayerChooseBetween(gameState, actionChoice => actionChoice == PlayerActionChoice.Discard || actionChoice == PlayerActionChoice.TopDeck);
     switch (choice)
     {
         case PlayerActionChoice.Discard:
             {
                 otherPlayer.MoveRevealedCardsToDiscard(gameState);
                 break;
             }
         case PlayerActionChoice.TopDeck:
             {
                 otherPlayer.RequestPlayerTopDeckRevealedCardsInAnyOrder(gameState);
                 break;
             }
         default:
             throw new Exception();
     }
 }
Example #13
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");
                }
            }
        }
Example #14
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            currentPlayer.LookAtCardsFromDeck(5);
            PlayerActionChoice choice = currentPlayer.RequestPlayerChooseBetween(gameState,
                acceptableChoice => acceptableChoice == PlayerActionChoice.Discard ||
                                    acceptableChoice == PlayerActionChoice.TopDeck);

            if (choice == PlayerActionChoice.TopDeck)
            {
                currentPlayer.RequestPlayerTopDeckRevealedCardsInAnyOrder(gameState);
            }
            else if (choice == PlayerActionChoice.Discard)
            {
                currentPlayer.MoveRevealedCardsToDiscard(gameState);
            }
        }
Example #15
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            // Choose one: ...
            PlayerActionChoice actionChoice = currentPlayer.RequestPlayerChooseBetween(
                gameState,
                acceptableChoice => acceptableChoice == PlayerActionChoice.Discard || acceptableChoice == PlayerActionChoice.PlusCoin);

            PlayerState.AttackAction attackAction = this.DoEmptyAttack;

            if (actionChoice == PlayerActionChoice.PlusCoin)
            {
                // +2 coin;
                currentPlayer.AddCoins(2);
            }
            else
            {
                // discard your hand,
                currentPlayer.DiscardHand(gameState);
                // +4 cards
                currentPlayer.DrawAdditionalCardsIntoHand(4);

                attackAction = this.DoSpecializedAttackInternal;
            }

            currentPlayer.AttackOtherPlayers(gameState, attackAction);
        }
Example #16
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            PlayerActionChoice choice = currentPlayer.RequestPlayerChooseBetween(gameState,
                acceptableChoice =>
                    acceptableChoice == PlayerActionChoice.PlusCoin ||
                    acceptableChoice == PlayerActionChoice.Trash);

            PlayerState.AttackAction attackAction = this.DoEmptyAttack;

            bool wasACardTrashed = false;

            if (choice == PlayerActionChoice.PlusCoin)
            {
                currentPlayer.AddCoins(currentPlayer.pirateShipTokenCount);
            }
            else if (choice == PlayerActionChoice.Trash)
            {
                throw new NotImplementedException();
            }

            currentPlayer.AttackOtherPlayers(gameState, attackAction);

            if (wasACardTrashed)
            {
                currentPlayer.pirateShipTokenCount++;
            }
        }
Example #17
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            PlayerActionChoice actionChoice = currentPlayer.RequestPlayerChooseBetween(
                gameState,
                acceptableChoice => acceptableChoice == PlayerActionChoice.PlusCard || acceptableChoice == PlayerActionChoice.PlusAction);

            if (actionChoice == PlayerActionChoice.PlusCard)
            {
                currentPlayer.DrawAdditionalCardsIntoHand(3);
            }
            else
            {
                currentPlayer.AddActions(2);
            }
        }
Example #18
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            PlayerActionChoice choice = currentPlayer.RequestPlayerChooseBetween(gameState, c =>
                c == PlayerActionChoice.PutCopperOnTavernMat ||
                c == PlayerActionChoice.PlusCoinPerCoppperOnTavernMat);

            switch (choice)
            {
                case PlayerActionChoice.PutCopperOnTavernMat:
                {
                    currentPlayer.MoveCardFromHandToTavernMatt(Cards.Copper);
                    break;
                }
                case PlayerActionChoice.PlusCoinPerCoppperOnTavernMat:
                {
                    int copperCount = PlayerMiserValue(currentPlayer);
                    currentPlayer.AddCoins(copperCount);
                    break;
                }
            }
        }
Example #19
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            PlayerActionChoice choice = currentPlayer.RequestPlayerChooseBetween(gameState,
                acceptableChoice =>
                    acceptableChoice == PlayerActionChoice.PlusCoin ||
                    acceptableChoice == PlayerActionChoice.Trash);

            PlayerState.AttackAction attackAction = this.DoEmptyAttack;

            bool wasACardTrashed = false;

            if (choice == PlayerActionChoice.PlusCoin)
            {
                currentPlayer.AddCoins(currentPlayer.pirateShipTokenCount);
            }
            else if (choice == PlayerActionChoice.Trash)
            {
                attackAction = delegate (PlayerState currentPlayer2, PlayerState otherPlayer, GameState gameState2)
                {
                    otherPlayer.RevealCardsFromDeck(2, gameState);
                    Card trashedCard = currentPlayer2.RequestPlayerTrashOtherPlayersRevealedCard(gameState2, card => card.isTreasure, otherPlayer);
                    otherPlayer.MoveRevealedCardsToDiscard(gameState);
                    wasACardTrashed |= trashedCard != null;
                };
            }

            currentPlayer.AttackOtherPlayers(gameState, attackAction);

            if (wasACardTrashed)
            {
                currentPlayer.pirateShipTokenCount++;
            }
        }