// Advantage is player advantage, who attacked first private void BattleLoop (Player p, AbstractEnemy enemy, bool advantage, AbstractArea area) { rnd.DisplayGameMode(area.GameState); if (advantage) { // Player attack with advantage } while (enemy.Health > 0) { Console.WriteLine("You are being attacked"); enemy.AttackBehaviour.Attack(p, enemy); if (p.HP < 0) { break; } rnd.BattleFeed(p, enemy); // Player attack menu } }
// Player actions // Attack public void Attack(AbstractEnemy enemy) { enemy.Health--; }
public void BattleFeed(Player p, AbstractEnemy e) { Console.WriteLine($"Your HP: {p.HP}"); }