#pragma once #include "rituals.hpp" #include "config.hpp" #include "dinkyecs.hpp" #include #include "components.hpp" #include namespace combat { enum class BattleHostState { not_host = 0, agree = 1, disagree = 2, out_of_ap = 3 }; struct Combatant { DinkyECS::Entity entity = DinkyECS::NONE; ai::EntityAI* ai = nullptr; components::Combat* combat = nullptr; bool is_host=false; }; struct BattleResult { Combatant enemy; std::string wants_to; int cost; BattleHostState host_state; }; struct BattleEngine { std::unordered_map $combatants; std::vector $pending_actions; std::unordered_map $player_requests; components::Combat* $host_combat = nullptr; void add_enemy(Combatant ba); Combatant& get_enemy(DinkyECS::Entity entity); bool plan(); std::optional next(); void dump(); void set(DinkyECS::Entity entity, const std::string& state, bool setting); void set_all(const std::string& state, bool setting); bool player_request(const std::string& request); int player_pending_ap(); void clear_requests(); void ap_refresh(); }; }