AI now follows the A* algorithm more closely by using a separate priority queue from the open_set.
This commit is contained in:
parent
72951f308f
commit
922fbeba0e
9 changed files with 72 additions and 75 deletions
11
tests/ai.cpp
11
tests/ai.cpp
|
@ -143,7 +143,6 @@ TEST_CASE("ai autowalker ai test", "[ai]") {
|
|||
|
||||
auto result = ai::dump_script("\n\nWALKER KILL STUFF", start, a_plan.script);
|
||||
REQUIRE(ai::test(result, "enemy_found"));
|
||||
REQUIRE(ai::test(result, "enemy_dead"));
|
||||
REQUIRE(!ai::test(result, "no_more_enemies"));
|
||||
|
||||
// health is low, go heal
|
||||
|
@ -164,11 +163,8 @@ TEST_CASE("ai autowalker ai test", "[ai]") {
|
|||
REQUIRE(ai::test(result, "no_more_enemies"));
|
||||
|
||||
auto new_plan = ai::plan("Host::actions", result, goal);
|
||||
result = ai::dump_script("\n\nWALKER COMPLETE", result, new_plan.script);
|
||||
REQUIRE(new_plan.complete);
|
||||
|
||||
REQUIRE(ai::test(result, "enemy_found"));
|
||||
REQUIRE(ai::test(result, "enemy_dead"));
|
||||
result = ai::dump_script("\n\nWALKER COLLECT ITEMS", result, new_plan.script);
|
||||
REQUIRE(ai::test(result, "no_more_items"));
|
||||
REQUIRE(ai::test(result, "no_more_enemies"));
|
||||
}
|
||||
|
||||
|
@ -185,6 +181,7 @@ TEST_CASE("Confirm EntityAI behaves as expected", "[ai]") {
|
|||
REQUIRE(enemy.wants_to("find_enemy"));
|
||||
|
||||
enemy.set_state("enemy_found", true);
|
||||
enemy.set_state("in_combat", true);
|
||||
enemy.update();
|
||||
REQUIRE(enemy.wants_to("kill_enemy"));
|
||||
|
||||
|
@ -202,10 +199,12 @@ TEST_CASE("Confirm EntityAI behaves as expected", "[ai]") {
|
|||
enemy.update();
|
||||
REQUIRE(enemy.wants_to("kill_enemy"));
|
||||
|
||||
fmt::println("\n\n\n\n=============================\n\n\n\n");
|
||||
enemy.set_state("have_healing", false);
|
||||
enemy.set_state("tough_personality", false);
|
||||
enemy.set_state("in_combat", true);
|
||||
enemy.set_state("health_good", false);
|
||||
enemy.update();
|
||||
enemy.dump();
|
||||
REQUIRE(enemy.wants_to("run_away"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue