コード例 #1
0
ファイル: Basic RPG.cs プロジェクト: Addikins/Code-Projects
            static void Main(string[] args)
            {
                string answer;
                bool   playAgain = true;
                Game   game      = new Game();

                do
                {
                    Console.Write(game.StartTurn());
                    do
                    {
                        Console.WriteLine("Would you like to begin a new adventure?\n");
                        answer = GetMethods.GetYesNo();
                        Console.Clear();
                        switch (answer)
                        {
                        case "y":
                            Console.WriteLine("You awaken once more...");
                            playAgain = true;
                            break;

                        case "n":
                            Console.WriteLine("Your hero begins their eternal slumber...");
                            playAgain = false;
                            break;
                        }
                    } while (answer == "error");
                } while (playAgain == true);
            }
コード例 #2
0
ファイル: Basic RPG.cs プロジェクト: Addikins/Code-Projects
 Enemy enemy           = new Enemy(); //Main field of the Enemy Class
 public int HeroClass()               // Sets the name & class the hero chooses
 {
     Console.WriteLine("Hello, let's begin an adventure!\nFirst off, choose a name for your hero!");
     do
     {
         hname = Console.ReadLine();
         int nameLength = hname.Length;
         if (nameLength > 25)
         {
             Console.WriteLine("Your hero name must be 25 characters or less!");
         }
         else if (nameLength < 3)
         {
             Console.WriteLine("Your hero name must be 3 characters or more!");
         }
         else
         {
             Console.WriteLine("\nGreat! Now, choose a class for " + hname + "!");
             InputSuccess = true;
         }
     } while (!InputSuccess);
     do
     {
         Console.WriteLine("\n (1) The Holy Paladin\n (500)HP   (200)MP   (25)Armor   (20)Attack\n\n (2) The Savage Warrior\n (400)HP   (0)MP   (15)Armor   (30)Attack\n\n" +
                           " (3) The Cunning Thief\n (250)HP   (200)MP   (5)Armor   (40)Attack\n\n (4) The Valiant Knight\n (300)HP   (100)MP   (10)Armor   (35)Attack\n\n " +
                           "(5) The Powerful Sorcerer\n (250)HP   (600)MP   (0)Armor   (10)Attack\n");
         heroclass = GetMethods.GetHeroClass();
     } while (heroclass == 6);
     return(heroclass); //returns the case # from 1-5
 }