static void Main(string[] args) { Player player = new Player("David", 1, 9, 200, 10); SpecificMonster monster = new SpecificMonster("Evil", 0, 40, 10); Meny.GameMeny(player, monster); }
public static void Battle(Player p, SpecificMonster s) { bool keepGoing = true; while (keepGoing) { Console.WriteLine($"Uh oh! A {s.Name} appeared!"); Console.WriteLine($"You hit the monster, dealing {p.Dmg} damage"); Console.WriteLine("Uuoooah *slurp*"); Console.WriteLine($"The monster hits you, dealing {s.Dmg} damage"); LooseHealthPlayer(p, s); LooseHealthMonster(p, s); if (BattleWinner(p, s) && p.Hp != 0) { GetExp(p, s); break; } else if (p.Hp == 0) { Console.WriteLine("You were killed by the monster :("); break; } Console.WriteLine($"{p.Name}: {p.Hp}"); Console.WriteLine($"{s.Name}: {s.Hp}"); Console.WriteLine("[press enter to continue]"); Console.ReadLine(); } }
public static bool BattleWinner(Player p, SpecificMonster s) { if (s.Hp <= 0) { Console.WriteLine($"You killed the monster, gaining {s.Exp} experience! \n"); return(true); } return(false); }
public static void GameMeny(Player p, SpecificMonster s) { GameHeader(); GameData data = new GameData(); List <SpecificMonster> monsterList = data.TestData(); Random random = new Random(); while (true) { if (p.Hp == 0) { break; } if (p.Lvl == 10) { Console.WriteLine("Congratulations, you won the game!"); break; } Console.WriteLine("1. Go Adventuring"); Console.WriteLine("2. Show details about your character"); Console.WriteLine("3. Exit game"); Console.Write("> "); string input = Console.ReadLine(); switch (input) { case "1": if (GameMechanics.AdventureChance()) { s = monsterList[0]; // random.Next(1, 5) GameMechanics.Battle(p, s); } break; case "2": break; case "3": break; } } }
public static void LooseHealthMonster(Player p, SpecificMonster s) { s.Hp = s.Hp - p.Dmg; }
public static void LooseHealthPlayer(Player p, SpecificMonster s) { p.Hp = p.Hp - s.Dmg; }
public static void GetExp(Player p, SpecificMonster s) { p.Exp += s.Exp; LvlUp(p); Console.WriteLine($"You are level {p.Lvl}, and you have {p.Exp} exp and {p.Hp} hp"); }