From 673b0d75cdfcc66fd403ce943fd7b25c819f618f Mon Sep 17 00:00:00 2001 From: status102 <102887808+status102@users.noreply.github.com> Date: Wed, 21 May 2025 00:44:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BD=BF=E7=94=A8=E7=90=86=E6=99=BA?= =?UTF-8?q?=E8=8D=AF=E5=90=8E=E7=8A=B6=E6=80=81=E6=9C=AA=E8=83=BD=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaCore/Task/Fight/MedicineCounterTaskPlugin.cpp | 10 ++++++---- src/MaaCore/Task/Fight/MedicineCounterTaskPlugin.h | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/MaaCore/Task/Fight/MedicineCounterTaskPlugin.cpp b/src/MaaCore/Task/Fight/MedicineCounterTaskPlugin.cpp index a3b956909e..a1fc0a3700 100644 --- a/src/MaaCore/Task/Fight/MedicineCounterTaskPlugin.cpp +++ b/src/MaaCore/Task/Fight/MedicineCounterTaskPlugin.cpp @@ -22,11 +22,11 @@ bool asst::MedicineCounterTaskPlugin::verify(AsstMsg msg, const json::value& det } const std::string task = details.get("details", "task", ""); - if (task.ends_with("MedicineConfirm") || task.ends_with("StoneConfirm")) { - m_has_opened_medicine = true; + if (/*task.ends_with("MedicineConfirm") 走插件 */ task.ends_with("StoneConfirm")) { + m_has_used_medicine = true; } else if (task.ends_with("StartButton2")) { - m_has_opened_medicine = false; + m_has_used_medicine = false; } return task.ends_with("UseMedicine"); } @@ -119,7 +119,7 @@ bool asst::MedicineCounterTaskPlugin::_run() sleep(waitTime); } } - else if (!m_has_opened_medicine && m_reduce_when_exceed) { // 直接减少药品使用 + else if (!m_has_used_medicine && m_reduce_when_exceed) { // 直接减少药品使用 while (*sanity_target >= *sanity_max) { reduce_excess(*using_medicine, 1); if (!refresh_medicine_count() || !analyze_sanity() || using_medicine->using_count <= 0) { @@ -130,6 +130,7 @@ bool asst::MedicineCounterTaskPlugin::_run() if (auto ptr = m_task_ptr->find_plugin()) { ptr->set_has_used_medicine(); } + m_has_used_medicine = true; ProcessTask(*this, { "CloseStonePage" }) .set_times_limit("CloseStonePage", 1, asst::ProcessTask::TimesLimitType::Post) .set_times_limit("CloseStonePageExceeded", 0) @@ -147,6 +148,7 @@ bool asst::MedicineCounterTaskPlugin::_run() if (auto ptr = m_task_ptr->find_plugin()) { ptr->set_has_used_medicine(); } + m_has_used_medicine = true; auto info = basic_info_with_what("UseMedicine"); info["details"]["is_expiring"] = m_used_count > m_max_count; info["details"]["count"] = using_medicine->using_count; diff --git a/src/MaaCore/Task/Fight/MedicineCounterTaskPlugin.h b/src/MaaCore/Task/Fight/MedicineCounterTaskPlugin.h index 0657ea866d..38fe606ef0 100644 --- a/src/MaaCore/Task/Fight/MedicineCounterTaskPlugin.h +++ b/src/MaaCore/Task/Fight/MedicineCounterTaskPlugin.h @@ -59,7 +59,7 @@ private: bool m_dr_grandet = false; int m_used_count = 0; int m_max_count = 0; - mutable bool m_has_opened_medicine = false; // 是否开过药品页面 - bool m_reduce_when_exceed = false; // 第一次开药品页面时, 超理智上限减少用药 + mutable bool m_has_used_medicine = false; // 是否开过药品页面 + bool m_reduce_when_exceed = false; // 第一次开药品页面时, 超理智上限减少用药 }; }