feat: 新增自动战斗自动编队识别错误时的重试机制

This commit is contained in:
MistEO
2022-11-22 23:21:49 +08:00
parent 9d3e38e5a6
commit da3d2e1464
2 changed files with 23 additions and 5 deletions

View File

@@ -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,

View File

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