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

@ -19,8 +19,10 @@ TEST_CASE("cause scared rat won't run away bug", "[combat-fail]") {
ai::EntityAI rat("Enemy::actions", ai_start, ai_goal);
rat.set_state("tough_personality", false);
rat.set_state("health_good", false);
REQUIRE(!rat.active());
battle.add_enemy(rat_id, rat);
battle.plan();
REQUIRE(rat.active());
rat.dump();
REQUIRE(rat.wants_to("run_away"));
}