From a21812a67609f92128e794efbb3097a6fb51da05 Mon Sep 17 00:00:00 2001 From: DavidWang19 Date: Sat, 8 Oct 2022 17:53:06 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=8F=AC?= =?UTF-8?q?=E5=94=A4=E7=89=A9=E8=AF=86=E5=88=AB=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/tasks.json | 6 +++++- .../Task/Plugin/RoguelikeBattleTaskPlugin.cpp | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/resource/tasks.json b/resource/tasks.json index 80b6721698..21ff59a9ef 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -6078,6 +6078,10 @@ "template": "empty.png", "templThreshold": 0.6 }, + "DiceAvatarMatch": { + "template": "empty.png", + "templThreshold": 0.8 + }, "BattleKillsFlag": { "roi": [ 150, @@ -8995,4 +8999,4 @@ 138 ] } -} \ No newline at end of file +} diff --git a/src/MeoAssistant/Task/Plugin/RoguelikeBattleTaskPlugin.cpp b/src/MeoAssistant/Task/Plugin/RoguelikeBattleTaskPlugin.cpp index a3e6251d82..d824648c1e 100644 --- a/src/MeoAssistant/Task/Plugin/RoguelikeBattleTaskPlugin.cpp +++ b/src/MeoAssistant/Task/Plugin/RoguelikeBattleTaskPlugin.cpp @@ -294,17 +294,21 @@ bool asst::RoguelikeBattleTaskPlugin::auto_battle() const auto use_oper_task_ptr = Task.get("BattleUseOper"); bool has_dice = false; BattleRealTimeOper dice; - for (auto& oper : opers) { + for (const auto& oper : opers) { if (oper.cooling) cooling_count++; if (oper.available) available_count++; + } + for (auto& oper : opers) { if (oper.role == BattleRole::Drone) { if (!m_dice_image.empty()) { - MatchImageAnalyzer dice_analyzer(image); + MatchImageAnalyzer dice_analyzer(oper.avatar); + dice_analyzer.set_task_info("DiceAvatarMatch"); dice_analyzer.set_templ(m_dice_image); if (dice_analyzer.analyze()) { has_dice = true; oper.name = "骰子"; dice = oper; + break; } } }