Autowalker is working way better and now I have a plan for using the AI in the System.

This commit is contained in:
Zed A. Shaw 2025-03-13 13:44:42 -04:00
parent 0623170dbc
commit ee804581a8
11 changed files with 197 additions and 127 deletions

View file

@ -130,7 +130,6 @@ TEST_CASE("ai as a module like sound/sprites", "[ai]") {
TEST_CASE("ai autowalker ai test", "[ai]") {
ai::reset();
ai::init("assets/ai.json");
ai::AIProfile* profile = ai::profile();
auto start = ai::load_state("Walker::initial_state");
auto goal = ai::load_state("Walker::final_state");
int enemy_count = 5;
@ -141,7 +140,7 @@ TEST_CASE("ai autowalker ai test", "[ai]") {
auto a_plan = ai::plan("Walker::actions", start, goal);
REQUIRE(!a_plan.complete);
auto result = ai::dump_script(*profile, "\n\nWALKER KILL STUFF", start, a_plan.script);
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"));
@ -150,10 +149,12 @@ TEST_CASE("ai autowalker ai test", "[ai]") {
ai::set(result, "health_good", false);
ai::set(result, "in_combat", false);
ai::set(result, "enemy_found", false);
ai::set(result, "have_healing", true);
ai::set(result, "have_item", true);
REQUIRE(!ai::test(result, "health_good"));
auto health_plan = ai::plan("Walker::actions", result, goal);
result = ai::dump_script(*profile, "\n\nWALKER NEED HEALTH", result, health_plan.script);
result = ai::dump_script("\n\nWALKER NEED HEALTH", result, health_plan.script);
REQUIRE(!health_plan.complete);
REQUIRE(ai::test(result, "health_good"));
@ -162,7 +163,7 @@ TEST_CASE("ai autowalker ai test", "[ai]") {
REQUIRE(ai::test(result, "no_more_enemies"));
auto new_plan = ai::plan("Walker::actions", result, goal);
result = ai::dump_script(*profile, "\n\nWALKER COMPLETE", result, new_plan.script);
result = ai::dump_script("\n\nWALKER COMPLETE", result, new_plan.script);
REQUIRE(new_plan.complete);
REQUIRE(ai::test(result, "enemy_found"));