|
|
|
@ -6,16 +6,21 @@ |
|
|
|
|
struct RitualAI { |
|
|
|
|
std::string script; |
|
|
|
|
ai::State start; |
|
|
|
|
ai::State original; |
|
|
|
|
ai::State goal; |
|
|
|
|
ai::ActionPlan plan; |
|
|
|
|
|
|
|
|
|
RitualAI(std::string script, ai::State start, ai::State goal) : |
|
|
|
|
script(script), start(start), goal(goal) |
|
|
|
|
script(script), start(start), original(start), goal(goal) |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
RitualAI() {}; |
|
|
|
|
|
|
|
|
|
void reset() { |
|
|
|
|
start = original; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool will_do(std::string name) { |
|
|
|
|
ai::check_valid_action(name, "RitualAI::is_able_to"); |
|
|
|
|
return plan.script[0].name == name; |
|
|
|
@ -35,15 +40,6 @@ struct RitualAI { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
TEST_CASE("prototype combat system ideas", "[combat]") { |
|
|
|
|
// as the player picks up items they go in the invetory
|
|
|
|
|
// and they player has little "bags" they can put items
|
|
|
|
|
// in that combine the items into rituals. How the items
|
|
|
|
|
// combine is controlled by the GOAP algorithm but tailored
|
|
|
|
|
// to item combinations that produce effects
|
|
|
|
|
|
|
|
|
|
// probably need to use the code in ai.cpp in a different
|
|
|
|
|
// system for the ritual loading stuff
|
|
|
|
|
//
|
|
|
|
|
ai::reset(); |
|
|
|
|
ai::init("assets/rituals.json"); |
|
|
|
|
|
|
|
|
@ -54,14 +50,18 @@ TEST_CASE("prototype combat system ideas", "[combat]") { |
|
|
|
|
|
|
|
|
|
ritual.set_state("has_spikes", true); |
|
|
|
|
ritual.update(); |
|
|
|
|
|
|
|
|
|
fmt::println("------------ TEST WILL DO PIERCE"); |
|
|
|
|
ritual.dump(); |
|
|
|
|
REQUIRE(ritual.will_do("pierce_type")); |
|
|
|
|
|
|
|
|
|
ritual.reset(); |
|
|
|
|
ritual.set_state("has_magick", true); |
|
|
|
|
ritual.set_state("has_spikes", true); |
|
|
|
|
ritual.update(); |
|
|
|
|
|
|
|
|
|
fmt::println("------------ TEST WILL DO MAGICK TOO"); |
|
|
|
|
ritual.dump(); |
|
|
|
|
REQUIRE(ritual.will_do("magick_type")); |
|
|
|
|
|
|
|
|
|
ritual.plan.script.pop_front(); |
|
|
|
|
REQUIRE(ritual.will_do("pierce_type")); |
|
|
|
|
} |
|
|
|
|