Esempio n. 1
0
        private static void PlayGame()
        {
            var gameId = gameService.GetAvailableGames().First().Id;

            Console.WriteLine("Joining the game");
            var deck = Serializer.Deserialize <Deck>(File.ReadAllText("Karpen.dck"));

            gameField = gameService.JoinTheActiveGame(networkPlayer.Id, gameId, deck);

            Player      me      = gameField.Players.First(p => p.Id.Equals(networkPlayer.Id));
            PokemonCard starter = me.Hand.OfType <PokemonCard>().Where(p => p.Stage == 0).FirstOrDefault();

            Console.Read();

            Console.WriteLine("Setting active pokemon");
            gameField = gameService.SetActivePokemon(gameId, networkPlayer.Id, starter.Id);

            Console.Read();

            Console.WriteLine("Setting benched pokemon");
            gameField = gameService.AddToBench(gameId, networkPlayer.Id, me.Hand.OfType <PokemonCard>().Where(p => p.Stage == 0).Select(x => x.Id).ToList());

            while (true)
            {
                string input = Console.ReadLine();

                if (input.Trim() == "end")
                {
                    gameService.EndTurn(gameId);
                }
                else if (input.Trim() == "disc")
                {
                    break;
                }
            }

            networkPlayer.Disconnect(true);
        }