Пример #1
0
        public void Play()
        {
            int userInput         = 0;
            int firstOrSecondUser = ActivePlayer.Id == 0 ? 0 : 1;


            //turno 0 o configuracion
            if (turn == 0)
            {
                for (int _ = 0; _ < Players.Length; _++)
                {
                    ActivePlayer = Players[firstOrSecondUser];
                    Visualization.ClearConsole();
                    //Mostrar mensaje de inicio
                    Visualization.ShowProgramMessage($"Player {ActivePlayer.Id+1} select Deck and Captain:");
                    //Preguntar por deck
                    Visualization.ShowDecks(this.Decks);
                    userInput = Visualization.GetUserInput(this.Decks.Count - 1);
                    Deck deck = new Deck();
                    deck.Cards        = new List <Card>(Decks[userInput].Cards);
                    ActivePlayer.Deck = deck;
                    //Preguntar por capitan
                    Visualization.ShowCaptains(Captains);
                    userInput = Visualization.GetUserInput(this.Captains.Count - 1);
                    ActivePlayer.ChooseCaptainCard(new SpecialCard(Captains[userInput].Name, Captains[userInput].Type, Captains[userInput].Effect));
                    //Asignar mano
                    ActivePlayer.FirstHand();
                    //Mostrar mano
                    Visualization.ShowHand(ActivePlayer.Hand);
                    //Mostar opciones, cambiar carta o pasar
                    Visualization.ShowListOptions(new List <string>()
                    {
                        "Change Card", "Pass"
                    }, "Change 3 cards or ready to play:");
                    userInput = Visualization.GetUserInput(1);
                    if (userInput == 0)
                    {
                        Visualization.ClearConsole();
                        Visualization.ShowProgramMessage($"Player {ActivePlayer.Id+1} change cards:");
                        Visualization.ShowHand(ActivePlayer.Hand);
                        for (int i = 0; i < DEFAULT_CHANGE_CARDS_NUMBER; i++)
                        {
                            Visualization.ShowProgramMessage($"Input the numbers of the cards to change (max {DEFAULT_CHANGE_CARDS_NUMBER}). To stop enter -1");
                            userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count, true);
                            if (userInput == -1)
                            {
                                break;
                            }
                            ActivePlayer.ChangeCard(userInput);
                            Visualization.ShowHand(ActivePlayer.Hand);
                        }
                    }
                    firstOrSecondUser = ActivePlayer.Id == 0 ? 1 : 0;
                }
                turn += 1;
            }
        }
        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();
        }
Пример #3
0
        public void Play()
        {
            List <string> changecard = new List <string>();

            changecard.Add("Change Card");
            changecard.Add("Pass");
            Visualizacion.ShowProgramMessage("Player " + ActivePlayer.Id + " please select your deck");
            Visualizacion.ShowDecks(Decks);
            int choice = Visualizacion.GetUserInput(2);

            ActivePlayer.Deck = Decks[choice];
            Visualizacion.ShowCaptains(Captains);
            int choice2 = Visualizacion.GetUserInput(2);

            ActivePlayer.ChooseCaptainCard(Captains[choice2]);
            ActivePlayer.FirstHand();
            Visualizacion.ShowHand(ActivePlayer.Hand);
            Visualizacion.ShowListOption(changecard);

            int choice3 = Visualizacion.GetUserInput(2);
            int p       = 0;

            if (choice3 == 0)
            {
                while (p < 3)
                {
                    Console.WriteLine("Please choose what card to change:");
                    Visualizacion.ShowHand(ActivePlayer.Hand);
                    int choice4 = Visualizacion.GetUserInput(10, true);
                    if (choice4 == -1)
                    {
                        break;
                    }
                    ActivePlayer.ChangeCard(choice4);
                    p++;
                }
            }
            else
            {
                Console.WriteLine("Player " + ActivePlayer.Id + " has passed");
            }
            Console.WriteLine("Player " + ActivePlayer.Id + " has finished his turn 0 play");
            Console.ReadKey();
            Visualizacion.ClearConsole();
        }
Пример #4
0
        public void Play()
        {
            int userInput         = 0;
            int firstOrSecondUser = ActivePlayer.Id == 0 ? 0 : 1;


            //turno 0 o configuracion
            if (turn == 0)
            {
                for (int _ = 0; _ < Players.Length; _++)
                {
                    ActivePlayer = Players[firstOrSecondUser];
                    Visualization.ClearConsole();
                    //Mostrar mensaje de inicio
                    Visualization.ShowProgramMessage($"Player {ActivePlayer.Id+1} select Deck and Captain:");
                    //Preguntar por deck
                    Visualization.ShowDecks(this.Decks);
                    userInput = Visualization.GetUserInput(this.Decks.Count - 1);
                    Deck deck = new Deck();
                    deck.Cards        = new List <Card>(Decks[userInput].Cards);
                    ActivePlayer.Deck = deck;
                    //Preguntar por capitan
                    Visualization.ShowCaptains(Captains);
                    userInput = Visualization.GetUserInput(this.Captains.Count - 1);
                    ActivePlayer.ChooseCaptainCard(new SpecialCard(Captains[userInput].Name, Captains[userInput].Type, Captains[userInput].Effect));
                    //Asignar mano
                    ActivePlayer.FirstHand();
                    //Mostrar mano
                    Visualization.ShowHand(ActivePlayer.Hand);
                    //Mostar opciones, cambiar carta o pasar
                    Visualization.ShowListOptions(new List <string>()
                    {
                        "Change Card", "Pass"
                    }, "Change 3 cards or ready to play:");
                    userInput = Visualization.GetUserInput(1);
                    if (userInput == 0)
                    {
                        Visualization.ClearConsole();
                        Visualization.ShowProgramMessage($"Player {ActivePlayer.Id+1} change cards:");
                        Visualization.ShowHand(ActivePlayer.Hand);
                        for (int i = 0; i < DEFAULT_CHANGE_CARDS_NUMBER; i++)
                        {
                            Visualization.ShowProgramMessage($"Input the numbers of the cards to change (max {DEFAULT_CHANGE_CARDS_NUMBER}). To stop enter -1");
                            userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count, true);
                            if (userInput == -1)
                            {
                                break;
                            }
                            ActivePlayer.ChangeCard(userInput);
                            Visualization.ShowHand(ActivePlayer.Hand);
                        }
                    }
                    firstOrSecondUser = ActivePlayer.Id == 0 ? 1 : 0;
                    Visualization.ClearConsole();
                }
                turn += 1;
            }
            while (CheckIfEndGame() == false)
            {
                int[] lifePoints = new int[2] {
                    players[0].LifePoints, players[1].LifePoints
                };
                int[] attackPoints = new int[2] {
                    players[0].GetAttackPoints()[1], players[1].GetAttackPoints()[1]
                };

                Visualization.ShowBoard(boardGame, firstOrSecondUser, lifePoints, attackPoints);

                Console.WriteLine("\nPress any key to continue");
                Console.ReadKey();
                Visualization.ClearConsole();

                Console.WriteLine($"PLayer [{firstOrSecondUser}], press any key to draw a card");
                Console.ReadKey();

                ActivePlayer.Deck.Shuffle();
                players[firstOrSecondUser].DrawCard(0);
                Visualization.ShowHand(ActivePlayer.Hand);
                Visualization.ShowListOptions(new List <string>()
                {
                    "Play Card", "Pass"
                }, "Make your move player: " + firstOrSecondUser);
                userInput = Visualization.GetUserInput(1);


                int rw = GetRoundWinner();
                if (rw == 0)
                {
                    Console.WriteLine("Its a tie");
                }
                else
                {
                    Console.WriteLine(rw + " wins the round.");
                }
            }

            Visualization.ClearConsole();
            int win = GetWinner();

            if (win == 0)
            {
                Console.WriteLine("Its a tie!");
            }
            else
            {
                Console.WriteLine(win + " wins the round.");
            }
        }
        public void Play()
        {
            int userInput         = 0;
            int firstOrSecondUser = ActivePlayer.Id == 0 ? 0 : 1;
            int winner            = -1;


            while (turn < 4 && !CheckIfEndGame())
            {
                bool drawCard = false;
                //turno 0 o configuracion
                if (turn == 0)
                {
                    activePlayer.CardPlayed += .OnCardPlayed;
                    for (int _ = 0; _ < Players.Length; _++)
                    {
                        ActivePlayer = Players[firstOrSecondUser];
                        Visualization.ClearConsole();
                        //Mostrar mensaje de inicio
                        Visualization.ShowProgramMessage($"Player {ActivePlayer.Id+1} select Deck and Captain:");
                        //Preguntar por deck
                        Visualization.ShowDecks(this.Decks);
                        userInput = Visualization.GetUserInput(this.Decks.Count - 1);
                        Deck deck = new Deck();
                        deck.Cards        = new List <Card>(Decks[userInput].Cards);
                        ActivePlayer.Deck = deck;
                        //Preguntar por capitan
                        Visualization.ShowCaptains(Captains);
                        userInput = Visualization.GetUserInput(this.Captains.Count - 1);
                        ActivePlayer.ChooseCaptainCard(new SpecialCard(Captains[userInput].Name, Captains[userInput].Type, Captains[userInput].CardEffect));
                        //Asignar mano
                        ActivePlayer.FirstHand();
                        //Mostrar mano
                        Visualization.ShowHand(ActivePlayer.Hand);
                        //Mostar opciones, cambiar carta o pasar
                        userInput = -1;
                        int changedCards = 0;
                        while (userInput != 2 && changedCards < DEFAULT_CHANGE_CARDS_NUMBER)
                        {
                            Visualization.ShowListOptions(new List <string>()
                            {
                                "Change Card", "See card", "Pass"
                            }, "Change 3 cards or ready to play:");
                            userInput = Visualization.GetUserInput(2);
                            switch (userInput)
                            {
                            case 0:
                                Visualization.ClearConsole();
                                Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} change cards:");
                                Visualization.ShowHand(ActivePlayer.Hand);
                                Visualization.ShowProgramMessage($"Input the number of the card to change (max {DEFAULT_CHANGE_CARDS_NUMBER}). To stop enter -1");
                                userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count - 1, true);
                                if (userInput == -1)
                                {
                                    continue;
                                }
                                ActivePlayer.ChangeCard(userInput);
                                Visualization.ShowHand(ActivePlayer.Hand);
                                changedCards += 1;
                                userInput     = -1;
                                break;

                            case 1:
                                Visualization.ClearConsole();
                                Visualization.ShowHand(ActivePlayer.Hand);
                                Visualization.ShowProgramMessage($"Input the number of the card to see. To stop enter -1");
                                userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count - 1, true);
                                if (userInput == -1)
                                {
                                    continue;
                                }
                                Visualization.ShowCard(ActivePlayer.Hand.Cards[userInput]);
                                userInput = -1;
                                break;

                            default:
                                break;
                            }
                        }

                        firstOrSecondUser = ActivePlayer.Id == 0 ? 1 : 0;
                    }
                    turn += 1;
                }
                //turnos siguientes
                else
                {
                    Boolean cycle = true;
                    while (cycle)
                    {
                        ActivePlayer = Players[firstOrSecondUser];
                        //Obtener lifePoints
                        int[] lifePoints = new int[2] {
                            Players[0].LifePoints, Players[1].LifePoints
                        };
                        //Obtener total de ataque:
                        int[] attackPoints = new int[2] {
                            Players[0].GetAttackPoints()[0], Players[1].GetAttackPoints()[0]
                        };
                        //Mostrar tablero, mano y solicitar jugada
                        Visualization.ClearConsole();
                        Visualization.ShowBoard(boardGame, ActivePlayer.Id, lifePoints, attackPoints);
                        //Robar carta
                        if (!drawCard)
                        {
                            ActivePlayer.DrawCard();
                            drawCard = true;
                        }
                        Visualization.ShowHand(ActivePlayer.Hand);
                        Visualization.ShowListOptions(new List <string> {
                            "Play Card", "See card", "Pass"
                        }, $"Make your move player {ActivePlayer.Id+1}:");
                        userInput = Visualization.GetUserInput(2);
                        switch (userInput)
                        {
                        case 0:
                            //Si la carta es un buff solicitar a la fila que va.
                            Visualization.ShowProgramMessage($"Input the number of the card to play. To cancel enter -1");
                            userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count - 1, true);
                            if (userInput != -1)
                            {
                                if (ActivePlayer.Hand.Cards[userInput].Type == EnumType.buff)
                                {
                                    Visualization.ShowListOptions(new List <string> {
                                        "Melee", "Range", "LongRange"
                                    }, $"Choose row to buff {ActivePlayer.Id}:");
                                    int cardId = userInput;
                                    userInput = Visualization.GetUserInput(2);
                                    if (userInput == 0)
                                    {
                                        ActivePlayer.PlayCard(cardId, EnumType.buffmelee);
                                    }
                                    else if (userInput == 1)
                                    {
                                        ActivePlayer.PlayCard(cardId, EnumType.buffrange);
                                    }
                                    else
                                    {
                                        ActivePlayer.PlayCard(cardId, EnumType.bufflongRange);
                                    }
                                }
                                else
                                {
                                    ActivePlayer.PlayCard(userInput);
                                }
                            }
                            //Revisar si le quedan cartas, si no le quedan obligar a pasar.
                            if (ActivePlayer.Hand.Cards.Count == 0)
                            {
                                firstOrSecondUser = ActivePlayer.Id == 0 ? 1 : 0;
                                break;
                            }
                            break;

                        case 1:
                            Visualization.ClearConsole();
                            Visualization.ShowHand(ActivePlayer.Hand);
                            Visualization.ShowProgramMessage($"Input the number of the card to see. To stop enter -1");
                            userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count - 1, true);
                            if (userInput == -1)
                            {
                                continue;
                            }
                            Visualization.ShowCard(ActivePlayer.Hand.Cards[userInput]);
                            Visualization.ShowListOptions(new List <string> {
                                "Continue"
                            });
                            userInput = Visualization.GetUserInput(0);
                            break;

                        default:
                            firstOrSecondUser = ActivePlayer.Id == 0 ? 1 : 0;
                            cycle             = false;
                            break;
                        }
                    }
                    //Cambiar al oponente si no ha jugado
                    if (!bothPlayersPlayed)
                    {
                        bothPlayersPlayed = true;
                        drawCard          = false;
                    }
                    //Si ambos jugaron obtener el ganador de la ronda, reiniciar el tablero y pasar de turno.
                    else
                    {
                        winner = GetRoundWinner();
                        if (winner == 0)
                        {
                            Players[1].LifePoints -= 1;
                        }
                        else if (winner == 1)
                        {
                            Players[0].LifePoints -= 1;
                        }
                        else
                        {
                            Players[0].LifePoints -= 1;
                            Players[1].LifePoints -= 1;
                        }
                        bothPlayersPlayed = false;
                        turn += 1;
                        //Destruir Cartas
                        BoardGame.DestroyCards();
                    }
                }
                actualData["decks"]             = Decks;
                actualData["captains"]          = Captains;
                actualData["players"]           = Players;
                actualData["activePlayer"]      = Players[ActivePlayer.Id == 0 ? 1 : 0];
                actualData["board"]             = BoardGame;
                actualData["turn"]              = turn;
                actualData["bothPlayersPlayed"] = bothPlayersPlayed;
                SaveData();
            }
            //Definir cual es el ganador.
            winner = GetWinner();
            if (winner == 0)
            {
                Visualization.ShowProgramMessage($"Player 1 is the winner!");
            }
            else if (winner == 1)
            {
                Visualization.ShowProgramMessage($"Player 2 is the winner!");
            }
            else
            {
                Visualization.ShowProgramMessage($"Draw!");
            }
        }
