/// <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(); } }