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.
45 lines
1.2 KiB
45 lines
1.2 KiB
6 months ago
|
#include <catch2/catch_test_macros.hpp>
|
||
|
#include <iostream>
|
||
|
#include "rituals.hpp"
|
||
5 months ago
|
#include "battle.hpp"
|
||
6 months ago
|
#include "fsm.hpp"
|
||
|
#include "dinkyecs.hpp"
|
||
6 months ago
|
|
||
|
using namespace combat;
|
||
|
|
||
5 months ago
|
TEST_CASE("battle operations fantasy", "[combat-battle]") {
|
||
6 months ago
|
ai::reset();
|
||
|
ai::init("assets/ai.json");
|
||
5 months ago
|
|
||
6 months ago
|
auto ai_start = ai::load_state("Enemy::initial_state");
|
||
|
auto ai_goal = ai::load_state("Enemy::final_state");
|
||
|
BattleEngine battle;
|
||
|
|
||
5 months ago
|
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});
|
||
5 months ago
|
|
||
5 months ago
|
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});
|
||
5 months ago
|
|
||
5 months ago
|
battle.plan();
|
||
5 months ago
|
|
||
5 months ago
|
while(auto act = battle.next()) {
|
||
|
auto& [entity, enemy_ai, combat] = *act;
|
||
5 months ago
|
|
||
5 months ago
|
fmt::println("entity: {} wants to {} and has {} HP and {} damage",
|
||
|
entity,
|
||
|
enemy_ai.wants_to(),
|
||
|
combat.hp, combat.damage);
|
||
|
}
|
||
6 months ago
|
|
||
5 months ago
|
REQUIRE(!battle.next());
|
||
6 months ago
|
}
|