BattleEngine is now connected to the boss::UI so as you click it'll continually run the plan and figure out the AI actions.

This commit is contained in:
Zed A. Shaw 2025-12-05 00:51:35 -05:00
parent a38bb5b691
commit f839edcd56
10 changed files with 112 additions and 56 deletions

View file

@ -6,6 +6,7 @@ namespace boss {
Fight::Fight(shared_ptr<World> world, Entity boss_id, Entity player_id) :
$world(world),
$boss_id(boss_id),
$battle(System::create_battle($world, $boss_id)),
$ui(world, boss_id, player_id)
{
$ui.init();
@ -96,7 +97,14 @@ namespace boss {
$ui.status(L"PLAYER TURN");
const std::string& player_pos = run % 10 < 5 ? "player1" : "player2";
$ui.move_actor("player", player_pos);
boss::System::combat($world, $boss_id, attack_id);
boss::System::plan_battle($battle, $world, $boss_id);
while(auto action = $battle.next()) {
fmt::println("*** combat turn run: eid={}",
action->enemy.entity);
boss::System::combat(*action, $world, $boss_id, attack_id);
}
$ui.update_stats();
state(State::PLAYER_TURN);
} break;
@ -125,7 +133,6 @@ namespace boss {
$ui.move_actor("boss", boss_at);
$ui.animate_actor("boss");
int attack_id = std::any_cast<int>(data);
boss::System::combat($world, $boss_id, attack_id);
state(State::BOSS_TURN);
} break;
case TICK: