AddCoins() private method

private AddCoins ( int coinAmount ) : void
coinAmount int
return void
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);
     }
 }
        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");
            }
        }
        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);
            }
        }
Beispiel #4
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     Card card = currentPlayer.RequestPlayerTrashCardFromHand(gameState, acceptableCard => true, isOptional: false);
     if (card != null)
     {
         currentPlayer.AddCoins(card.CurrentCoinCost(currentPlayer));
     }
 }
Beispiel #5
0
 public override void DoSpecializedDurationActionAtBeginningOfTurn(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.AddCoins(2);
 }
Beispiel #6
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();
                }
            }
        }
Beispiel #7
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.RevealCardsFromDeck(4);
     currentPlayer.AddCoins(currentPlayer.cardsBeingRevealed.CountTypes);
     currentPlayer.MoveRevealedCardsToDiscard(gameState);
 }
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);
     }
 }
Beispiel #9
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            bool[] otherPlayersAffectedByAttacks = new bool[gameState.players.OtherPlayers.Count()];

            // from rule book
            // "Players responding to this attack must choose to do so before you decide whether or not to trash 2 cards"
            int otherIndex = 0;
            foreach (PlayerState otherPlayer in gameState.players.OtherPlayers)
            {
                otherPlayersAffectedByAttacks[otherIndex++] = otherPlayer.IsAffectedByAttacks(gameState);
            }

            if (currentPlayer.RequestPlayerTrashCardsFromHand(gameState, 2, isOptional: true, allOrNone:true).Length == 2)
            {
                currentPlayer.DrawAdditionalCardsIntoHand(2);
                currentPlayer.AddCoins(2);

                otherIndex = 0;
                foreach (PlayerState otherPlayer in gameState.players.OtherPlayers)
                {
                    if (otherPlayersAffectedByAttacks[otherIndex++])
                    {
                        otherPlayer.RequestPlayerDiscardDownToCountInHand(gameState, 3);
                    }
                }
            }
        }
Beispiel #10
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            currentPlayer.RevealCardsFromDeck(1);
            Card revealedCard  = currentPlayer.CardsBeingRevealed.First();

            currentPlayer.RequestPlayerDiscardRevealedCard(gameState);
            currentPlayer.MoveRevealedCardToTopOfDeck();

            if (revealedCard.isAction)
            {
                currentPlayer.AddActions(1);
            }

            if (revealedCard.isTreasure)
            {
                currentPlayer.AddCoins(1);
            }

            if (revealedCard.isVictory)
            {
                currentPlayer.DrawOneCardIntoHand();
            }
        }
Beispiel #11
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.RequestPlayerTrashCardFromHand(gameState, acceptableCard => true, isOptional: false);
     currentPlayer.AddCoins(CurrentCoinValue(gameState));
 }
Beispiel #12
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;
            }
        }
Beispiel #13
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            int discardedCount = currentPlayer.RequestPlayerDiscardCardsFromHand(gameState, currentPlayer.Hand.Count, isOptional:true);
            currentPlayer.DrawAdditionalCardsIntoHand(discardedCount);
            discardedCount = currentPlayer.RequestPlayerDiscardCardsFromHand(gameState, currentPlayer.Hand.Count, isOptional: true);
            currentPlayer.AddCoins(discardedCount);

            // TODO:  How does the player know they are discarding for coins or for card?
            // throw new NotImplementedException();
        }
Beispiel #14
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            currentPlayer.RevealHand();

            currentPlayer.AddCoins(0 - currentPlayer.Hand.CountWhere(card => card.isTreasure));
        }
Beispiel #15
0
 private static void ApplyChoice(PlayerActionChoice choice, PlayerState currentPlayer, GameState gameState)
 {
     switch (choice)
     {
         case PlayerActionChoice.PlusCard: currentPlayer.DrawAdditionalCardsIntoHand(2, gameState); break;
         case PlayerActionChoice.PlusAction: currentPlayer.AddActions(2); break;
         case PlayerActionChoice.PlusCoin: currentPlayer.AddCoins(2); break;
         case PlayerActionChoice.GainCard: currentPlayer.GainCardsFromSupply(gameState, Cards.Silver, 4); break;
         default: throw new Exception();
     }
 }
Beispiel #16
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);
        }
