You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.2 KiB
44 lines
1.2 KiB
#include <catch2/catch_test_macros.hpp>
|
|
#include <iostream>
|
|
#include "rituals.hpp"
|
|
#include "battle.hpp"
|
|
#include "fsm.hpp"
|
|
#include "dinkyecs.hpp"
|
|
|
|
using namespace combat;
|
|
|
|
TEST_CASE("battle operations fantasy", "[combat-battle]") {
|
|
ai::reset();
|
|
ai::init("assets/ai.json");
|
|
|
|
auto ai_start = ai::load_state("Enemy::initial_state");
|
|
auto ai_goal = ai::load_state("Enemy::final_state");
|
|
BattleEngine battle;
|
|
|
|
DinkyECS::Entity axe_ranger = 0;
|
|
ai::EntityAI axe_ai("Enemy::actions", ai_start, ai_goal);
|
|
axe_ai.set_state("tough_personality", true);
|
|
axe_ai.set_state("health_good", true);
|
|
components::Combat axe_combat{100, 100, 20};
|
|
battle.add_enemy({axe_ranger, axe_ai, axe_combat});
|
|
|
|
DinkyECS::Entity rat = 1;
|
|
ai::EntityAI rat_ai("Enemy::actions", ai_start, ai_goal);
|
|
rat_ai.set_state("tough_personality", false);
|
|
rat_ai.set_state("health_good", true);
|
|
components::Combat rat_combat{10, 10, 2};
|
|
battle.add_enemy({rat, rat_ai, rat_combat});
|
|
|
|
battle.plan();
|
|
|
|
while(auto act = battle.next()) {
|
|
auto& [entity, enemy_ai, combat] = *act;
|
|
|
|
fmt::println("entity: {} wants to {} and has {} HP and {} damage",
|
|
entity,
|
|
enemy_ai.wants_to(),
|
|
combat.hp, combat.damage);
|
|
}
|
|
|
|
REQUIRE(!battle.next());
|
|
}
|
|
|