Пример #6
0
        public void Play()
        {
            int  userInput         = 0;
            int  firstOrSecondUser = ActivePlayer.Id == 0 ? 0 : 1;
            int  winner            = -1;
            bool bothPlayersPlayed = false;


            while (turn < 4 && !CheckIfEndGame())
            {
                bool drawCard = false;
                //turno 0 o configuracion
                if (turn == 0)
                {
                    for (int _ = 0; _ < Players.Length; _++)
                    {
                        ActivePlayer = Players[firstOrSecondUser];
                        Visualization.ClearConsole();
                        //Mostrar mensaje de inicio
                        Visualization.ShowProgramMessage($"Player {ActivePlayer.Id+1} select Deck and Captain:");
                        //Preguntar por deck
                        Visualization.ShowDecks(this.Decks);
                        userInput = Visualization.GetUserInput(this.Decks.Count - 1);
                        Deck deck = new Deck();
                        deck.Cards        = new List <Card>(Decks[userInput].Cards);
                        ActivePlayer.Deck = deck;
                        // mostrar cartas del mazo

                        List <string> ab1 = deck.GetCharacteristics();
                        // no coloco los console write ya que ya estan en la funcion

                        //Preguntar por capitan
                        Visualization.ShowCaptains(Captains);
                        userInput = Visualization.GetUserInput(this.Captains.Count - 1);
                        ActivePlayer.ChooseCaptainCard(new SpecialCard(Captains[userInput].Name, Captains[userInput].Type, Captains[userInput].Effect));

                        // mostrar info del capi

                        List <string> ab2 = ActivePlayer.Captain.GetCharacteristics();
                        //  no coloco los console write ya que ya estan en la funcion

                        //Asignar mano
                        ActivePlayer.FirstHand();
                        //Mostrar mano
                        Visualization.ShowHand(ActivePlayer.Hand);
                        //Mostar opciones, cambiar carta o pasar
                        Visualization.ShowListOptions(new List <string>()
                        {
                            "Change Card", "Pass"
                        }, "Change 3 cards or ready to play:");
                        userInput = Visualization.GetUserInput(1);
                        if (userInput == 0)
                        {
                            Visualization.ClearConsole();
                            Visualization.ShowProgramMessage($"Player {ActivePlayer.Id+1} change cards:");
                            Visualization.ShowHand(ActivePlayer.Hand);
                            for (int i = 0; i < DEFAULT_CHANGE_CARDS_NUMBER; i++)
                            {
                                Visualization.ShowProgramMessage($"Input the numbers of the cards to change (max {DEFAULT_CHANGE_CARDS_NUMBER}). To stop enter -1");
                                userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count, true);
                                if (userInput == -1)
                                {
                                    break;
                                }
                                ActivePlayer.ChangeCard(userInput);
                                Visualization.ShowHand(ActivePlayer.Hand);
                            }
                        }
                        firstOrSecondUser = ActivePlayer.Id == 0 ? 1 : 0;
                    }
                    // guardar turno 0
                    SaveData();

                    turn += 1;
                }
                //turnos siguientes
                else
                {
                    while (true)
                    {
                        ActivePlayer = Players[firstOrSecondUser];
                        //Obtener lifePoints
                        int[] lifePoints = new int[2] {
                            Players[0].LifePoints, Players[1].LifePoints
                        };
                        //Obtener total de ataque:
                        int[] attackPoints = new int[2] {
                            Players[0].GetAttackPoints()[0], Players[1].GetAttackPoints()[0]
                        };
                        //Mostrar tablero, mano y solicitar jugada
                        Visualization.ClearConsole();
                        Visualization.ShowBoard(boardGame, ActivePlayer.Id, lifePoints, attackPoints);
                        //Robar carta
                        if (!drawCard)
                        {
                            ActivePlayer.DrawCard();
                            drawCard = true;
                        }
                        Visualization.ShowHand(ActivePlayer.Hand);
                        Visualization.ShowListOptions(new List <string> {
                            "Play Card", "Pass"
                        }, $"Make your move player {ActivePlayer.Id+1}:");
                        userInput = Visualization.GetUserInput(1);
                        if (userInput == 0)
                        {
                            //Si la carta es un buff solicitar a la fila que va.
                            Visualization.ShowProgramMessage($"Input the number of the card to play. To cancel enter -1");
                            userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count, true);
                            if (userInput != -1)
                            {
                                if (ActivePlayer.Hand.Cards[userInput].Type == EnumType.buff)
                                {
                                    Visualization.ShowListOptions(new List <string> {
                                        "Melee", "Range", "LongRange"
                                    }, $"Choose row to buff {ActivePlayer.Id}:");
                                    int cardId = userInput;
                                    userInput = Visualization.GetUserInput(2);
                                    if (userInput == 0)
                                    {
                                        ActivePlayer.PlayCard(cardId, EnumType.buffmelee);
                                    }
                                    else if (userInput == 1)
                                    {
                                        ActivePlayer.PlayCard(cardId, EnumType.buffrange);
                                    }
                                    else
                                    {
                                        ActivePlayer.PlayCard(cardId, EnumType.bufflongRange);
                                    }
                                }
                                else
                                {
                                    ActivePlayer.PlayCard(userInput);
                                }
                            }
                            //Revisar si le quedan cartas, si no le quedan obligar a pasar.
                            if (ActivePlayer.Hand.Cards.Count == 0)
                            {
                                firstOrSecondUser = ActivePlayer.Id == 0 ? 1 : 0;
                                // guardar antes de pasar
                                SaveData();
                                break;
                            }
                        }
                        else
                        {
                            firstOrSecondUser = ActivePlayer.Id == 0 ? 1 : 0;
                            // guardar antes de pasar
                            SaveData();

                            break;
                        }
                    }
                    //Cambiar al oponente si no ha jugado
                    if (!bothPlayersPlayed)
                    {
                        bothPlayersPlayed = true;
                        drawCard          = false;
                    }
                    //Si ambos jugaron obtener el ganador de la ronda, reiniciar el tablero y pasar de turno.
                    else
                    {
                        winner = GetRoundWinner();
                        if (winner == 0)
                        {
                            Players[1].LifePoints -= 1;
                        }
                        else if (winner == 1)
                        {
                            Players[0].LifePoints -= 1;
                        }
                        else
                        {
                            Players[0].LifePoints -= 1;
                            Players[1].LifePoints -= 1;
                        }
                        bothPlayersPlayed = false;
                        turn += 1;
                        //Destruir Cartas
                        BoardGame.DestroyCards();
                    }
                }
            }
            //Definir cual es el ganador.
            winner = GetWinner();
            if (winner == 0)
            {
                Visualization.ShowProgramMessage($"Player 1 is the winner!");
            }
            else if (winner == 1)
            {
                Visualization.ShowProgramMessage($"Player 2 is the winner!");
            }
            else
            {
                Visualization.ShowProgramMessage($"Draw!");
            }
        }
        public void Play()
        {
            int  userInput         = 0;
            int  firstOrSecondUser = ActivePlayer.Id == 0 ? 0 : 1;
            int  winner            = -1;
            bool bothPlayersPlayed = false;
            int  contadorDeCambios = 0;


            while (turn < 4 && !CheckIfEndGame())
            {
                bool verificar = Visualization.ShowMenuCarga();
                if (verificar == false)
                {
                    bool drawCard = false;
                    //turno 0 o configuracion
                    if (turn == 0)
                    {
                        for (int _ = 0; _ < Players.Length; _++)
                        {
                            ActivePlayer = Players[firstOrSecondUser];
                            Visualization.ClearConsole();
                            //Mostrar mensaje de inicio
                            Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} select Deck and Captain:");
                            //Preguntar por deck
                            Visualization.ShowDecks(this.Decks);
                            userInput = Visualization.GetUserInput(this.Decks.Count - 1);
                            Deck deck = new Deck();
                            deck.Cards        = new List <Card>(Decks[userInput].Cards);
                            ActivePlayer.Deck = deck;
                            //Preguntar por capitan
                            Visualization.ShowCaptains(Captains);
                            userInput = Visualization.GetUserInput(this.Captains.Count - 1);
                            ActivePlayer.ChooseCaptainCard(new SpecialCard(Captains[userInput].Name, Captains[userInput].Type, Captains[userInput].Effect));
                            //Asignar mano
                            ActivePlayer.FirstHand();
                            //Mostrar mano
                            Visualization.ShowHand(ActivePlayer.Hand);
                            //Mostar opciones, cambiar carta o pasar
                            Visualization.ShowListOptions(new List <string>()
                            {
                                "Change Card", "Pass"
                            }, "Change 3 cards or ready to play:");
                            userInput = Visualization.GetUserInput(1);
                            if (userInput == 0)
                            {
                                if (contadorDeCambios < 3)
                                {
                                    Visualization.ClearConsole();
                                    Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} change cards:");
                                    Visualization.ShowHand(ActivePlayer.Hand);
                                    for (int i = 0; i < DEFAULT_CHANGE_CARDS_NUMBER; i++)
                                    {
                                        Visualization.ShowProgramMessage($"Input the numbers of the cards to change (max {DEFAULT_CHANGE_CARDS_NUMBER}). To stop enter -1");
                                        userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count, true);
                                        if (userInput == -1)
                                        {
                                            break;
                                        }
                                        ActivePlayer.ChangeCard(userInput);
                                        Visualization.ShowHand(ActivePlayer.Hand);
                                    }
                                }
                                else
                                {
                                    Visualization.ShowProgramMessage("Ya no puedes hacer mas cambios");
                                    Visualization.ShowProgramMessage("Presiona una tecla para continuar");
                                    Console.ReadKey();
                                    Visualization.ClearConsole();
                                }
                            }
                            else if (userInput == 1)
                            {
                                Visualization.ClearConsole();
                                Visualization.ShowHand(activePlayer.Hand);
                                Visualization.ShowProgramMessage("Ingrese el id de la carta para ver la informacion de esta");
                                userInput = Visualization.GetUserInput(activePlayer.Hand.Cards.Count, true);
                                if (userInput != -1)
                                {
                                    if (activePlayer.Hand.Cards[userInput] is CombatCard)
                                    {
                                        CombatCard    card       = activePlayer.Hand.Cards[userInput] as CombatCard;
                                        List <string> componente = new List <string>()
                                        {
                                            "Name: ", "Type: ", "Effect: ", "Attack Points: ", "Hero: "
                                        };
                                        int i = 0;
                                        foreach (string com in componente)
                                        {
                                            Visualization.ShowProgramMessage(com + card.GetCharacteristics()[i]);
                                            i++;
                                        }
                                    }
                                    else
                                    {
                                        SpecialCard   card       = activePlayer.Hand.Cards[userInput] as SpecialCard;
                                        List <string> componente = new List <string>()
                                        {
                                            "Name: ", "Type: ", "Effect: ", "Buff: "
                                        };
                                        int i = 0;
                                        foreach (string co in componente)
                                        {
                                            Visualization.ShowProgramMessage(co + card.GetCharacteristics()[i]);
                                            i++;
                                        }
                                    }
                                }
                            }
                            else if (userInput == 2)
                            {
                                firstOrSecondUser = ActivePlayer.Id == 0 ? 1 : 0;
                            }
                            contadorDeCambios = 0;
                        }
                        turn += 1;
                        Save();
                    }


                    //turnos siguientes
                    else
                    {
                        while (true)
                        {
                            ActivePlayer = Players[firstOrSecondUser];
                            //Obtener lifePoints
                            int[] lifePoints = new int[2] {
                                Players[0].LifePoints, Players[1].LifePoints
                            };
                            //Obtener total de ataque:
                            int[] attackPoints = new int[2] {
                                Players[0].GetAttackPoints()[0], Players[1].GetAttackPoints()[0]
                            };
                            //Mostrar tablero, mano y solicitar jugada
                            Visualization.ClearConsole();
                            Visualization.ShowBoard(boardGame, ActivePlayer.Id, lifePoints, attackPoints);
                            //Robar carta
                            if (!drawCard)
                            {
                                ActivePlayer.DrawCard();
                                drawCard = true;
                            }
                            Visualization.ShowHand(ActivePlayer.Hand);
                            Visualization.ShowListOptions(new List <string> {
                                "Play Card", "Pass"
                            }, $"Make your move player {ActivePlayer.Id + 1}:");
                            userInput = Visualization.GetUserInput(1);
                            if (userInput == 0)
                            {
                                //Si la carta es un buff solicitar a la fila que va.
                                Visualization.ShowProgramMessage($"Input the number of the card to play. To cancel enter -1");
                                userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count, true);
                                if (userInput != -1)
                                {
                                    if (ActivePlayer.Hand.Cards[userInput].Type == EnumType.buff)
                                    {
                                        Visualization.ShowListOptions(new List <string> {
                                            "Melee", "Range", "LongRange"
                                        }, $"Choose row to buff {ActivePlayer.Id}:");
                                        int cardId = userInput;
                                        userInput = Visualization.GetUserInput(2);
                                        if (userInput == 0)
                                        {
                                            ActivePlayer.PlayCard(cardId, EnumType.buffmelee);
                                        }
                                        else if (userInput == 1)
                                        {
                                            ActivePlayer.PlayCard(cardId, EnumType.buffrange);
                                        }
                                        else
                                        {
                                            ActivePlayer.PlayCard(cardId, EnumType.bufflongRange);
                                        }
                                    }
                                    else
                                    {
                                        ActivePlayer.PlayCard(userInput);
                                    }
                                }
                                //Revisar si le quedan cartas, si no le quedan obligar a pasar.
                                if (ActivePlayer.Hand.Cards.Count == 0)
                                {
                                    firstOrSecondUser = ActivePlayer.Id == 0 ? 1 : 0;
                                    Save();
                                    break;
                                }
                            }
                            else if (userInput == 1)
                            {
                                Visualization.ClearConsole();
                                Visualization.ShowHand(activePlayer.Hand);
                                Visualization.ShowProgramMessage("Ingrese el id de la carta para ver la informacion de esta");
                                userInput = Visualization.GetUserInput(activePlayer.Hand.Cards.Count, true);
                                if (userInput != -1)
                                {
                                    if (activePlayer.Hand.Cards[userInput] is CombatCard)
                                    {
                                        CombatCard    card       = activePlayer.Hand.Cards[userInput] as CombatCard;
                                        List <string> componente = new List <string>()
                                        {
                                            "Name: ", "Type: ", "Effect: ", "Attack Points: ", "Hero: "
                                        };
                                        int i = 0;
                                        foreach (string com in componente)
                                        {
                                            Visualization.ShowProgramMessage(com + card.GetCharacteristics()[i]);
                                            i++;
                                        }
                                    }
                                    else
                                    {
                                        SpecialCard   card       = activePlayer.Hand.Cards[userInput] as SpecialCard;
                                        List <string> componente = new List <string>()
                                        {
                                            "Name: ", "Type: ", "Effect: ", "Buff: "
                                        };
                                        int i = 0;
                                        foreach (string co in componente)
                                        {
                                            Visualization.ShowProgramMessage(co + card.GetCharacteristics()[i]);
                                            i++;
                                        }
                                    }
                                }
                            }
                            else if (userInput == 2)
                            {
                                firstOrSecondUser = ActivePlayer.Id == 0 ? 1 : 0;
                                Save();
                                break;
                            }
                        }
                    }
                    //Cambiar al oponente si no ha jugado
                    if (!bothPlayersPlayed)
                    {
                        bothPlayersPlayed = true;
                        drawCard          = false;
                    }
                    //Si ambos jugaron obtener el ganador de la ronda, reiniciar el tablero y pasar de turno.
                    else
                    {
                        winner = GetRoundWinner();
                        if (winner == 0)
                        {
                            Players[1].LifePoints -= 1;
                        }
                        else if (winner == 1)
                        {
                            Players[0].LifePoints -= 1;
                        }
                        else
                        {
                            Players[0].LifePoints -= 1;
                            Players[1].LifePoints -= 1;
                        }
                        bothPlayersPlayed = false;
                        turn += 1;
                        //Destruir Cartas
                        BoardGame.DestroyCards();
                    }
                }
            }
            //Definir cual es el ganador.
            winner = GetWinner();
            if (winner == 0)
            {
                Visualization.ShowProgramMessage($"Player 1 is the winner!");
            }
            else if (winner == 1)
            {
                Visualization.ShowProgramMessage($"Player 2 is the winner!");
            }
            else
            {
                Visualization.ShowProgramMessage($"Draw!");
            }
            Save();
        }
