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:
Zed A. Shaw 2025-11-27 12:46:14 -05:00
parent d244106981
commit b48df3f4db
10 changed files with 104 additions and 59 deletions

View file

@ -56,17 +56,17 @@ namespace boss {
auto& boss_ai = world->get<ai::EntityAI>(boss_id);
combat::BattleEngine battle;
battle.add_enemy({boss_id, boss_ai, boss_combat});
battle.add_enemy({boss_id, &boss_ai, &boss_combat});
battle.set_all("enemy_found", true);
battle.set_all("in_combat", true);
battle.plan();
while(auto act = battle.next()) {
auto [enemy, enemy_action] = *act;
auto [enemy, ai_action, enemy_action] = *act;
Events::Combat result {
player_combat.attack(enemy.combat), 0
player_combat.attack(*enemy.combat), 0
};
if(result.player_did > 0) {
@ -76,7 +76,7 @@ namespace boss {
}
if(enemy_action == combat::BattleAction::ATTACK) {
result.enemy_did = enemy.combat.attack(player_combat);
result.enemy_did = enemy.combat->attack(player_combat);
}
// need to replicate this in the boss UI