feat: 合并 处于战斗中 检测, 增加倍速记忆, 支持战斗中 不带跳过按钮的 带头像对话教程 (#15706)

* rft: 合并 处于战斗中 检测, 增加倍速记忆

* feat: 支持战斗中 不带跳过按钮的 带头像对话教程

* perf: 增加重试次数上限

* perf: 2倍速检查一致化
This commit is contained in:
Status102
2026-03-07 00:30:36 +08:00
committed by GitHub
parent 7fcaf1215a
commit f6c39c3a8f
6 changed files with 56 additions and 30 deletions

View File

@@ -238,6 +238,9 @@ bool asst::BattleProcessTask::do_action(const battle::copilot::Action& action, s
case ActionType::SwitchSpeed:
ret = speed_up();
if (ret) {
m_in_speedup = !m_in_speedup;
}
break;
case ActionType::BulletTime:
@@ -480,31 +483,12 @@ void asst::BattleProcessTask::sleep_and_do_strategy(unsigned millisecond)
const auto start = std::chrono::steady_clock::now();
const auto delay = millisecond * 1ms;
while (!need_exit() && std::chrono::steady_clock::now() - start < delay) {
do_strategic_action();
cv::Mat image = ctrler()->get_image();
while (!need_exit() && check_in_battle(image) && std::chrono::steady_clock::now() - start < delay) {
do_strategic_action(image);
std::this_thread::yield();
image = ctrler()->get_image();
}
}
bool asst::BattleProcessTask::check_in_battle(const cv::Mat& reusable, bool weak)
{
LogTraceFunction;
cv::Mat image = reusable.empty() ? ctrler()->get_image() : reusable;
if (weak) {
BattlefieldMatcher analyzer(image);
auto result = analyzer.analyze();
m_in_battle = result.has_value();
if (m_in_battle && !result->pause_button) {
if (check_skip_plot_button(image) && check_in_speed_up(image)) {
speed_up();
}
}
}
else {
check_skip_plot_button(image);
m_in_battle = check_pause_button(image);
}
return m_in_battle;
}