From 9fe8f5dff579c70ceb341b2c6c023ca821825907 Mon Sep 17 00:00:00 2001 From: MistEO Date: Sun, 29 May 2022 04:40:44 +0800 Subject: [PATCH] =?UTF-8?q?feat.=E8=87=AA=E5=8A=A8=E6=88=98=E6=96=97?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=94=AF=E6=8C=81=E6=8C=89location=E6=92=A4?= =?UTF-8?q?=E9=80=80=EF=BC=88=E5=B0=BD=E9=87=8F=E5=B0=91=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAssistant/BattleProcessTask.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/MeoAssistant/BattleProcessTask.cpp b/src/MeoAssistant/BattleProcessTask.cpp index aa36d357eb..b09a8ea1bd 100644 --- a/src/MeoAssistant/BattleProcessTask.cpp +++ b/src/MeoAssistant/BattleProcessTask.cpp @@ -443,17 +443,18 @@ bool asst::BattleProcessTask::oper_deploy(const BattleAction& action) bool asst::BattleProcessTask::oper_retreat(const BattleAction& action) { const std::string& name = m_group_to_oper_mapping[action.group_name].name; - auto iter = m_used_opers.find(name); - if (iter == m_used_opers.cend()) { - Log.error(name, " not used"); - return false; + Point pos; + if (auto iter = m_used_opers.find(name); + iter != m_used_opers.cend()) { + pos = iter->second.pos; + m_used_opers.erase(name); + } + else { + pos = m_normal_tile_info.at(action.location).pos; } - Point pos = iter->second.pos; m_ctrler->click(pos); sleep(Task.get("BattleUseOper")->pre_delay); - m_used_opers.erase(name); - return ProcessTask(*this, { "BattleOperRetreat" }).run(); }