AI engine is working and I have a little BattleEngine going but the AI is working better than it should in systems.cpp. Need to find out why then make the BattleEngine avoid running entities that have END in action lists.
This commit is contained in:
parent
da273cbee6
commit
47c6bfd531
13 changed files with 131 additions and 27 deletions
10
tests/ai.cpp
10
tests/ai.cpp
|
@ -131,14 +131,14 @@ TEST_CASE("ai as a module like sound/sprites", "[ai]") {
|
|||
TEST_CASE("ai autowalker ai test", "[ai]") {
|
||||
ai::reset();
|
||||
ai::init("assets/ai.json");
|
||||
auto start = ai::load_state("Walker::initial_state");
|
||||
auto goal = ai::load_state("Walker::final_state");
|
||||
auto start = ai::load_state("Host::initial_state");
|
||||
auto goal = ai::load_state("Host::final_state");
|
||||
int enemy_count = 5;
|
||||
|
||||
ai::set(start, "no_more_enemies", enemy_count == 0);
|
||||
|
||||
// find an enemy and kill them
|
||||
auto a_plan = ai::plan("Walker::actions", start, goal);
|
||||
auto a_plan = ai::plan("Host::actions", start, goal);
|
||||
REQUIRE(!a_plan.complete);
|
||||
|
||||
auto result = ai::dump_script("\n\nWALKER KILL STUFF", start, a_plan.script);
|
||||
|
@ -154,7 +154,7 @@ TEST_CASE("ai autowalker ai test", "[ai]") {
|
|||
ai::set(result, "have_item", true);
|
||||
REQUIRE(!ai::test(result, "health_good"));
|
||||
|
||||
auto health_plan = ai::plan("Walker::actions", result, goal);
|
||||
auto health_plan = ai::plan("Host::actions", result, goal);
|
||||
result = ai::dump_script("\n\nWALKER NEED HEALTH", result, health_plan.script);
|
||||
REQUIRE(!health_plan.complete);
|
||||
REQUIRE(ai::test(result, "health_good"));
|
||||
|
@ -163,7 +163,7 @@ TEST_CASE("ai autowalker ai test", "[ai]") {
|
|||
ai::set(result, "no_more_enemies", true);
|
||||
REQUIRE(ai::test(result, "no_more_enemies"));
|
||||
|
||||
auto new_plan = ai::plan("Walker::actions", result, goal);
|
||||
auto new_plan = ai::plan("Host::actions", result, goal);
|
||||
result = ai::dump_script("\n\nWALKER COMPLETE", result, new_plan.script);
|
||||
REQUIRE(new_plan.complete);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue