示例#1
0
        public void cellar_discard_success()
        {
            var player  = new Player(1, "b");
            var players = new List <IPlayer>()
            {
                player
            };
            var supply = new Supply(new List <Pile>(), new List <Pile>(), new List <Pile>());
            var vc     = new VictoryCondition();
            var game   = new Game.Game(0, players, supply, vc);

            player.GainToHand(Card.Cellar);
            player.Hand.AddRange(Enumerable.Repeat(Card.Copper, 4));
            player.Deck.AddRange(Enumerable.Repeat(Card.Silver, 5));
            player.PlayStatus = PlayStatus.ActionPhase;
            game.Submit(player.PlayerName, PlayerAction.Play, Card.Cellar);
            game.Submit(player.PlayerName, ActionRequestType.SelectCards, Enumerable.Repeat(Card.Copper, 3));

            var coppersInHand = player.Hand.Count(x => x == Card.Copper);
            var silversInHand = player.Hand.Count(x => x == Card.Silver);
            var discardCount  = player.DiscardPile.Count();

            Assert.Equal(1, coppersInHand);
            Assert.Equal(3, silversInHand);
            Assert.Equal(3, discardCount);
            Assert.Equal(1, player.PlayedCards.Count);
            Assert.Equal(2, player.Deck.Count);
        }
示例#2
0
        public void moat_played_against_witch()
        {
            var playerA = new Player(1, "a");
            var playerB = new Player(1, "b");
            var players = new List <IPlayer>()
            {
                playerA, playerB
            };
            var supply = new Supply(
                new List <Pile> {
                new Pile(Card.Curse, 10)
            },
                new List <Pile>(),
                new List <Pile>());
            var vc   = new VictoryCondition();
            var game = new Game.Game(0, players, supply, vc);

            playerA.GainToHand(Card.Witch);
            playerB.GainToHand(Card.Moat);
            playerA.PlayStatus = PlayStatus.ActionPhase;
            game.Submit(playerA.PlayerName, PlayerAction.Play, Card.Witch);
            game.Submit(playerB.PlayerName, ActionRequestType.SelectCards, new List <Card> {
                Card.Moat
            });

            Assert.Empty(playerB.DiscardPile);
        }
示例#3
0
        public void priest_is_played_with_trashing()
        {
            var player  = new Player(1, "b");
            var players = new List <IPlayer>()
            {
                player
            };
            var supply = new Supply(
                new List <Pile>(),
                new List <Pile>(),
                new List <Pile>());
            var vc   = new VictoryCondition();
            var game = new Game.Game(0, players, supply, vc);


            player.PlayStatus = PlayStatus.ActionPhase;
            player.GainToHand(Card.Copper);
            player.GainToHand(Card.Copper);
            player.GainToHand(Card.Copper);
            player.GainToHand(Card.Priest);
            player.GainToHand(Card.Chapel);
            player.NumberOfActions = 2;
            game.Submit(player.PlayerName, PlayerAction.Play, Card.Priest);
            game.Submit(player.PlayerName, ActionRequestType.SelectCards, new List <Card> {
                Card.Copper
            });
            game.Submit(player.PlayerName, PlayerAction.Play, Card.Chapel);
            game.Submit(player.PlayerName, ActionRequestType.SelectCards, new List <Card> {
                Card.Copper, Card.Copper
            });

            Assert.Equal(6, player.MoneyPlayed);
        }
示例#4
0
        public void artisan_card_too_expensive()
        {
            const Card card         = Card.Artisan;
            const int  supplyAmount = 10;

            var player  = new Player(1, "b");
            var players = new List <IPlayer>()
            {
                player
            };
            var supply = new Supply(new List <Pile>(), new List <Pile>(),
                                    new List <Pile>()
            {
                new Pile(card, supplyAmount),
                new Pile(Card.Chapel, 10)
            });
            var vc   = new VictoryCondition();
            var game = new Game.Game(0, players, supply, vc);

            player.GainToHand(Card.Artisan);
            player.PlayStatus = PlayStatus.ActionPhase;
            game.Submit(player.PlayerName, PlayerAction.Play, Card.Artisan);
            game.Submit(player.PlayerName, ActionRequestType.SelectCards, new List <Card> {
                card
            });

            var actualSupplyCount = game.Supply.KingdomSupply.First().Cards.Count;

            Assert.Empty(player.DiscardPile);
            Assert.Equal(actualSupplyCount, supplyAmount);
        }
示例#5
0
        public void survivors_reorder_top_2()
        {
            var player  = new Player(1, "b");
            var players = new List <IPlayer>()
            {
                player
            };
            var pileFactory = new PileFactory(1);
            var supply      = new Supply(
                new List <Pile>(),
                new List <Pile>(),
                new List <Pile>());
            var vc   = new VictoryCondition();
            var game = new Game.Game(0, players, supply, vc);


            player.GainToHand(Card.Survivors);
            player.Deck.Add(Card.Copper);
            player.Deck.Add(Card.Silver);

            player.PlayStatus = PlayStatus.ActionPhase;
            player.NumberOfActions++;
            game.Submit(player.PlayerName, PlayerAction.Play, Card.Survivors);
            game.Submit(player.PlayerName, ActionRequestType.SelectOptions, new List <ActionResponse> {
                ActionResponse.Put
            });
            game.Submit(player.PlayerName, ActionRequestType.SelectCards, new List <Card> {
                Card.Silver, Card.Copper
            });
            game.CheckPlayStack(player);

            var expected = new List <Card> {
                Card.Silver, Card.Copper
            };

            Assert.Equal(expected, player.Deck);
        }
示例#6
0
        public void merchant_tests()
        {
            var playerA = new Player(1, "a");
            var players = new List <IPlayer>()
            {
                playerA
            };
            var supply = new Supply(
                new List <Pile>(),
                new List <Pile>(),
                new List <Pile>());
            var vc   = new VictoryCondition();
            var game = new Game.Game(0, players, supply, vc);

            playerA.GainToHand(Card.Merchant);
            playerA.GainToHand(Card.Silver);

            playerA.PlayStatus = PlayStatus.ActionPhase;
            game.Submit(playerA.PlayerName, PlayerAction.Play, Card.Merchant);
            playerA.PlayStatus = PlayStatus.BuyPhase;
            game.Submit(playerA.PlayerName, PlayerAction.Play, Card.Silver);

            Assert.Equal(3, playerA.MoneyPlayed);
        }
示例#7
0
        public void emporium_gained_from_remodel()
        {
            var player  = new Player(1, "b");
            var players = new List <IPlayer>()
            {
                player
            };
            var pileFactory = new PileFactory(1);
            var supply      = new Supply(
                new List <Pile>(),
                new List <Pile>(),
                pileFactory.Create(new List <Card> {
                Card.Emporium
            }));
            var vc   = new VictoryCondition();
            var game = new Game.Game(0, players, supply, vc);


            player.GainToHand(Card.Village);
            player.GainToHand(Card.Village);
            player.GainToHand(Card.Village);
            player.GainToHand(Card.Village);
            player.GainToHand(Card.Gold);
            player.GainToHand(Card.Remodel);
            player.PlayStatus = PlayStatus.ActionPhase;
            game.Submit(player.PlayerName, PlayerAction.Play, Card.Village);
            game.Submit(player.PlayerName, PlayerAction.Play, Card.Village);
            game.Submit(player.PlayerName, PlayerAction.Play, Card.Village);
            game.Submit(player.PlayerName, PlayerAction.Play, Card.Village);
            game.Submit(player.PlayerName, PlayerAction.Play, Card.Remodel);
            game.Submit(player.PlayerName, ActionRequestType.SelectCards, new List <Card> {
                Card.Gold
            });
            game.Submit(player.PlayerName, ActionRequestType.SelectCards, new List <Card> {
                Card.Emporium
            });

            Assert.Equal(2, player.VictoryTokens);
        }
示例#8
0
        public void nomad_camp_gained_during_buy_phase()
        {
            var player  = new Player(1, "b");
            var players = new List <IPlayer>()
            {
                player
            };
            var supply = new Supply(
                new List <Pile>(),
                new List <Pile>(),
                new List <Pile>()
            {
                new Pile(Card.NomadCamp, 10)
            });
            var vc   = new VictoryCondition();
            var game = new Game.Game(0, players, supply, vc);

            player.PlayStatus   = PlayStatus.BuyPhase;
            player.NumberOfBuys = 1;
            player.MoneyPlayed  = 10;
            game.Submit(player.PlayerName, PlayerAction.Buy, Card.NomadCamp);
            Assert.Single(player.Deck);
            Assert.Empty(player.DiscardPile);
        }
示例#9
0
        public void ducat_is_gained_in_action_phase()
        {
            var player  = new Player(1, "b");
            var players = new List <IPlayer>()
            {
                player
            };
            var supply = new Supply(
                new List <Pile>(),
                new List <Pile>(),
                new List <Pile>());
            var vc   = new VictoryCondition();
            var game = new Game.Game(0, players, supply, vc);


            player.PlayStatus = PlayStatus.ActionPhase;
            player.GainToHand(Card.Copper);
            player.GainToHand(Card.Ducat);
            game.CheckPlayStack(player);
            game.Submit(player.PlayerName, ActionRequestType.YesNo, ActionResponse.Yes);
            Assert.Equal(PlayStatus.ActionPhase, player.PlayStatus);
            Assert.Single(player.Hand);
            Assert.Single(supply.Trash);
        }
示例#10
0
        public void lighthouse_is_played()
        {
            var player  = new Player(1, "b");
            var players = new List <IPlayer>()
            {
                player
            };
            var supply = new Supply(
                new List <Pile>(),
                new List <Pile>(),
                new List <Pile>());
            var vc   = new VictoryCondition();
            var game = new Game.Game(0, players, supply, vc);

            player.GainToHand(Card.Lighthouse);
            player.PlayStatus = PlayStatus.ActionPhase;
            game.Submit(player.PlayerName, PlayerAction.Play, Card.Lighthouse);
            Assert.Equal(1, player.MoneyPlayed);
            player.EndTurn();
            player.StartTurn(game);
            game.CheckPlayStack(player);

            Assert.Equal(1, player.MoneyPlayed);
        }
示例#11
0
        public void emporium_gained_with_5_actions_in_play()
        {
            var player  = new Player(1, "b");
            var players = new List <IPlayer>()
            {
                player
            };
            var pileFactory = new PileFactory(1);
            var supply      = new Supply(
                new List <Pile>(),
                new List <Pile>(),
                pileFactory.Create(new List <Card> {
                Card.Emporium
            }));
            var vc   = new VictoryCondition();
            var game = new Game.Game(0, players, supply, vc);


            player.GainToHand(Card.Village);
            player.GainToHand(Card.Village);
            player.GainToHand(Card.Village);
            player.GainToHand(Card.Village);
            player.GainToHand(Card.Village);
            player.PlayStatus = PlayStatus.ActionPhase;
            game.Submit(player.PlayerName, PlayerAction.Play, Card.Village);
            game.Submit(player.PlayerName, PlayerAction.Play, Card.Village);
            game.Submit(player.PlayerName, PlayerAction.Play, Card.Village);
            game.Submit(player.PlayerName, PlayerAction.Play, Card.Village);
            game.Submit(player.PlayerName, PlayerAction.Play, Card.Village);
            player.EndActionPhase();
            player.MoneyPlayed  = int.MaxValue;
            player.NumberOfBuys = int.MaxValue;
            game.Submit(player.PlayerName, PlayerAction.Buy, Card.Emporium);

            Assert.Equal(2, player.VictoryTokens);
        }