diff --git a/battle.cpp b/battle.cpp index 659c07f..fb25d85 100644 --- a/battle.cpp +++ b/battle.cpp @@ -10,6 +10,10 @@ namespace combat { $player_requests.emplace(request); } + void BattleEngine::clear_requests() { + $player_requests.clear(); + } + bool BattleEngine::plan() { dbc::check($player_requests.size() > 0, "Calling plan without any player reqeusts queued."); using enum BattleHostState; @@ -17,7 +21,6 @@ namespace combat { int active = 0; bool had_host = false; - 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; @@ -46,21 +49,10 @@ namespace combat { } if(host_state == out_of_ap) { - fmt::println("--- enemy CANNOT go: {}-{}={}", - enemy.combat->ap, action.cost, - enemy.combat->ap - action.cost); break; } else { - fmt::println("--- enemy can go, {}-{}={}", - enemy.combat->ap, action.cost, - enemy.combat->ap - action.cost); - enemy.combat->ap -= action.cost; } - - fmt::println("--- active enemy {} ap={}, host_state={}", - entity, enemy.combat->ap, int(host_state)); - $pending_actions.emplace_back(enemy, action.name, action.cost, host_state); } @@ -70,8 +62,6 @@ namespace combat { } 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) { std::sort($pending_actions.begin(), $pending_actions.end(), [](const auto& a, const auto& b) -> bool diff --git a/battle.hpp b/battle.hpp index 3062376..376c09c 100644 --- a/battle.hpp +++ b/battle.hpp @@ -42,5 +42,6 @@ namespace combat { void set(DinkyECS::Entity entity, const std::string& state, bool setting); void set_all(const std::string& state, bool setting); void player_request(const std::string& request); + void clear_requests(); }; } diff --git a/tests/battle.cpp b/tests/battle.cpp index 2d51319..c20f588 100644 --- a/tests/battle.cpp +++ b/tests/battle.cpp @@ -68,7 +68,8 @@ TEST_CASE("battle operations fantasy", "[combat-battle]") { break; case BattleHostState::disagree: fmt::println("REBELIOUS ACT: {}", wants_to); - battle.$player_requests.clear(); + battle.clear_requests(); + REQUIRE(battle.$player_requests.size() == 0); break; case BattleHostState::not_host: if(wants_to == "kill_enemy") {