public void Play()
        {
            foreach (Player player in players)
            {
                Visualization.ShowProgramMessage("Player " + Convert.ToString(player.Id) + " select Deck and Captains");

                Visualization.ShowDecks(decks);
                int  choiceDeck = Visualization.GetUserInput(decks.Count - 1);
                Deck deckChoice = decks[choiceDeck];
                player.Deck = deckChoice;
                player.FirstHand();
                Visualization.ShowCaptains(captains);
                int choiceCaptain = Visualization.GetUserInput(captains.Count - 1);
                player.ChooseCaptainCard(captains[choiceCaptain]);


                Visualization.ShowListOptions(new List <string>()
                {
                    "Change Card", "Pass"
                }, "Change 3 cards or ready to play:");
                int choice     = Visualization.GetUserInput(1);
                int cont       = 0;
                int choiceCard = -1;
                if (choice == 0)
                {
                    while (true)
                    {
                        if (cont != 3)
                        {
                            Visualization.ShowHand(player.Hand);
                            Visualization.ShowProgramMessage("Input the numbers  of the cards to change (max 3). To stop enter -1");
                            choiceCard = Visualization.GetUserInput(player.Hand.Cards.Count - 1, true);
                        }
                        if (choiceCard == -1 || cont == 3)
                        {
                            break;
                        }
                        else
                        {
                            player.ChangeCard(choiceCard);
                            cont++;
                        }
                    }
                }
                Visualization.ClearConsole();
            }
        }
        public void Play()
        {
            List <string> options = new List <string>()
            {
                "Change Card", "Pass"
            };
            string message = "Change 3 cards or ready to play";

            Visualization.ShowProgramMessage($"Player {ActivePlayer.Id} select Deck and Captain");
            Visualization.ShowDecks(Decks);
            int input = Visualization.GetUserInput(2, false);

            ActivePlayer.Deck = Decks[input];
            Visualization.ShowCaptains(Captains);
            int input2 = Visualization.GetUserInput(2, false);

            ActivePlayer.ChooseCaptainCard(Captains[input2]);
            ActivePlayer.FirstHand();
            Visualization.ShowHand(ActivePlayer.Hand);
            Visualization.ShowListOptions(options, message);
            int input3 = Visualization.GetUserInput(2, false);

            if (input3 == 0)
            {
                Console.WriteLine($"Player {ActivePlayer.Id} change cards:");
                Console.WriteLine("Hand:");
                Visualization.ShowHand(ActivePlayer.Hand);
                Console.WriteLine("Input the number of cards to change (max 3). To stop enter -1");
                int input4 = Visualization.GetUserInput(4, true);
                while (input4 > 0) // si el input es 0 o -1 nunca entra al while asi que lo dejo asi tal cual
                {
                    Console.WriteLine("Enter the Card ID you want to change");
                    int cardid = Visualization.GetUserInput(10, true);
                    ActivePlayer.ChangeCard(cardid);
                    input4 -= 1;
                }
            }
            else
            {
                Console.WriteLine($"Player {ActivePlayer.Id} passed");
            }
            Console.WriteLine($"Player {ActivePlayer.Id} turn has finished");
            Console.WriteLine("Press any key to continue");
            Console.ReadKey();
            Visualization.ClearConsole();
        }
Exemplo n.º 3
0
 public void Play()
 {
     for (int i = 1; i <= 2; i++)
     {
         Visualization.ShowProgramMessage($"Player {i} select Deck and Captain: ");
         Visualization.ShowDecks(decks);
         Visualization.GetUserInput(decks.Count);
         Visualization.ShowCaptains(captains);
         Visualization.GetUserInput(captains.Count);
         players[i].FirstHand();
         Visualization.ShowHand(players[i].Hand);
         Visualization.ShowListOptions(new List <string>()
         {
             "Change Card", "Pass"
         }, "Change 3 cards or ready to play");
         int usrdec = Visualization.GetUserInput(1);
         if (usrdec == 0)
         {
             int j = 0;
             while (i < 3)
             {
                 Visualization.ShowProgramMessage($"Player {i} change cards:");
                 Visualization.ShowHand(players[i].Hand);
                 Visualization.ShowProgramMessage("Input the number of the cards to change (max 3). To stop enter -1");
                 int usrdec2 = Visualization.GetUserInput(players[i].Hand.Cards.Count);
                 if (usrdec2 == -1)
                 {
                     break;
                 }
                 Random random    = new Random();
                 int    newrandom = random.Next(players[i].Hand.Cards.Count);
                 players[i].Hand.Cards[newrandom] = this.decks[i].Cards[newrandom];
                 j++;
             }
         }
         Visualization.ClearConsole();
     }
 }
Exemplo n.º 4
0
 public void Play()
 {
     Visualization.ShowCaptains(Captains);
 }
        public void Play()
        {
            for (int readyPlayers = 0; readyPlayers < 2; readyPlayers++)
            {
                visualization.ShowProgramMessage("Player " + (activePlayer.Id + 1) + " Please choose your Deck and Captain");
                visualization.printSeparator();
                visualization.ShowDecks(decks);
                int deckNumberAnswer = visualization.GetUserInput(decks.Count, false);
                visualization.printSeparator();
                activePlayer.Deck = decks[deckNumberAnswer];
                activePlayer.FirstHand();
                visualization.ShowCaptains(captains);
                visualization.printSeparator();
                int captainNumberAnswer = visualization.GetUserInput(Captains.Count, false);
                visualization.printSeparator();
                activePlayer.ChooseCaptainCard(Captains[captainNumberAnswer]);
                visualization.ShowHand(activePlayer.Hand);
                visualization.printSeparator();
                visualization.ShowListOptions(changeCardOptionList, readyOrNot);
                visualization.printSeparator();
                int answerReadyOrNot = visualization.GetUserInput(changeCardOptionList.Count, false);

                if (answerReadyOrNot == 0)
                {
                    visualization.printSeparator();
                    visualization.ShowProgramMessage("Player " + (activePlayer.Id + 1) + " change your cards");
                    visualization.printSeparator();

                    for (int i = 0; i < 3; i++)
                    {
                        visualization.ShowHand(activePlayer.Hand);
                        visualization.printSeparator();
                        visualization.ShowProgramMessage("Input the number of the cards you want to change (Max 3). Input -1 to stop " + i);
                        int loopAnswer = visualization.GetUserInput(activePlayer.Hand.Cards.Count, true);
                        visualization.printSeparator();
                        if (loopAnswer == -1)
                        {
                            i = 4;
                        }
                        else
                        {
                            activePlayer.ChangeCard(loopAnswer);
                        }
                    }

                    visualization.printSeparator();
                    visualization.ShowProgramMessage("Done those all your changes. Now youre ready to fight!!!");
                }
                visualization.printSeparator();
                visualization.ShowProgramMessage("OK Thats all you need Player " + (activePlayer.Id + 1) + " now ... PREPARE TO FIGHT TILL YOUR LAST BREATH");
                visualization.printSeparator();
                visualization.ShowProgramMessage("Press any key to clear console and change player");
                Console.ReadKey();
                visualization.ClearConsole();
                if (activePlayer.Id == players[0].Id)
                {
                    activePlayer = players[1];
                }
                else
                {
                    activePlayer = players[0];
                }
            }
        }
Exemplo n.º 6
0
        public void Play()
        {
            Visualization.ShowProgramMessage("Player 1 select Deck and captain:");
            players[0].Deck = Visualization.ShowDecks(decks);
            players[0].ChooseCaptainCard(Visualization.ShowCaptains(captains));

            players[0].FirstHand();
            Visualization.ShowHand(players[0].Hand);

            bool playerOneSelecting     = true;
            int  numberOfTimesPlayerOne = 0;

            while (playerOneSelecting)
            {
                Visualization.ShowListOptions(new List <string> {
                    "ShowListOptions", "Pass"
                }, "Change 3 cards or ready to play:");
                int userOption = Int32.Parse(System.Console.ReadLine());

                if (userOption == 1)
                {
                    playerOneSelecting = false;
                }
                else
                {
                    if (numberOfTimesPlayerOne < 3)
                    {
                        System.Console.WriteLine("Input the number of the card you wan't to change. To stop write -1");
                        int userCard = Int32.Parse(System.Console.ReadLine());

                        if (userCard == -1)
                        {
                            playerOneSelecting = false;
                        }
                        else
                        {
                            players[0].Hand.Cards.RemoveAt(userCard);


                            Random rnd          = new Random();
                            int    randomNumber = rnd.Next(0, players[0].Deck.Cards.Count);

                            players[0].DrawCard(randomNumber);
                        }
                    }
                    else
                    {
                        Visualization.ConsoleError("Ya no puedes cambiar mas cartas");
                        playerOneSelecting = false;
                    }
                }
            }

            Visualization.ClearConsole();

            Visualization.ShowProgramMessage("Player 2 select Deck and captain:");
            players[1].Deck = Visualization.ShowDecks(decks);
            players[1].ChooseCaptainCard(Visualization.ShowCaptains(captains));

            players[1].FirstHand();
            Visualization.ShowHand(players[1].Hand);

            bool playerTwoSelecting     = true;
            int  numberOfTimesPlayerTwo = 0;

            while (playerTwoSelecting)
            {
                Visualization.ShowListOptions(new List <string> {
                    "ShowListOptions", "Pass"
                }, "Change 3 cards or ready to play:");
                int userOption = Int32.Parse(System.Console.ReadLine());

                if (userOption == 1)
                {
                    playerTwoSelecting = false;
                }
                else
                {
                    if (numberOfTimesPlayerTwo < 3)
                    {
                        System.Console.WriteLine("Input the number of the card you wan't to change. To stop write -1");
                        int userCard = Int32.Parse(System.Console.ReadLine());

                        if (userCard == -1)
                        {
                            playerTwoSelecting = false;
                        }
                        else
                        {
                            players[1].Hand.Cards.RemoveAt(userCard);


                            Random rnd          = new Random();
                            int    randomNumber = rnd.Next(0, players[1].Deck.Cards.Count);

                            players[1].DrawCard(randomNumber);
                        }
                    }
                    else
                    {
                        Visualization.ConsoleError("Ya no puedes cambiar mas cartas");
                        playerTwoSelecting = false;
                    }
                }
            }
            Visualization.ClearConsole();
        }