public static void FightLargeMonsterMace() { Player p = new Player(characterName, characterAge); Monster lMonster = new Monster("M", 150, 9, 120); int MaceAmountOfDamage = 50; Console.Write("As you walk through the forest ,the Monster appears from the shadows this time a larger one"); do { Console.WriteLine($"you have now health level of { p.Health}"); Console.WriteLine($"The monster has health level of { lMonster.Health}"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("press A to attack, D to defend yourself, or R to run>\n"); string PlayersChoice = Console.ReadLine(); Console.ResetColor(); switch (PlayersChoice) { case "a": Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine($"you have just attack the monster with a sword which deals {MaceAmountOfDamage} amount of damage "); Random r = new Random(); p.AmountOfDamage = MaceAmountOfDamage + r.Next(1, 7); lMonster.Health -= p.AmountOfDamage; Console.WriteLine($"The monster has now a health level of {lMonster.Health}"); Random rand = new Random(); int monsterDamage = amountOfDamage + rand.Next(1, 12); p.Health -= monsterDamage; p.TotalPlayerGold += lMonster.Loot; Console.WriteLine($"the monster fights back! you have now a\nhealth level of {p.Health}\nTotal amount of gold:{p.TotalPlayerGold}"); System.Threading.Thread.Sleep(700); Console.ResetColor(); Console.ReadLine(); break; case "d": Console.ForegroundColor = ConsoleColor.DarkBlue; Console.WriteLine("The monster attacks you"); Console.WriteLine($" you block the attack with your arms\n"); Console.ResetColor(); Random ran = new Random(); monsterDamage = (ran.Next(1, 6) * amountOfDamage); p.Health -= monsterDamage; Console.WriteLine($"you have now a health level of { p.Health}"); Console.WriteLine($"the monster has a health level of { lMonster.Health}"); Console.ReadLine(); break; case "r": Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine(" says, 'LOL NOPE' and you must remain on the battlefield.\n"); Console.ResetColor(); Console.WriteLine("Ok, you can buy weapon then"); Console.ReadKey(); Console.Clear(); Game.BuyWeapons(); break; default: Console.WriteLine("Invalid Input"); break; } }while (p.Health > 0 && lMonster.Health > 0); if (p.Health <= 0 && lMonster.Health > 0) { Console.BackgroundColor = ConsoleColor.Red; Console.WriteLine($" you died died! GG NO RE\n"); p.TotalPlayerGold -= lMonster.Loot; Console.ResetColor(); } else if (lMonster.Health == 0 && p.Health == 0) { Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("It was a tie!"); Console.ResetColor(); } else if (lMonster.Health <= 0 && (p.Health > 0)) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Wow,You have nailed it!!! you win the final level,Congratulations. "); Console.WriteLine($"you have now {p.TotalPlayerGold} total gold and {p.Health} health level"); Console.ResetColor(); Console.WriteLine("press any key to play again"); Console.ReadKey(); Console.Clear(); GameMenu.StartProgram(); } }
static void Main(string[] args) { GameMenu.StartProgram(); }
public static void PlayGame() { Player p = new Player(characterName, characterAge); Monster M = new Monster("M", 20, 5, 80); //var player = new System.Media.SoundPlayer(); //player.Stream = new MemoryStream(Propertie.Resources.gameMusic); do { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("press A to attack, D to defend yourself, or R to run>\n"); string PlayersChoice = Console.ReadLine(); Console.ResetColor(); switch (PlayersChoice) { case "a": Console.ForegroundColor = ConsoleColor.Cyan; System.Media.SoundPlayer player = new System.Media.SoundPlayer(AppDomain.CurrentDomain.BaseDirectory + "\\PUNCH.wav"); player.Play(); //SoundPlayer player = new SoundPlayer(); // player.SoundLocation = AppDomain.CurrentDomain.BaseDirectory +@" \\c:\Users\source\repos\AdventureGame\AdventureGame\PUNCH.wav"; //player.SoundLocation = @"C:\Users\Desktop.wav"; // player.Play(); Console.WriteLine($"you have just attack the monster with your fist which deals {p.AmountOfDamage} amount of damage "); Random r = new Random(); p.AmountOfDamage = amountOfDamage + r.Next(1, 7); M.Health -= p.AmountOfDamage; Console.WriteLine($"The monster has now a health level of {M.Health}"); Random rand = new Random(); int monsterDamage = amountOfDamage + rand.Next(1, 4); p.Health -= monsterDamage; Console.WriteLine($"the monster fights back! you have now a health level of {p.Health}"); System.Threading.Thread.Sleep(700); Console.ResetColor(); Console.ReadLine(); break; case "d": Random ran = new Random(); monsterDamage = (ran.Next(1, 2) * amountOfDamage); Console.ForegroundColor = ConsoleColor.DarkBlue; Console.WriteLine("The monster attacks you"); Console.WriteLine($" you block the attack with your arms\n"); Console.ResetColor(); p.Health -= monsterDamage; Console.WriteLine($"you have now a health level of { p.Health}"); Console.WriteLine($"the monster has a health level of { M.Health}"); Console.ReadLine(); break; case "r": Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine(" says, 'LOL NOPE' and you must remain on the battlefield.\n"); Console.ResetColor(); Console.WriteLine("Ok, you can buy weapon then"); Console.ReadKey(); Console.Clear(); Game.BuyWeapons(); break; } }while (p.Health > 0 && M.Health > 0); if (p.Health <= 0 && M.Health > 0) { Console.BackgroundColor = ConsoleColor.Red; Console.WriteLine($" you died died! NO RE\n"); Console.ResetColor(); Console.WriteLine("press any key to play again"); Console.ReadKey(); Console.Clear(); GameMenu.StartProgram(); } else if (M.Health == 0 && p.Health == 0) { Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("It was a tie!"); Console.ResetColor(); } else if (M.Health <= 0 && p.Health > 0) { Console.ForegroundColor = ConsoleColor.Green; p.TotalPlayerGold += M.Loot; Console.WriteLine($"Wow, you win the first level,Congratulations. You have now an option to Purchase a weapon\nYou have accumulated {p.TotalPlayerGold} amount gold"); Console.ResetColor(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); Console.Clear(); Game.BuyWeapons(); } }