38 lines
903 B
C++
38 lines
903 B
C++
#pragma once
|
|
#include "rituals.hpp"
|
|
#include "config.hpp"
|
|
#include "dinkyecs.hpp"
|
|
#include <optional>
|
|
#include "components.hpp"
|
|
|
|
namespace combat {
|
|
|
|
struct Combatant {
|
|
DinkyECS::Entity entity = DinkyECS::NONE;
|
|
ai::EntityAI* ai = nullptr;
|
|
components::Combat* combat = nullptr;
|
|
};
|
|
|
|
enum class BattleAction {
|
|
ATTACK, BLOCK, ESCAPE, OTHER
|
|
};
|
|
|
|
struct BattleResult {
|
|
Combatant state;
|
|
ai::Action wants_to;
|
|
BattleAction action;
|
|
};
|
|
|
|
struct BattleEngine {
|
|
std::unordered_map<DinkyECS::Entity, Combatant> combatants;
|
|
std::vector<BattleResult> pending_actions;
|
|
|
|
void add_enemy(Combatant ba);
|
|
Combatant& get_enemy(DinkyECS::Entity entity);
|
|
bool plan();
|
|
std::optional<BattleResult> next();
|
|
void dump();
|
|
void set(DinkyECS::Entity entity, const std::string& state, bool setting);
|
|
void set_all(const std::string& state, bool setting);
|
|
};
|
|
}
|