Can now run the full AI for all combatants and then sort by the action costs to make the action queue.
This commit is contained in:
parent
d244106981
commit
b48df3f4db
10 changed files with 104 additions and 59 deletions
13
battle.hpp
13
battle.hpp
|
|
@ -8,17 +8,18 @@
|
|||
namespace combat {
|
||||
|
||||
struct Combatant {
|
||||
DinkyECS::Entity entity;
|
||||
ai::EntityAI &ai;
|
||||
components::Combat &combat;
|
||||
DinkyECS::Entity entity = DinkyECS::NONE;
|
||||
ai::EntityAI* ai = nullptr;
|
||||
components::Combat* combat = nullptr;
|
||||
};
|
||||
|
||||
enum class BattleAction {
|
||||
ATTACK, BLOCK, ESCAPE
|
||||
ATTACK, BLOCK, ESCAPE, OTHER
|
||||
};
|
||||
|
||||
struct BattleResult {
|
||||
Combatant &state;
|
||||
Combatant state;
|
||||
ai::Action wants_to;
|
||||
BattleAction action;
|
||||
};
|
||||
|
||||
|
|
@ -27,11 +28,11 @@ namespace combat {
|
|||
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);
|
||||
void queue(DinkyECS::Entity entity, BattleAction action);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue