示例#1
0
        public void TryBuyCardUsingChoosableResouceTwiceTest()
        {
            var player = players[2];

            //Produces 1 papyrus, 1 glass and 1 clay / wood
            player.Cards.Add(cards.First(c => c.Name == CardName.TreeFarm));
            player.Cards.Add(cards.First(c => c.Name == CardName.Glassworks));
            player.ChosenAction = TurnAction.BuyCard;
            //Costs 1 wood, 1 clay and 1 glass
            player.SelectableCards[0] = cards.First(c => c.Name == CardName.Temple);
            player.SelectedCard       = player.SelectableCards.FirstOrDefault(c => c.Name == CardName.Temple);

            players[0].SetWonder(WonderFactory.CreateWonder(WonderName.ColossusOfRhodes, WonderBoardSide.A));
            players[0].ChosenAction = TurnAction.SellCard;
            players[0].SelectedCard = player.SelectableCards.FirstOrDefault(c => c.Name == CardName.Caravansery);

            players[1].ChosenAction = TurnAction.SellCard;
            players[1].SelectedCard = player.SelectableCards.FirstOrDefault(c => c.Name == CardName.Caravansery);

            var uow     = new UnitOfWork();
            var manager = new TurnManager(uow);

            manager.SetCurrentInfo(Age.II, 1);
            manager.Play(players, new List <IStructureCard>());
            uow.Commit();
            Assert.IsFalse(player.Cards.Any(c => c.Name == CardName.Temple));
            Assert.AreEqual(ConstantValues.INITIAL_COINS + ConstantValues.SELL_CARD_COINS, player.Coins);
            Assert.AreEqual(2, player.Cards.Count);
        }
示例#2
0
        public void PlaySeventhCardGetRewardsTest()
        {
            players[0].ExecutedAction = TurnAction.SellCard;
            players[1].ExecutedAction = TurnAction.SellCard;
            players[2].ExecutedAction = TurnAction.SellCard;

            var player = players[0];

            player.Cards.Add(cards.First(c => c.Name == CardName.LumberYard));
            player.Cards.Add(cards.First(c => c.Name == CardName.TimberYard));
            player.SetWonder(WonderFactory.CreateWonder(WonderName.HangingGardensOfBabylon, WonderBoardSide.B));
            player.Wonder.BuildStage();
            player.Wonder.BuildStage();

            //Set to only when card left to choose
            var chosenCard = player.SelectableCards.First();

            player.SetSelectableCards(new List <IStructureCard> {
                chosenCard
            });
            player.ChosenAction = TurnAction.BuyCard;

            var uow     = new UnitOfWork();
            var manager = new TurnManager(uow);

            manager.SetCurrentInfo(Age.I, 6);
            manager.GetMultipleTimesRewards(players, new List <IStructureCard>());
            uow.Commit();

            Assert.IsTrue(player.Cards.Any(c => c.Name == chosenCard.Name));
        }
        public void ComputeCopyBuildCardTest()
        {
            var manager  = new GameFlowManager();
            var cardName = CardName.SpiesGuild;
            var guild    = new GuildCard(cardName, 3, Age.III, null, null, new List <IEffect> {
                new Effect(EffectType.VictoryPointPerMilitaryCard, 1, PlayerDirection.ToTheLeft | PlayerDirection.ToTheRight)
            });

            manager.CreateNewPlayer("ashley");
            manager.CreateNewPlayer("kate");
            manager.SetupGame();
            var player1 = manager.Players[0];
            var player2 = manager.Players[1];

            player1.SetWonder(WonderFactory.CreateWonder(WonderName.StatueOfZeusInOlimpia, WonderBoardSide.B));
            player1.Wonder.BuildStage();
            player1.Wonder.BuildStage();
            player1.Wonder.BuildStage();
            player1.Wonder.EffectsAvailable.First(e => e.Type == EffectType.CopyGuildFromNeighbor).Info = cardName;

            player2.Cards.Add(guild);

            manager.CollectPostGameRewards();

            Assert.IsTrue(player1.Cards.Any(c => c.Name == cardName));
        }
示例#4
0
        public HttpResponseMessage One(string name)
        {
            var wonder = WonderFactory.All().FirstOrDefault(w => string.CompareOrdinal(w.Name, name) == 0);

            return(wonder != default(Wonder)
                ? Request.CreateResponse(HttpStatusCode.OK, wonder)
                : Request.CreateErrorResponse(HttpStatusCode.NoContent, $"Failed to find a wonder with name {name}"));
        }
示例#5
0
        public void Initialize()
        {
            players = new List <ITurnPlayer>
            {
                new TurnPlayer("jennifer"),
                new TurnPlayer("jessica"),
                new TurnPlayer("amanda")
            };

            CreateCards();

            IStructureCard caravansery = cards.First(c => c.Name == CardName.Caravansery);
            IStructureCard foundry     = cards.First(c => c.Name == CardName.Foundry);
            IStructureCard laboratory  = cards.First(c => c.Name == CardName.Laboratory);
            IStructureCard oreVein     = cards.First(c => c.Name == CardName.OreVein);

            #region Player 1
            var player1 = players[0];
            player1.SetSelectableCards(new List <IStructureCard>
            {
                caravansery,
                foundry,
                laboratory,
                oreVein
            });
            player1.SetWonder(WonderFactory.CreateWonder(WonderName.StatueOfZeusInOlimpia, WonderBoardSide.A));
            player1.ReceiveCoin(ConstantValues.INITIAL_COINS);
            player1.InitializeTurnData();
            #endregion

            #region Player 2
            players[1].SetSelectableCards(new List <IStructureCard>
            {
                foundry,
                caravansery,
                laboratory,
                oreVein
            });
            players[1].SetWonder(WonderFactory.CreateWonder(WonderName.LighthouseOfAlexandria, WonderBoardSide.A));
            players[1].ReceiveCoin(ConstantValues.INITIAL_COINS);
            players[1].InitializeTurnData();
            #endregion

            #region Player 3
            players[2].SetSelectableCards(new List <IStructureCard>
            {
                laboratory,
                caravansery,
                foundry,
                oreVein
            });
            players[2].SetWonder(WonderFactory.CreateWonder(WonderName.TempleOfArthemisInEphesus, WonderBoardSide.A));
            players[2].ReceiveCoin(ConstantValues.INITIAL_COINS);
            players[2].InitializeTurnData();
            #endregion
        }
 public void Initialize()
 {
     players = new List <IPlayer>
     {
         new TurnPlayer("angel"),
         new TurnPlayer("barbara"),
         new TurnPlayer("amy")
     };
     ((IGamePlayer)players[0]).SetWonder(WonderFactory.CreateWonder(WonderName.StatueOfZeusInOlimpia, WonderBoardSide.B));
     ((IGamePlayer)players[1]).SetWonder(WonderFactory.CreateWonder(WonderName.HangingGardensOfBabylon, WonderBoardSide.A));
     ((IGamePlayer)players[2]).SetWonder(WonderFactory.CreateWonder(WonderName.LighthouseOfAlexandria, WonderBoardSide.A));
 }
示例#7
0
 void DrawWonderCards()
 {
     LoggerHelper.Info("Randomly drawing wonder cards to players.");
     foreach (var p in this.Players)
     {
         var wonderCard = wonderCards.First();
         wonderCards.Remove(wonderCard);
         var wonder = WonderFactory.CreateWonder(wonderCard.Name, wonderCard.Side);
         LoggerHelper.DebugFormat("Defining side {0} of wonder {1} to player: {2}", wonderCard.Side, wonderCard.Name, p.Name);
         p.SetWonder(wonder);
     }
 }
