Exemple #1
0
        static void DoAction(ConsoleKey key)
        {
            if (key == ConsoleKey.L)
            {
                map.move();
                int points = rpg.Explore();
                if (points > 0)
                {
                    Console.WriteLine("You gain {0} heroic points!", points);
                    score += points;
                }
            }
            else if (key == ConsoleKey.A)
            {
                int rounds = rpg.Battle();
                if (rounds > 0)
                {
                    int points = 10 - rounds;
                    if (points < 0)
                    {
                        points = 0;
                    }

                    score += points;

                    Console.WriteLine("You gain {0} heroic points!", points);
                }
            }

            if (score >= nextLevel)
            {
                rpg.SetLevel(rpg.GetLevel() + 1);
                nextLevel = rpg.GetLevel() * 10;

                Console.WriteLine("Your wonderous experience has gained you a level! level " + rpg.GetLevel());
            }
        }        // end DoAction()