From 66a9bac83cffadd3f46f3aea3acc2d8edfdd7a2f Mon Sep 17 00:00:00 2001 From: MistEO Date: Sun, 20 Aug 2023 21:02:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BC=96=E9=98=9F?= =?UTF-8?q?=E6=97=B6=E2=80=9C=E5=85=A8=E9=83=A8=E2=80=9D=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #5962 --- resource/tasks.json | 7 +++++++ src/MaaCore/Task/Miscellaneous/BattleFormationTask.cpp | 10 +++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/resource/tasks.json b/resource/tasks.json index c0bdb7e140..f8feefe787 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -6585,6 +6585,13 @@ 133 ] }, + "BattleQuickFormationRole-All-OCR": { + "baseTask": "BattleQuickFormationRole-All", + "algorithm": "OcrDetect", + "text": [ + "全部" + ] + }, "BattleQuickFormationRole-Pioneer": { "baseTask": "BattleQuickFormationRole" }, diff --git a/src/MaaCore/Task/Miscellaneous/BattleFormationTask.cpp b/src/MaaCore/Task/Miscellaneous/BattleFormationTask.cpp index a18283524d..8aa4bfdbfa 100644 --- a/src/MaaCore/Task/Miscellaneous/BattleFormationTask.cpp +++ b/src/MaaCore/Task/Miscellaneous/BattleFormationTask.cpp @@ -249,17 +249,20 @@ bool asst::BattleFormationTask::click_role_table(battle::Role role) static const std::unordered_map RoleNameType = { { battle::Role::Caster, "Caster" }, { battle::Role::Medic, "Medic" }, { battle::Role::Pioneer, "Pioneer" }, { battle::Role::Sniper, "Sniper" }, { battle::Role::Special, "Special" }, { battle::Role::Support, "Support" }, - { battle::Role::Tank, "Tank" }, { battle::Role::Warrior, "Warrior" }, { battle::Role::Unknown, "All" }, + { battle::Role::Tank, "Tank" }, { battle::Role::Warrior, "Warrior" }, }; m_last_oper_name.clear(); auto role_iter = RoleNameType.find(role); + + std::vector tasks; if (role_iter == RoleNameType.cend()) { - return ProcessTask(*this, { "BattleQuickFormationRole-All" }).set_retry_times(0).run(); + tasks = { "BattleQuickFormationRole-All", "BattleQuickFormationRole-All-OCR" }; } else { - return ProcessTask(*this, { "BattleQuickFormationRole-" + role_iter->second }).set_retry_times(0).run(); + tasks = { "BattleQuickFormationRole-" + role_iter->second }; } + return ProcessTask(*this, tasks).set_retry_times(0).run(); } bool asst::BattleFormationTask::parse_formation() @@ -285,6 +288,7 @@ bool asst::BattleFormationTask::parse_formation() same_role &= BattleData.get_role(oper.name) == role; } + // for unknown, will use { "BattleQuickFormationRole-All", "BattleQuickFormationRole-All-OCR" } m_formation[same_role ? role : battle::Role::Unknown].emplace_back(opers_vec); }