コード例 #1
0
        private static void Battle(ICharacter mainUser)
        {
            Enemy enemy = new Enemy();

            Console.WriteLine("An Ememy has shown up. What would you like to do?");

            //To fight until someone dieds
            do
            {
                var healthPointBefore = enemy.HealthPoints;

                //TODO: make the use and the Enemy attack at the same time.. not having to click again once you finished your turn.
                mainUser.AttackOptions(enemy);
                enemy.Attack(mainUser);
            } while (mainUser.HealthPoints > 0 && enemy.HealthPoints > 0);

            if (mainUser.HealthPoints <= 0)
            {
                GameOver();
            }
            else if (enemy.HealthPoints <= 0)
            {
                Console.WriteLine("You have defeated the monster!");

                //TODO: come back to full health and get experice
            }
        }