Refactored rituals so they can be used in different situations.
This commit is contained in:
parent
5af9a6664e
commit
da273cbee6
8 changed files with 123 additions and 66 deletions
21
tests/ai.cpp
21
tests/ai.cpp
|
@ -209,24 +209,3 @@ TEST_CASE("Confirm EntityAI behaves as expected", "[ai]") {
|
|||
enemy.update();
|
||||
REQUIRE(enemy.wants_to("run_away"));
|
||||
}
|
||||
|
||||
TEST_CASE("confirm that cycles are avoided/detected", "[ai]") {
|
||||
ai::reset();
|
||||
ai::init("tests/cyclic_rituals.json");
|
||||
|
||||
auto start = ai::load_state("initial");
|
||||
auto goal = ai::load_state("final");
|
||||
|
||||
combat::RitualAI ritual("actions", start, goal);
|
||||
ritual.reset();
|
||||
ritual.set_state("has_magick", true);
|
||||
ritual.set_state("cursed_item", true);
|
||||
ritual.set_state("shiny_bauble", true);
|
||||
|
||||
bool it_throws = false;
|
||||
try { ritual.update(); } catch(...) { it_throws = true; }
|
||||
REQUIRE(it_throws);
|
||||
|
||||
fmt::println("\n\n------------ CYCLES AVOIDED");
|
||||
ritual.dump();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue