Exemple #1
0
        private static void CheckUserHasTerritories(Player loser, Player winner)
        {
            var board = GameBoard.GetBoard();
            var count = CountPlayersTerritories(loser);

            if (count == 0)
            {
                Console.Clear();
                Colour.SouthAmericaRed("\t     **** Risk! ****\n");
                Console.WriteLine("\t==========================\n");
                Colour.PrintPlayer(loser.Colour, "\t" + loser.Name);
                Console.Write(", You have no remaining territories.");
                Console.Write("\n\tYou have been annihilated, ");
                Colour.SouthAmericaRed("your game is over!!!!");
                Console.Write("\n\tPress any key to continue....");
                Console.ReadKey();

                if (loser.Cards != null && loser.Cards.Count > 0)
                {
                    foreach (var card in loser.Cards)
                    {
                        if (winner.Cards == null)
                        {
                            winner.Cards = new List <Card>();
                            winner.Cards.Add(card);
                        }
                        else
                        {
                            winner.Cards.Add(card);
                        }
                    }

                    Console.Clear();
                    Colour.SouthAmericaRed("\t     **** Risk! ****\n");
                    Console.WriteLine("\t==========================\n");
                    Colour.PrintPlayer(winner.Colour, "\t" + winner.Name);
                    Console.Write(", You have received all of ");
                    Colour.PrintPlayer(loser.Colour, loser.Name + "'s ");
                    Console.Write("game cards.");

                    if (winner.Cards.Count > 6)
                    {
                        board.CurrentPlayer = winner;
                        Console.Write("\n\tYou now have more than 6 game cards.");
                        Console.WriteLine("\tYou must trade cards now.");
                        Console.WriteLine("\tPress any key to continue....");
                        Console.ReadKey();
                        CardTradeingEngine.TradeMenu();
                    }
                    else
                    {
                        Console.WriteLine("\tPress any key to continue....");
                        Console.ReadKey();
                    }
                }

                var playerList = board.GetPlayerList();
                var index      = GameEngine.GetPlayerIndex(loser.Name);
                playerList.RemoveAt(index);

                board.SetPlayerTurnQueue(GameEngine.CreateTurnQueue(board.CurrentPlayer));
            }
        }