This does a 'fit_sort' whenever the state is changed. fit_sort effectively sorts the actions by distance+cost so that the cost is actually present unlike the original algorithm.

This commit is contained in:
Zed A. Shaw 2025-04-03 10:14:50 -04:00
parent c014e65c13
commit c1aba2d5c8
5 changed files with 30 additions and 27 deletions

View file

@ -205,7 +205,5 @@ TEST_CASE("Confirm EntityAI behaves as expected", "[ai]") {
enemy.set_state("in_combat", true);
enemy.set_state("health_good", false);
enemy.update();
auto& best = enemy.best_fit();
REQUIRE(best.name == "run_away");
REQUIRE(enemy.wants_to("run_away"));
}