Beispiel #17
0
 private void DoActionChoice(PlayerState currentPlayer, PlayerActionChoice actionChoice)
 {
     switch (actionChoice)
     {
         case PlayerActionChoice.PlusCard: currentPlayer.DrawOneCardIntoHand(); break;
         case PlayerActionChoice.PlusAction: currentPlayer.AddActions(1); break;
         case PlayerActionChoice.PlusBuy: currentPlayer.AddBuys(1); break;
         case PlayerActionChoice.PlusCoin: currentPlayer.AddCoins(1); break;
         default: throw new Exception("Invalid pawn action choice");
     }
 }
Beispiel #18
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     int bankValue = currentPlayer.cardsBeingPlayed.CountWhere(card => card.isTreasure); // +1 because bank is already in the played set
     currentPlayer.AddCoins(bankValue);
 }
Beispiel #19
0
        private void GainBenefitFromCard(Card card, PlayerState currentPlayer)
        {
            if (card.isAction)
            {
                currentPlayer.AddActions(2);
            }

            if (card.isTreasure)
            {
                currentPlayer.AddCoins(2);
            }

            if (card.isVictory)
            {
                currentPlayer.DrawAdditionalCardsIntoHand(2);
            }
        }
Beispiel #20
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            int additionalCoins = gameState.supplyPiles.Where(pile => pile.ProtoTypeCard.isVictory && gameState.HasCardEverBeenGainedFromPile(pile)).Count();
            currentPlayer.AddCoins(additionalCoins);

            currentPlayer.RequestPlayerTrashCardFromHand(gameState, card => true, isOptional: false);
        }
Beispiel #21
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     if (!currentPlayer.CardsInPlay.Where(c => c == FoolsGold.card).Any())
     {
         currentPlayer.AddCoins(1);
     }
     else
     {
         currentPlayer.AddCoins(4);
     }
 }
Beispiel #22
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            int cardDiscardCount = currentPlayer.RequestPlayerDiscardCardsFromHand(gameState, int.MaxValue, isOptional: true);
            currentPlayer.AddCoins(cardDiscardCount);

            foreach (PlayerState otherPlayer in gameState.players.OtherPlayers)
            {
                PlayerActionChoice choice = otherPlayer.RequestPlayerChooseBetween(gameState,
                    isValidChoice => isValidChoice == PlayerActionChoice.Discard ||
                                     isValidChoice == PlayerActionChoice.Nothing);

                switch (choice)
                {
                    case PlayerActionChoice.Discard:
                        {
                            int cardCount = otherPlayer.RequestPlayerDiscardCardsFromHand(gameState, 2, isOptional: false);
                            if (cardCount == 2)
                            {
                                otherPlayer.DrawOneCardIntoHand(gameState);
                            }
                            break;
                        }
                    case PlayerActionChoice.Nothing:
                        break;
                }
            }
        }
Beispiel #23
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     int stoneValue = (currentPlayer.CardsInDeck.Count + currentPlayer.discard.Count) / 5;
     currentPlayer.AddCoins(stoneValue);
 }
Beispiel #24
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            int countEmpty = gameState.supplyPiles.Where(pile => pile.IsEmpty).Count();

            if (countEmpty >= 1)
            {
                currentPlayer.DrawOneCardIntoHand(gameState);

                if (countEmpty >= 2)
                {
                    currentPlayer.AddCoins(1);
                    currentPlayer.AddBuys(1);
                }
            }
        }
Beispiel #25
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++;
            }
        }
Beispiel #26
0
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            Card gainedCard = currentPlayer.RequestPlayerGainCardFromSupply(gameState,
                acceptableCard => acceptableCard.CurrentCoinCost(currentPlayer) <= 4 && acceptableCard.potionCost == 0,
                "Any card costing up to 4");

            if (gainedCard.isAction)
            {
                currentPlayer.AddActions(1);
            }

            if (gainedCard.isTreasure)
            {
                currentPlayer.AddCoins(1);
            }

            if (gainedCard.isVictory)
            {
                currentPlayer.DrawOneCardIntoHand();
            }
        }
Beispiel #27
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     Card card = currentPlayer.TrashCardFromHandOfType(Copper.card, gameState, guaranteeInHand: false);
     if (card != null)
     {
         currentPlayer.AddCoins(3);
     }
 }
Beispiel #28
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     if (currentPlayer.actions.ShouldTrashCard(gameState, this))
     {
         if (currentPlayer.MoveCardFromPlayToTrash(gameState))
         {
             gameState.gameLog.PushScope();
             currentPlayer.AddCoins(2);
             gameState.gameLog.PopScope();
         }
     }
 }
Beispiel #29
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;
                }
            }
        }
Beispiel #30
0
 public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
 {
     currentPlayer.AddCoins(currentPlayer.AvailableActions);
 }