public void Tick() { if (IsFinished) { return; } var sortedByInitiative = Actors .OrderByDescending(actor => InitiativeStatsVisitor.Calculate(actor.Stats)); foreach (var actor in sortedByInitiative) { if (actor.AttemptRetreat) { actor.AttemptRetreat = false; if (AttemptRetreat(actor)) { break; } } else if (actor.IsAlive) { Attack(actor); } } EnemiesDead = Enemies.All(a => !a.IsAlive); PlayerDead = !Player.IsAlive && !EnemiesDead; IsFinished = PlayerDead || EnemiesDead || FinishedByRetreat; }
private bool CheckEnemiesDead() { return(Enemies.All(enemy => enemy.IsDead || enemy.IsEmpty)); }