#include "BaseBattle.h" #include #include #include #include #include #include #include #include #include #include #include #include "Builder.h" #include "RandomSpawner.h" namespace kurator { namespace sim { BaseBattle::BaseBattle(const campaign::Scenario& scenario) { load_scenario(state, scenario); manager.extend(state.registry); } engine::Context BaseBattle::context() { return state; } engine::ConstContext BaseBattle::const_context() const { return state; } void BaseBattle::update(engine::Context& ctx) { pick_random_targets(); keep_at_range(ctx); FloatingMovement::update(ctx); TurretControl::update(ctx); kill_off_dead(ctx); manager.update(ctx); } void BaseBattle::pick_random_targets() { auto view = state.registry.view(); for (auto&& [entity, team, ai] : view.each()) { if (!state.registry.valid(ai.target)) ai.target = manager.random(team.id); } } } // namespace sim } // namespace kurator