Exemplo n.º 1
0
        public void ManageDeckCollection()
        {
            Console.WriteLine(contants.DeckCollectionMenu);
            bool   exit  = true;
            string input = Console.ReadLine();

            while (exit)
            {
                switch (input)
                {
                case "1":
                    Console.WriteLine(contants.AskToEnterDeckName);
                    string deckName = Console.ReadLine().ToLower();
                    if (!string.IsNullOrEmpty(deckName))
                    {
                        deckCollection.CreateDeck(deckName);
                    }
                    ManageDeckCollection();
                    break;


                case "2":
                    Console.WriteLine(contants.AskToEnterDeckName);
                    deckName = Console.ReadLine();

                    deckCollection.RemoveDeck(deckName);

                    ManageDeckCollection();
                    break;

                case "3":
                    AddMultipleCardsToDeck();
                    ManageDeckCollection();
                    break;

                case "4":
                    RemoveMultipleCardsFromDeck();
                    ManageDeckCollection();
                    break;

                case "5":
                    Console.WriteLine(contants.AskToEnterDeckName);
                    deckCollection.PrintNameOfAllDecks();
                    deckName = Console.ReadLine();
                    deckCollection.MyDeck[deckName].ListAllCards();
                    break;

                case "6":
                    exit = false;
                    break;
                }
            }
        }
Exemplo n.º 2
0
        public void PreGameSelection()
        {
            Console.WriteLine(constants.AskPlayerToSelectADeck, 1);
            deckCollection.PrintNameOfAllDecks();
            player1 = new Player(deckCollection.MyDeck[Console.ReadLine()]);
            Console.WriteLine(constants.AskPlayerToSelectADeck, 1);
            player2 = new Player(deckCollection.MyDeck[Console.ReadLine()]);

            player1.PlayerDeck.Shuffle();
            player2.PlayerDeck.Shuffle();
            for (int i = 0; i < 3; i++)
            {
                player1.DrawACard();
                player2.DrawACard();
            }

            string playerTurn = "P1";

            while (true)
            {
                if (playerTurn == "P1")
                {
                    Console.WriteLine("Player 1 Turn");
                    StartOfTurn(player1);
                    Console.WriteLine("===========================");
                    PlayTurn(player1, player2);
                    playerTurn = "P2";
                    if (player2.IsDead)
                    {
                        Console.WriteLine("Player 1 Won the game");
                        break;
                    }
                }
                else
                {
                    Console.WriteLine("Player 2 Turn");
                    StartOfTurn(player2);
                    Console.WriteLine("===========================");
                    PlayTurn(player2, player1);
                    playerTurn = "P1";
                    if (player1.IsDead)
                    {
                        Console.WriteLine("Player 2 won the game!");
                        break;
                    }
                }
            }
            Environment.Exit(0);
        }