From de2c50ec7ebe51939ccc84aad42f69840abe1a6d Mon Sep 17 00:00:00 2001 From: status102 <102887808+status102@users.noreply.github.com> Date: Thu, 17 Apr 2025 12:40:27 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"perf:=20=E8=87=AA=E5=8A=A8=E6=88=98?= =?UTF-8?q?=E6=96=97=E5=BE=85=E9=83=A8=E7=BD=B2=E8=AF=86=E5=88=AB=E5=87=8F?= =?UTF-8?q?=E5=B0=91=E4=B8=80=E6=AC=A1=E9=A2=84=E8=AF=86=E5=88=AB"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 0839de2c948619e0090396a7213a04a274bb3ea8. --- src/MaaCore/Task/BattleHelper.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/MaaCore/Task/BattleHelper.cpp b/src/MaaCore/Task/BattleHelper.cpp index 771104d323..244ab48d27 100644 --- a/src/MaaCore/Task/BattleHelper.cpp +++ b/src/MaaCore/Task/BattleHelper.cpp @@ -179,8 +179,21 @@ bool asst::BattleHelper::update_deployment_( } Rect oper_rect = oper.rect; + // 点完部署区的一个干员之后,他的头像会放大;其他干员的位置都被挤开了,不在原来的位置了 + // 所以只有第一个干员可以直接点,后面干员都要重新识别一下位置 + if (!name_image.empty()) { + Matcher re_matcher(name_image); + re_matcher.set_task_info("BattleAvatarReMatch"); + re_matcher.set_templ(oper.avatar); + if (re_matcher.analyze()) { + oper_rect = re_matcher.get_result().rect; + } + } + click_oper_on_deployment(oper_rect); + name_image = m_inst_helper.ctrler()->get_image(); + std::string name = analyze_detail_page_oper_name(name_image); // 这时候即使名字不合法也只能凑合用了,但是为空还是不行的 if (name.empty()) { @@ -243,6 +256,7 @@ bool asst::BattleHelper::update_deployment(bool init, const cv::Mat& reusable, b return false; } const auto old_deployment_opers = std::move(m_cur_deployment_opers); + if (!update_deployment_(oper_result_opt->deployment, old_deployment_opers, false)) { // 发现未知干员,暂停游戏后再重新识别干员 do { @@ -278,7 +292,7 @@ bool asst::BattleHelper::update_deployment(bool init, const cv::Mat& reusable, b } update_deployment_(oper_result_opt->deployment, old_deployment_opers, true); pause(); - + cancel_oper_selection(); image = m_inst_helper.ctrler()->get_image(); }