/// <summary> /// Main battle loop, forces the player and enemy to battle without /// a retreat option. /// </summary> public override void Action() { // TODO: REMOVE THIS // EnemyFactory.SetTestEnemy(new Dragon( // new DragonAttack(new DoubleDamage(0.25), new LifeSteal(0.1, 10)))); bool playerTurnCompleted = false; int round = 1; Player player = Context.Player; // Convenience Enemy enemy = ef.MakeEnemy(); view.Display(enemy.ToString()); view.DisplayEnemyApproach(enemy.Name); view.DisplayEnemyStats(enemy.Health, enemy.Damage.ToString(), enemy.Defence.ToString(), enemy.GoldReward, enemy.Ability.ToString()); view.Display("VS\n"); view.Display(player.ToString()); while (player.IsAlive && enemy.IsAlive) { playerTurnCompleted = false; view.DisplayRound(round); view.DisplayAttackMenu(); var input = UI.getInput("> ", 1, 2); playerTurnCompleted = playerTurn(player, enemy, input); if (playerTurnCompleted) { enemyTurn(enemy, player); round++; } } if (!player.IsAlive) { Context.Clear(); Context.Push(new GameOverState(Context, UI, new View(), false)); return; } if (!enemy.IsAlive && ef.IsDragon) { Context.Clear(); Context.Push(new GameOverState(Context, UI, new View(), true)); return; } Context.Pop(); }