Пример #8
0
        public void Play()
        {
            int  userInput         = 0;
            int  useInputB         = 0;
            int  firstOrSecondUser = ActivePlayer.Id == 0 ? 0 : 1;
            bool GameSwitch        = false;

            //int count1=  0;//
            //int count2 = 0;//

            /*IAttackPoints playa1 = players[0];
             * IAttackPoints playa2 = players[1];
             * LifeP[0] = players[0].LifePoints;
             * LifeP[1] = players[1].LifePoints;
             * for(int m = 0; m < playa1.GetAttackPoints(EnumType.None).Length; m++)
             * {
             *  count1 += playa1.GetAttackPoints(EnumType.None)[m];
             * }
             * for (int n = 0; n < playa2.GetAttackPoints(EnumType.None).Length; n++)
             * {
             *  count2 += playa2.GetAttackPoints(EnumType.None)[n];
             * }
             * AttackP[0] = playa1.GetAttackPoints(EnumType.None)[0];
             * AttackP[1] = playa2.GetAttackPoints(EnumType.None)[0];*/



            //turno 0 o configuracion
            if (turn == 0)
            {
                for (int _ = 0; _ < Players.Length; _++)
                {
                    ActivePlayer = Players[firstOrSecondUser];
                    Visualization.ClearConsole();
                    //Mostrar mensaje de inicio
                    Visualization.ShowProgramMessage($"Player {ActivePlayer.Id+1} select Deck and Captain:");
                    //Preguntar por deck
                    Visualization.ShowDecks(this.Decks);
                    userInput = Visualization.GetUserInput(this.Decks.Count - 1);
                    Deck deck = new Deck();
                    deck.Cards        = new List <Card>(Decks[userInput].Cards);
                    ActivePlayer.Deck = deck;
                    //Preguntar por capitan
                    Visualization.ShowCaptains(Captains);
                    userInput = Visualization.GetUserInput(this.Captains.Count - 1);
                    ActivePlayer.ChooseCaptainCard(new SpecialCard(Captains[userInput].Name, Captains[userInput].Type, Captains[userInput].Effect));
                    //Asignar mano
                    ActivePlayer.FirstHand();
                    //Mostrar mano
                    Visualization.ShowHand(ActivePlayer.Hand);
                    //Mostar opciones, cambiar carta o pasar
                    Visualization.ShowListOptions(new List <string>()
                    {
                        "Change Card", "Pass"
                    }, "Change 3 cards or ready to play:");
                    userInput = Visualization.GetUserInput(1);
                    if (userInput == 0)
                    {
                        Visualization.ClearConsole();
                        Visualization.ShowProgramMessage($"Player {ActivePlayer.Id+1} change cards:");
                        Visualization.ShowHand(ActivePlayer.Hand);
                        for (int i = 0; i < DEFAULT_CHANGE_CARDS_NUMBER; i++)
                        {
                            Visualization.ShowProgramMessage($"Input the numbers of the cards to change (max {DEFAULT_CHANGE_CARDS_NUMBER}). To stop enter -1");
                            userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count, true);
                            if (userInput == -1)
                            {
                                break;
                            }
                            ActivePlayer.ChangeCard(userInput);
                            Visualization.ShowHand(ActivePlayer.Hand);
                        }
                    }
                    firstOrSecondUser = ActivePlayer.Id == 0 ? 1 : 0;
                }
                turn += 1;
            }

            IAttackPoints playa1 = players[0];
            IAttackPoints playa2 = players[1];

            LifeP[0] = players[0].LifePoints;
            LifeP[1] = players[1].LifePoints;

            /*for(int y = 0; y < players[0].Hand.Cards.Count; y++)
             * {
             *  if (players[0].Hand.Cards[y] is CombatCard)
             *  {
             *      BoardGame.AddCard(players[0].Hand.Cards[y], 0, players[0].Hand.Cards[y].Type);
             *  }
             * }
             *
             * for (int w = 0; w < players[1].Hand.Cards.Count; w++)
             * {
             *  if (players[1].Hand.Cards[w] is CombatCard)
             *  {
             *      BoardGame.AddCard(players[1].Hand.Cards[w], 1, players[1].Hand.Cards[w].Type);
             *  }
             *
             * }*/



            while (GameSwitch != true)
            {
                if (ActivePlayer.Id == 0)
                {
                    Visualization.ShowBoard(BoardGame, ActivePlayer.Id, LifeP, AttackP);
                    Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} will draw a card");
                    ActivePlayer.DrawCard();
                    Visualization.ShowHand(ActivePlayer.Hand);
                    Visualization.ShowListOptions(new List <string>()
                    {
                        "Play Card", "Pass"
                    });
                    userInput = Visualization.GetUserInput(1);
                    if (userInput == 0)
                    {
                        Visualization.ClearConsole();
                        Visualization.ShowBoard(BoardGame, ActivePlayer.Id, LifeP, AttackP);
                        Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} play cards:");
                        Visualization.ShowHand(ActivePlayer.Hand);
                        Visualization.ShowProgramMessage($"Input the number of the cards you'd like to  play (max {ActivePlayer.Hand.Cards.Count}). To stop enter -1");
                        userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count);

                        Visualization.ClearConsole();
                        if (ActivePlayer.Hand.Cards[userInput].Type == EnumType.buff)
                        {
                            Visualization.ShowProgramMessage("Please Select which type you'd like to buff:");
                            Visualization.ShowProgramMessage("(0): LongRange (1): Range (2): Melee");
                            useInputB = Visualization.GetUserInput(2);

                            switch (useInputB)
                            {
                            case 0:
                                ActivePlayer.PlayCard(userInput, EnumType.bufflongRange);
                                break;

                            case 1:
                                ActivePlayer.PlayCard(userInput, EnumType.buffrange);
                                break;

                            case 2:
                                ActivePlayer.PlayCard(userInput, EnumType.buffmelee);
                                break;
                            }
                        }
                        else
                        {
                            ActivePlayer.PlayCard(userInput, ActivePlayer.Hand.Cards[userInput].Type);
                        }

                        AttackP[ActivePlayer.Id] = playa1.GetAttackPoints(EnumType.None)[0];
                        //Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} has played{ActivePlayer.Hand.Cards[userInput].Name} ");//
                        Visualization.ShowHand(ActivePlayer.Hand);
                        Visualization.ShowBoard(BoardGame, ActivePlayer.Id, LifeP, AttackP);
                    }
                    Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} Turn has ended please press anykey to continue to the next player turn");
                    Console.ReadKey();
                    Visualization.ClearConsole();
                    ActivePlayer.Id += 1;
                    Visualization.ShowBoard(BoardGame, ActivePlayer.Id, LifeP, AttackP);
                    Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} will draw a card");
                    ActivePlayer.DrawCard();
                    Visualization.ShowHand(ActivePlayer.Hand);
                    Visualization.ShowListOptions(new List <string>()
                    {
                        "Play Card", "Pass"
                    });
                    userInput = Visualization.GetUserInput(1);
                    if (userInput == 0)
                    {
                        Visualization.ClearConsole();
                        Visualization.ShowBoard(BoardGame, ActivePlayer.Id, LifeP, AttackP);
                        Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} play cards:");
                        Visualization.ShowHand(ActivePlayer.Hand);
                        Visualization.ShowProgramMessage($"Input the number of the cards you'd like to  play (max {ActivePlayer.Hand.Cards.Count}). To stop enter -1");
                        userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count);

                        Visualization.ClearConsole();
                        if (ActivePlayer.Hand.Cards[userInput].Type == EnumType.buff)
                        {
                            Visualization.ShowProgramMessage("Please Select which type you'd like to buff:");
                            Visualization.ShowProgramMessage("(0): LongRange (1): Range (2): Melee");
                            useInputB = Visualization.GetUserInput(2);

                            switch (useInputB)
                            {
                            case 0:
                                ActivePlayer.PlayCard(userInput, EnumType.bufflongRange);
                                break;

                            case 1:
                                ActivePlayer.PlayCard(userInput, EnumType.buffrange);
                                break;

                            case 2:
                                ActivePlayer.PlayCard(userInput, EnumType.buffmelee);
                                break;
                            }
                        }
                        else
                        {
                            ActivePlayer.PlayCard(userInput, ActivePlayer.Hand.Cards[userInput].Type);
                        }
                        AttackP[ActivePlayer.Id] = playa2.GetAttackPoints(EnumType.None)[0];
                        //Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} has played{ActivePlayer.Hand.Cards[userInput].Name} ");//
                        Visualization.ShowHand(ActivePlayer.Hand);
                        Visualization.ShowBoard(BoardGame, ActivePlayer.Id, LifeP, AttackP);
                    }
                    Visualization.ClearConsole();
                    Visualization.ShowBoard(BoardGame, ActivePlayer.Id, LifeP, AttackP);
                    if (AttackP[0] < AttackP[1])
                    {
                        Visualization.ShowProgramMessage("Player 2 has won this round, Player 1 has lost one lifepoint  ");
                        LifeP[0] -= 1;
                        players[0].LifePoints -= 1;
                    }
                    if (AttackP[1] < AttackP[0])
                    {
                        Visualization.ShowProgramMessage("Player 1 has won this round, Player 2 has lost one lifepoint  ");
                        LifeP[1] -= 1;
                        players[1].LifePoints -= 1;
                    }
                    if (AttackP[0] == AttackP[1])
                    {
                        Visualization.ShowProgramMessage("Player 2 has tied this round with Player 1,  both Players  have lost one lifepoint  ");
                        LifeP[0] -= 1;
                        LifeP[1] -= 1;
                        players[0].LifePoints -= 1;
                        players[1].LifePoints -= 1;
                    }
                    GameSwitch = this.CheckIfEndGame();
                }
                else
                {
                    Visualization.ShowBoard(BoardGame, ActivePlayer.Id, LifeP, AttackP);
                    Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} will draw a card");
                    ActivePlayer.DrawCard();
                    Visualization.ShowHand(ActivePlayer.Hand);
                    Visualization.ShowListOptions(new List <string>()
                    {
                        "Play Card", "Pass"
                    });
                    userInput = Visualization.GetUserInput(1);
                    if (userInput == 0)
                    {
                        Visualization.ClearConsole();
                        Visualization.ShowBoard(BoardGame, ActivePlayer.Id, LifeP, AttackP);
                        Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} play cards:");
                        Visualization.ShowHand(ActivePlayer.Hand);
                        Visualization.ShowProgramMessage($"Input the number of the cards you'd like to  play (max {ActivePlayer.Hand.Cards.Count}). To stop enter -1");
                        userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count);

                        Visualization.ClearConsole();
                        if (ActivePlayer.Hand.Cards[userInput].Type == EnumType.buff)
                        {
                            Visualization.ShowProgramMessage("Please Select which type you'd like to buff:");
                            Visualization.ShowProgramMessage("(0): LongRange (1): Range (2): Melee");
                            useInputB = Visualization.GetUserInput(2);

                            switch (useInputB)
                            {
                            case 0:
                                ActivePlayer.PlayCard(userInput, EnumType.bufflongRange);
                                break;

                            case 1:
                                ActivePlayer.PlayCard(userInput, EnumType.buffrange);
                                break;

                            case 2:
                                ActivePlayer.PlayCard(userInput, EnumType.buffmelee);
                                break;
                            }
                        }
                        else
                        {
                            ActivePlayer.PlayCard(userInput, ActivePlayer.Hand.Cards[userInput].Type);
                        }
                        AttackP[ActivePlayer.Id] = playa2.GetAttackPoints(EnumType.None)[0];
                        //Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} has played{ActivePlayer.Hand.Cards[userInput].Name} ");//
                        Visualization.ShowHand(ActivePlayer.Hand);
                        Visualization.ShowBoard(BoardGame, ActivePlayer.Id, LifeP, AttackP);
                    }
                    Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} Turn has ended please press anykey to continue to the next player turn");
                    Console.ReadKey();
                    Visualization.ClearConsole();
                    ActivePlayer.Id -= 1;
                    Visualization.ShowBoard(BoardGame, ActivePlayer.Id, LifeP, AttackP);
                    Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} will draw a card");
                    ActivePlayer.DrawCard();
                    Visualization.ShowHand(ActivePlayer.Hand);
                    Visualization.ShowListOptions(new List <string>()
                    {
                        "Play Card", "Pass"
                    });
                    userInput = Visualization.GetUserInput(1);
                    if (userInput == 0)
                    {
                        Visualization.ClearConsole();
                        Visualization.ShowBoard(BoardGame, ActivePlayer.Id, LifeP, AttackP);
                        Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} play cards:");
                        Visualization.ShowHand(ActivePlayer.Hand);
                        Visualization.ShowProgramMessage($"Input the number of the cards you'd like to  play (max {ActivePlayer.Hand.Cards.Count}). To stop enter -1");
                        userInput = Visualization.GetUserInput(ActivePlayer.Hand.Cards.Count);

                        Visualization.ClearConsole();

                        if (ActivePlayer.Hand.Cards[userInput].Type == EnumType.buff)
                        {
                            Visualization.ShowProgramMessage("Please Select which type you'd like to buff:");
                            Visualization.ShowProgramMessage("(0): LongRange (1): Range (2): Melee");
                            useInputB = Visualization.GetUserInput(2);

                            switch (useInputB)
                            {
                            case 0:
                                ActivePlayer.PlayCard(userInput, EnumType.bufflongRange);
                                break;

                            case 1:
                                ActivePlayer.PlayCard(userInput, EnumType.buffrange);
                                break;

                            case 2:
                                ActivePlayer.PlayCard(userInput, EnumType.buffmelee);
                                break;
                            }
                        }
                        else
                        {
                            ActivePlayer.PlayCard(userInput, ActivePlayer.Hand.Cards[userInput].Type);
                        }
                        AttackP[ActivePlayer.Id] = playa1.GetAttackPoints(EnumType.None)[0];
                        //Visualization.ShowProgramMessage($"Player {ActivePlayer.Id + 1} has played{ActivePlayer.Hand.Cards[userInput].Name} ");//

                        Visualization.ShowHand(ActivePlayer.Hand);
                        Visualization.ShowBoard(BoardGame, ActivePlayer.Id, LifeP, AttackP);
                    }
                    Visualization.ClearConsole();
                    Visualization.ShowBoard(BoardGame, ActivePlayer.Id, LifeP, AttackP);
                    if (AttackP[0] < AttackP[1])
                    {
                        Visualization.ShowProgramMessage("Player 2 has won this round, Player 1 has lost one lifepoint  ");
                        LifeP[0] -= 1;
                        players[0].LifePoints -= 1;
                    }
                    if (AttackP[1] < AttackP[0])
                    {
                        Visualization.ShowProgramMessage("Player 1 has won this round, Player 2 has lost one lifepoint  ");
                        LifeP[1] -= 1;
                        players[1].LifePoints -= 1;
                    }
                    if (AttackP[0] == AttackP[1])
                    {
                        Visualization.ShowProgramMessage("Player 2 has tied this round with Player 1,  both Players  have lost one lifepoint  ");
                        LifeP[0] -= 1;
                        LifeP[1] -= 1;
                        players[0].LifePoints -= 1;
                        players[1].LifePoints -= 1;
                    }
                    GameSwitch = this.CheckIfEndGame();
                }
            }



            int gk = this.GetWinner();

            switch (gk)
            {
            case 0:
                Visualization.ShowProgramMessage("Player 1 has won this game");
                break;

            case 1:
                Visualization.ShowProgramMessage("Player 2 has won this game");
                break;

            case -1:
                Visualization.ShowProgramMessage("the game was tied");
                break;
            }
            Console.ReadKey();
        }