public void Battle(Hero hero, Town town, Location location) { Enemy enemy = new Enemy(locationEnemes[rnd.Next(2)], 1); while ((enemy.GetSetHP > 0) && (hero.GetSetHP > 0)) { Console.Clear(); Console.Beep(200, 300); Program.code = 0; Program.menuItem = 1; Program.cursorPosition[0] = '>'; do { Console.Clear(); Console.WriteLine("\n " + locationName); enemy.PrintInfo(); hero.PrintInfo(); Console.WriteLine(); Console.Write("\n{0} Атаковать\n{1} Использовать зелье регенерации", Program.cursorPosition[0], Program.cursorPosition[1]); Program.code = Program.Cursor(2); } while (Program.code == 0); if (Program.code == 1) { Console.WriteLine(); Console.WriteLine(); enemy.DamageTaking(hero.Attack()); hero.DamageTaking(enemy.Attack()); Console.ReadLine(); } else if (Program.code == 2) { Console.Clear(); hero.UseRegen(); } } if (hero.GetSetHP <= 0) { hero.Death(hero); } enemy.DeathAndDrop(hero); Program.code = 0; Program.menuItem = 1; Program.cursorPosition[0] = '>'; do { Console.Clear(); Console.Write("\n{0} Продолжить\n{1} Вернуться в город", Program.cursorPosition[0], Program.cursorPosition[1]); Program.code = Program.Cursor(2); } while (Program.code == 0); if (Program.code == 1) { location.Battle(hero, town, location); } else if (Program.code == 2) { Console.Clear(); Town.ChoiceInTown(hero, town); } }
static public void Battle(Hero hero, EnemyType enemyType) { Enemy enemy = new Enemy(enemyType, 1); while ((enemy.GetSetHP > 0) && (hero.GetSetHP > 0)) { Console.Clear(); Console.Beep(200, 300); Program.code = 0; Program.menuItem = 1; Program.cursorPosition[0] = '>'; do { Console.Clear(); enemy.PrintInfo(); hero.PrintInfo(); Console.WriteLine(); Console.Write("\n{0} Атаковать\n{1} Использовать зелье регенерации", Program.cursorPosition[0], Program.cursorPosition[1]); Program.code = Program.Cursor(2); } while (Program.code == 0); if (Program.code == 1) { Console.WriteLine(); Console.WriteLine(); enemy.DamageTaking(hero.Attack()); hero.DamageTaking(enemy.Attack()); Console.ReadLine(); } else if (Program.code == 2) { Console.Clear(); hero.UseRegen(); } } if (hero.GetSetHP <= 0) { hero.Death(hero); } enemy.DeathAndDrop(hero); }