mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-17 18:01:26 +08:00
feat: 新增自动战斗自动编队识别错误时的重试机制
This commit is contained in:
@@ -29,13 +29,26 @@ bool asst::BattleFormationTask::_run()
|
||||
|
||||
for (auto& [role, oper_groups] : m_formation) {
|
||||
click_role_table(role);
|
||||
// TODO: 需要加一个滑到头了的检测
|
||||
bool has_error = false;
|
||||
while (!need_exit()) {
|
||||
select_opers_in_cur_page(oper_groups);
|
||||
if (oper_groups.empty()) {
|
||||
break;
|
||||
if (select_opers_in_cur_page(oper_groups)) {
|
||||
has_error = false;
|
||||
if (oper_groups.empty()) {
|
||||
break;
|
||||
}
|
||||
swipe_page();
|
||||
}
|
||||
else if (has_error) {
|
||||
// reset page
|
||||
click_role_table(role == BattleRole::Unknown ? BattleRole::Pioneer : BattleRole::Unknown);
|
||||
click_role_table(role);
|
||||
has_error = false;
|
||||
}
|
||||
else {
|
||||
has_error = true;
|
||||
// swipe and retry again
|
||||
swipe_page();
|
||||
}
|
||||
swipe_page();
|
||||
}
|
||||
}
|
||||
confirm_selection();
|
||||
@@ -80,6 +93,10 @@ bool asst::BattleFormationTask::select_opers_in_cur_page(std::vector<OperGroup>&
|
||||
return lhs.rect.y < rhs.rect.y;
|
||||
}
|
||||
});
|
||||
if (m_the_right_name == opers_result.back().text) {
|
||||
return false;
|
||||
}
|
||||
m_the_right_name = opers_result.back().text;
|
||||
|
||||
static const std::array<Rect, 3> SkillRectArray = {
|
||||
Task.get("BattleQuickFormationSkill1")->specific_rect,
|
||||
|
||||
@@ -25,5 +25,6 @@ namespace asst
|
||||
|
||||
std::string m_stage_name;
|
||||
std::unordered_map<BattleRole, std::vector<OperGroup>> m_formation;
|
||||
std::string m_the_right_name;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user