/// <summary> /// Checks money and availablity and then buys the potion /// </summary> /// <param name="price">Price of the item</param> static void BuyPotion(int price) { //checks to see if there is enough space in the inventory if (Player.healthPotions < 11) { //checks to see if the player has enough money if (Player.money >= price) { Player.healthPotions++; Player.money -= price; Console.WriteLine("Potion Bought"); } else { Console.WriteLine("You don't have enough money for this"); } } else { Console.WriteLine("You have too many potions already!"); } Texts.PressAnyButton(); }
/// <summary> /// The sequence for entering battle field 5 /// </summary> public static void B5() { //sets up the player "location" and the index variable Player.location = "B5"; arrayNumber = 3; do { //there are always two different options if if (!fields[arrayNumber].MonsterDead()) { //lets the user choose what to do when confronted by the monster BattleChoice(); } else { //Gives the user the money if (!fields[1].itemPickedUp) { Player.money += fields[1].awardMoney; Player.d1Key = true; } Console.WriteLine("A large monster lays infront of you"); Console.WriteLine("The only option left is to go to a new area"); Thread.Sleep(Numbers.shortWait); Console.WriteLine("You can go in three directions"); Thread.Sleep(Numbers.shortWait); Console.WriteLine("1. Battle Field 3"); Thread.Sleep(Numbers.shortWait); Console.WriteLine("2. Dungeon 3"); Thread.Sleep(Numbers.shortWait); Console.WriteLine("3. View Map/Inventory"); Thread.Sleep(Numbers.shortWait); //makes sure that the input was a number do { Console.BackgroundColor = ConsoleColor.Red; Console.WriteLine("Please enter a number"); Console.BackgroundColor = ConsoleColor.Black; //gets the input Console.ForegroundColor = ConsoleColor.Green; input = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; } while (!Int32.TryParse(input, out ninput)); switch (ninput) { case 1: Texts.TravelTo("B3"); B3(); break; case 2: //say you cant go and have press key to continue break; case 3: Texts.Map(); break; } } } while (true); }
/// <summary> /// The attack sequence (character attacks monster) /// </summary> static void Attack() { bool validNumberForList = false; Console.Clear(); Console.WriteLine("What weapon do you want to attack with?"); Thread.Sleep(Numbers.shortWait); Texts.ShowInventory(true, false); do { //makes sure that the input was a number do { Console.BackgroundColor = ConsoleColor.Red; Console.WriteLine("Please enter a number"); Console.BackgroundColor = ConsoleColor.Black; //gets the input Console.ForegroundColor = ConsoleColor.Green; input = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; } while (!Int32.TryParse(input, out ninput)); Console.Clear(); if (ninput > 0 && ninput <= Player.weapons.Count) { validNumberForList = true; } else { Console.BackgroundColor = ConsoleColor.Red; Console.WriteLine("Please enter a number that is listed above"); Console.BackgroundColor = ConsoleColor.Black; } } while (!validNumberForList); Console.Clear(); //tells the user what they did Weapon w = Player.weapons[ninput - 1]; Console.WriteLine("You've attacked with " + w.name + " and did " + w.damage + " damage. " + randomCoolWord()); fields[arrayNumber].monsterHealth -= w.damage; //checks to see if the monster is alive if (!fields[arrayNumber].MonsterDead()) { //lets the player defend against the monsters attacks Defend(); } else { Console.WriteLine("You killed the monster! " + randomCoolWord()); Texts.PressAnyButton(); } }
/// <summary> /// Asks the user what they want to do once in the lobby /// </summary> static public void Choice() { Player.location = "Base"; //keeps asking for an input until there is a correct input do { //asks the what the next move should be Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("You are in the base"); Console.WriteLine("What do you want to do now?"); Thread.Sleep(Numbers.longWait); Console.WriteLine("1. Go to the shop"); Thread.Sleep(Numbers.longWait); Console.WriteLine("2. Go to the battle field"); Thread.Sleep(Numbers.longWait); Console.WriteLine("3. View Map/Inventory"); Thread.Sleep(Numbers.longWait); Console.WriteLine("4. Re-read intro"); //makes sure that the input was a number do { Console.BackgroundColor = ConsoleColor.Red; Console.WriteLine("Please enter a number"); Console.BackgroundColor = ConsoleColor.Black; //gets the input Console.ForegroundColor = ConsoleColor.Green; input = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; } while (!Int32.TryParse(input, out ninput)); switch (ninput) { case 1: Console.Write("Traveling to shop"); Thread.Sleep(Numbers.shortWait); Console.Write("."); Thread.Sleep(Numbers.shortWait); Console.Write("."); Thread.Sleep(Numbers.shortWait); Console.WriteLine("."); Console.Clear(); Shop.Choice(); break; case 2: Console.Write("Traveling to battlefield"); Thread.Sleep(Numbers.shortWait); Console.Write("."); Thread.Sleep(Numbers.shortWait); Console.Write("."); Thread.Sleep(Numbers.shortWait); Console.WriteLine("."); Console.Clear(); Texts.Tutorial(); break; case 3: Console.Clear(); Texts.Map(); break; case 4: Console.Clear(); Texts.Intro(); break; default: //clears out the console Console.Clear(); Console.BackgroundColor = ConsoleColor.Red; Console.WriteLine("Please enter one of the numbers stated above"); Console.BackgroundColor = ConsoleColor.Black; break; } } while (true); }