public static void Choose_Action(Human player) { int numSelect; Goblin enemy = new Goblin("Goblix"); System.Console.WriteLine("\nUh oh! Trouble's a-foot. A big, ugly, scary-looking thing appeared..."); System.Console.WriteLine(Program.newLine); System.Console.ReadKey(); System.Console.WriteLine("Your worst nightmare! It's {0} the {1}!", enemy.Name, enemy.ClassName); // Get user input for selection System.Console.ReadKey(); System.Console.WriteLine(Program.newLine); System.Console.WriteLine("Now you must select a number to choose what you would like to do next."); System.Console.ReadKey(); System.Console.WriteLine(Program.newLine); foreach (KeyValuePair <int, string> action in player.Actions) { System.Console.WriteLine("{0}. {1}\n", action.Key, action.Value); } numSelect = Convert.ToInt32(Console.ReadLine()); System.Console.WriteLine(Program.newLine); switch (numSelect) { case 1: System.Console.WriteLine("You chose to use {0} on {1} the {2}!", player.Actions[1], enemy.Name, enemy.ClassName); player.Attack(enemy); System.Console.WriteLine(Program.newLine); System.Console.ReadKey(); System.Console.WriteLine("Your current stats: {0}\n", player.ShowStatus()); System.Console.WriteLine(Program.newLine); System.Console.ReadKey(); System.Console.WriteLine("Enemy current stats: {0}\n", enemy.ShowStatus()); break; case 2: System.Console.WriteLine("You chose {0}!", player.Actions[2]); System.Console.ReadKey(); System.Console.WriteLine(Program.newLine); System.Console.WriteLine("Your current stats: {0}\n", player.ShowStatus()); break; case 3: System.Console.WriteLine("You chose to {0}!", player.Actions[3]); System.Console.WriteLine(Program.newLine); System.Console.ReadKey(); System.Console.WriteLine("You lost the game. Better luck next time."); System.Console.WriteLine(Program.newLine); System.Console.ReadKey(); System.Console.WriteLine("Just kidding! But why not try another choice? YOLO, amirite?"); System.Console.WriteLine(Program.newLine); System.Console.ReadKey(); Human_Choices.Choose_Action(player); break; case 4: System.Console.WriteLine("You chose to {0}!", player.Actions[4]); System.Console.WriteLine(Program.newLine); System.Console.ReadKey(); System.Console.WriteLine("Stashed away in your pockets, you currently possess:"); System.Console.WriteLine(Program.newLine); foreach (KeyValuePair <string, int> item in player.Inventory) { System.Console.WriteLine("You have {0} {1}s.\n", item.Value, item.Key); } System.Console.WriteLine("Would you like to use one of your items?"); System.Console.WriteLine(Program.newLine); System.Console.ReadKey(); System.Console.WriteLine("That's a shame. Go tell the game creators to make it happen!"); System.Console.WriteLine(Program.newLine); System.Console.ReadKey(); Human_Choices.Choose_Action(player); break; default: System.Console.WriteLine("Learn how to number better!"); System.Console.ReadKey(); System.Console.WriteLine(Program.newLine); Human_Choices.Choose_Action(player); break; } }
// Main method invoked upon running program static void Main(string[] args) { // Create new player of class Human Human me = new Human("Maki"); me.Health = 200; // Create new heroes Scribe Steve = new Scribe("Steve"); Wizard Wanda = new Wizard("Wanda"); Ninja Nick = new Ninja("Nick"); Samurai Sam = new Samurai("Sam"); // Create new enemies Zombie Zeek = new Zombie("Zeek"); GiantBaby Timmy = new GiantBaby("Timmy"); Spider Slink = new Spider("Slink"); Goblin Goblix = new Goblin("Goblix"); // Show stats of players at the beginning of the game System.Console.WriteLine("\n\n============================== Before Attacking ===============================\n"); System.Console.WriteLine("~ ALL PLAYERS ~\n"); System.Console.WriteLine("Player 1: {0}", me.ShowStatus()); // Show stats of heroes at the beginning of the game System.Console.WriteLine("\n~ ALL HEROES ~\n"); System.Console.WriteLine(" Hero 1: {0}", Steve.ShowStatus()); System.Console.WriteLine(" Hero 2: {0}", Wanda.ShowStatus()); System.Console.WriteLine(" Hero 3: {0}", Nick.ShowStatus()); System.Console.WriteLine(" Hero 4: {0}", Sam.ShowStatus()); // Show stats of enemies at the beginning of the game System.Console.WriteLine("\n~ ALL ENEMIES ~\n"); System.Console.WriteLine(" Enemy 1: {0}", Zeek.ShowStatus()); System.Console.WriteLine(" Enemy 2: {0}", Timmy.ShowStatus()); System.Console.WriteLine(" Enemy 3: {0}", Slink.ShowStatus()); System.Console.WriteLine(" Enemy 4: {0}", Goblix.ShowStatus()); // Attack round System.Console.WriteLine("\n=============================== While Attacking ===============================\n"); System.Console.WriteLine("1. Wanda fireballs me."); Wanda.Fireball(me); System.Console.WriteLine("2. I attack Steve."); me.Attack(Steve); System.Console.WriteLine("3. Steve stabs Wanda with his quill."); Steve.Quill_Stab(Wanda); System.Console.WriteLine("4. Sam death blows Wanda. (Suck it Wanda!)"); Sam.Death_Blow(Wanda); System.Console.WriteLine("5. Nick steals from Sam."); Nick.Steal(Sam); // Show stats of players after attacking System.Console.WriteLine("\n=============================== After Attacking ===============================\n"); System.Console.WriteLine("~ ALL PLAYERS ~\n"); System.Console.WriteLine("Player 1: {0}", me.ShowStatus()); // Show stats of heroes after attacking System.Console.WriteLine("\n~ ALL HEROES ~\n"); System.Console.WriteLine(" Hero 1: {0}", Steve.ShowStatus()); System.Console.WriteLine(" Hero 2: {0}", Wanda.ShowStatus()); System.Console.WriteLine(" Hero 3: {0}", Nick.ShowStatus()); System.Console.WriteLine(" Hero 4: {0}", Sam.ShowStatus()); // Show stats of enemies after attacking System.Console.WriteLine("\n~ ALL ENEMIES ~\n"); System.Console.WriteLine(" Enemy 1: {0}", Zeek.ShowStatus()); System.Console.WriteLine(" Enemy 2: {0}", Timmy.ShowStatus()); System.Console.WriteLine(" Enemy 3: {0}", Slink.ShowStatus()); System.Console.WriteLine(" Enemy 4: {0}", Goblix.ShowStatus()); // Heal round System.Console.WriteLine("\n================================ While Healing ================================\n"); System.Console.WriteLine("1. Wanda uses heal on herself."); Wanda.Heal(); System.Console.WriteLine("2. Sam uses meditate on himself."); Sam.Meditate(); // Show stats of players after healing System.Console.WriteLine("\n================================ After Healing ================================\n"); System.Console.WriteLine("~ ALL PLAYERS ~\n"); System.Console.WriteLine("Player 1: {0}", me.ShowStatus()); // Show stats of heroes after healing System.Console.WriteLine("\n~ ALL HEROES ~\n"); System.Console.WriteLine(" Hero 1: {0}", Steve.ShowStatus()); System.Console.WriteLine(" Hero 2: {0}", Wanda.ShowStatus()); System.Console.WriteLine(" Hero 3: {0}", Nick.ShowStatus()); System.Console.WriteLine(" Hero 4: {0}", Sam.ShowStatus()); System.Console.WriteLine("\n"); }