예제 #1
0
        public static void playerBattlePhase(Hero h1, Thief t1)
        {
            Console.WriteLine("-----------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("You have three actions you can choose from.");
            Console.WriteLine("The fist option attack will deal the same amount of damage as your attack stat.");
            Console.WriteLine("The second option Roulette Attack is a risk vs. reward attack.");
            Console.WriteLine("You will have 3 chances to guess a number between 1 and 5. If you guess correctly you will do double damage.");
            Console.WriteLine("However if you guess wrong all three times you will only do 1 damage!");
            Console.WriteLine("The last option is to use a potion to heal yourself for 10 health but be careful! You only get 3 for the whole game!");
            Console.WriteLine("-----------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine();
            Console.WriteLine();
            int action = 0;

            Console.WriteLine("Select your action!");
            Console.WriteLine("1: Attack");
            Console.WriteLine("2: Roulette Attack");
            Console.WriteLine("3: Use Potion");
            action = getInt();
            while ((action < 1) || (action > 3))
            {
                Console.WriteLine("You've entered an invalid choice. Please enter 1, 2, or 3.");
                action = getInt();
            }
            while (action == 3 && h1.potions == 0)
            {
                Console.WriteLine("Sorry! You are out of potions! Please choose a different action.");
                action = getInt();
            }
            switch (action)
            {
            case 1:
                t1.attacked(h1);
                Console.WriteLine("You attacked for " + h1.attack + " damage!");
                Console.WriteLine("The enemy has " + t1.health + " left!");
                Console.WriteLine("Enter any key to continue.");
                Console.ReadKey();
                Console.Clear();
                break;

            case 2:
                rouletteAttack(h1, t1);
                Console.WriteLine("Enter any key to continue.");
                Console.ReadKey();
                Console.Clear();
                break;

            case 3:
                usePotion(h1);
                Console.WriteLine("Enter any key to continue.");
                Console.ReadKey();
                Console.Clear();
                break;

            default:
                Console.WriteLine("Error in battle phase.");
                break;
            }
        }