Fix up the main game based on arena changes.

This commit is contained in:
Zed A. Shaw 2025-12-05 11:20:35 -05:00
parent f839edcd56
commit 94b46a2f95
5 changed files with 9 additions and 10 deletions

View file

@ -19,6 +19,9 @@ namespace combat {
fmt::println("---------- start combatants");
for(auto& [entity, enemy] : $combatants) {
//NOTE: this is just for asserting I'm using things right
if(enemy.is_host) had_host = true;
if(enemy.combat->ap < enemy.combat->max_ap) {
int new_ap = std::min(enemy.combat->max_ap, enemy.combat->ap_delta + enemy.combat->ap);
@ -29,17 +32,12 @@ namespace combat {
enemy.combat->ap = new_ap;
}
fmt::println("--- enemy {} has {} ap", entity, enemy.combat->ap);
// reset action points
enemy.ai->update();
active += enemy.ai->active();
if(enemy.ai->active()) {
for(auto& action : enemy.ai->plan.script) {
BattleHostState host_state = not_host;
//NOTE: this is just for asserting I'm using things right
if(enemy.is_host) had_host = true;
if(action.cost > enemy.combat->ap) {
host_state = out_of_ap;
@ -66,12 +64,12 @@ namespace combat {
$pending_actions.emplace_back(enemy, action.name, action.cost, host_state);
}
dbc::check(had_host, "FAIL, you forgot to set enemy.is_host=true for one entity");
dbc::check(enemy.combat->ap >= 0, "enemy's AP went below 0");
dbc::check(enemy.combat->ap <= enemy.combat->max_ap, "enemy's AP went above max");
}
}
dbc::check(had_host, "FAIL, you forgot to set enemy.is_host=true for one entity");
fmt::println("<---- end of enemy setup, sorting");
if($pending_actions.size() > 0) {