static ConsoleKeyInfo CombatPrompt(Character player, Monster enemy) { ConsoleKeyInfo playerPress = new ConsoleKeyInfo(); Console.Clear(); promptAction: player.PrintStats(); enemy.PrintStats(); Console.WriteLine("What would you like to do?"); Console.WriteLine("\n Blunt Force Attack - A" + "\n Piercing Attack - 1MP- S" + "\n Obliterate -4MP - D" + "\n Flee -1 Progress - F" + "\n Instant Kill - G" + "\n Heal Yourself - H"); playerPress = Console.ReadKey(true); string playerPressString = playerPress.Key.ToString(); playerPressString = playerPressString.ToLower(); switch(playerPressString) { case"a": case"s": case"d": case"f": case"g": case"h": break; default: Console.Clear(); WriteRed("Please press the correct key.\n"); Console.ReadKey(true); goto promptAction; } return playerPress; }
// The CreateMonster method accepts a scenario from 1-3, then generates a monster with stats. // The method will also give a brief description to player before combat starts. static void CreateMonster(Character player, int scenario, ref Monster enemy) { long progress = player.progress; enemy.hp = progress * 15 + 20; enemy.atk = progress / 2 + 2; enemy.def = progress / 2 + 2; enemy.bossMonster = false; if(scenario == 1) { enemy.hp += progress * 0.5; enemy.def += progress * 0.5; Console.WriteLine("As you progress, the growls tell you that you are in claimed land..."); } else if (scenario == 2) { enemy.atk += progress; Console.WriteLine("You hear the roar of an angry beast..."); } else if (scenario == 3) { enemy.hp = enemy.hp / 2; enemy.atk = enemy.atk / 2; enemy.def = enemy.def / 2; Console.WriteLine("The creature in front of you cowers in fear, but won't let you progress."); } else if (scenario == 4) { enemy.hp = enemy.hp * 3; enemy.atk = enemy.atk * 2; enemy.def = enemy.def * 1.5; enemy.bossMonster = true; Random rng = new Random(); int rngInt = rng.Next(1,4); if(rngInt == 1) { Console.WriteLine("You feel the air get heavy around you."); Console.ReadKey(true); Console.WriteLine("You turn."); Console.ReadKey(true); Console.WriteLine("You see a massive shadow."); Console.ReadKey(true); Console.WriteLine("In front of you, is the largest rat you've ever seen."); } if(rngInt == 2) { Console.WriteLine("You feel a strong gust of wind."); Console.ReadKey(true); Console.WriteLine("You turn."); Console.ReadKey(true); Console.WriteLine("You see a massive shadow."); Console.ReadKey(true); Console.WriteLine("In front of you, is the largest bird you've ever seen."); } if(rngInt == 3) { Console.WriteLine("You hear the voice of a another person."); Console.ReadKey(true); Console.WriteLine("No other human has come here in over a thousand years."); Console.ReadKey(true); Console.WriteLine("You turn."); Console.ReadKey(true); Console.WriteLine("In front of you, is the first human you've seen for a while now."); } } enemy.PrintStats(); Console.ReadKey(true); Console.Clear(); }