From 1e590fd91f9b67dfd413d213c510c9c07f9c33ae Mon Sep 17 00:00:00 2001 From: MistEO Date: Mon, 26 Dec 2022 15:09:44 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=88=98=E6=96=97=E7=9A=84cooling=E7=AD=89=E5=BE=85=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Task/Miscellaneous/BattleProcessTask.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/MaaCore/Task/Miscellaneous/BattleProcessTask.cpp b/src/MaaCore/Task/Miscellaneous/BattleProcessTask.cpp index 1b9208b909..e0cb70f624 100644 --- a/src/MaaCore/Task/Miscellaneous/BattleProcessTask.cpp +++ b/src/MaaCore/Task/Miscellaneous/BattleProcessTask.cpp @@ -278,14 +278,11 @@ bool asst::BattleProcessTask::wait_condition(const Action& action) // 计算有几个干员在cd if (action.cooling >= 0) { while (!need_exit()) { - BattleImageAnalyzer analyzer(ctrler()->get_image()); - analyzer.set_target(BattleImageAnalyzer::Target::Oper); - if (analyzer.analyze()) { - int cooling_count = static_cast( - ranges::count_if(analyzer.get_opers(), [](const auto& oper) -> bool { return oper.cooling; })); - if (cooling_count == action.cooling) { - break; - } + update_deployment(); + size_t cooling_count = ranges::count_if(m_cur_deployment_opers | views::values, + [](const auto& oper) -> bool { return oper.cooling; }); + if (cooling_count == action.cooling) { + break; } use_all_ready_skill(); }