示例#8
0
        public void Initialize()
        {
            CreateCards();

            players = new List <IPlayer>
            {
                new TurnPlayer("jennifer"),
                new TurnPlayer("jessica"),
                new TurnPlayer("amanda")
            };
            ((IGamePlayer)players[0]).SetWonder(WonderFactory.CreateWonder(WonderName.StatueOfZeusInOlimpia, WonderBoardSide.A));
            ((IGamePlayer)players[1]).SetWonder(WonderFactory.CreateWonder(WonderName.HangingGardensOfBabylon, WonderBoardSide.A));
            ((IGamePlayer)players[2]).SetWonder(WonderFactory.CreateWonder(WonderName.LighthouseOfAlexandria, WonderBoardSide.A));
        }
示例#9
0
        public void ComputeScientificCardsTest()
        {
            var cards = CreateCards();

            var players = new List<IPlayer>
            {
                new TurnPlayer("jennifer"),
                new TurnPlayer("jessica"),
                new TurnPlayer("amanda")
            };

            var player1 = (IGamePlayer)players[0];
            var player2 = (IGamePlayer)players[1];
            var player3 = (IGamePlayer)players[2];

            player1.SetWonder(WonderFactory.CreateWonder(WonderName.StatueOfZeusInOlimpia, WonderBoardSide.A));
            player2.SetWonder(WonderFactory.CreateWonder(WonderName.HangingGardensOfBabylon, WonderBoardSide.A));
            player3.SetWonder(WonderFactory.CreateWonder(WonderName.LighthouseOfAlexandria, WonderBoardSide.A));

            player2.Wonder.BuildStage();
            player2.Wonder.BuildStage();

            //2 tablets, 2 compass, 1 random
            player1.Cards.Add(cards.First(c => c.Name == CardName.Scriptorium));
            player1.Cards.Add(cards.First(c => c.Name == CardName.Dispensary));
            player1.Cards.Add(cards.First(c => c.Name == CardName.Library));
            player1.Cards.Add(cards.First(c => c.Name == CardName.Lodge));
            player1.Cards.Add(cards.First(c => c.Name == CardName.ScientistsGuild));

            //3 compass, 1 gear, 2 random
            player2.Cards.Add(cards.First(c => c.Name == CardName.ScientistsGuild));
            player2.Cards.Add(cards.First(c => c.Name == CardName.Apothecary));
            player2.Cards.Add(cards.First(c => c.Name == CardName.Lodge));
            player2.Cards.Add(cards.First(c => c.Name == CardName.Dispensary));
            player2.Cards.Add(cards.First(c => c.Name == CardName.Observatory));

            //1 each
            player3.Cards.Add(cards.First(c => c.Name == CardName.University));
            player3.Cards.Add(cards.First(c => c.Name == CardName.Lodge));
            player3.Cards.Add(cards.First(c => c.Name == CardName.Observatory));

            var pointsCategory = new ScientificStructuresCategory();
            pointsCategory.ComputePoints(players);

            Assert.AreEqual(16, player1.VictoryPoints);
            Assert.AreEqual(26, player2.VictoryPoints);
            Assert.AreEqual(10, player3.VictoryPoints);
        }
示例#10
0
        public void Initialize()
        {
            manager = new TradeManager(new NullUnitOfWork());

            players = new List <IGamePlayer>
            {
                new TurnPlayer("angel"),
                new TurnPlayer("joseph"),
                new TurnPlayer("tina"),
                new TurnPlayer("laura"),
                new TurnPlayer("larry"),
            };

            players[0].SetWonder(WonderFactory.CreateWonder(WonderName.ColossusOfRhodes, WonderBoardSide.B));
            players[1].SetWonder(WonderFactory.CreateWonder(WonderName.HangingGardensOfBabylon, WonderBoardSide.A));
            players[2].SetWonder(WonderFactory.CreateWonder(WonderName.LighthouseOfAlexandria, WonderBoardSide.A));
            players[3].SetWonder(WonderFactory.CreateWonder(WonderName.MausoleumOfHalicarnassus, WonderBoardSide.A));
            players[4].SetWonder(WonderFactory.CreateWonder(WonderName.PyramidsOfGiza, WonderBoardSide.A));

            CreateCards();
        }
示例#11
0
 public HttpResponseMessage All()
 {
     return(Request.CreateResponse(HttpStatusCode.OK, WonderFactory.All()));
 }