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; } } }