mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
fix.修复自动抄作业,识别干员之后总会再去识别其中某几个的问题
This commit is contained in:
@@ -17,6 +17,8 @@ bool asst::BattleImageAnalyzer::set_target(int target)
|
||||
|
||||
bool asst::BattleImageAnalyzer::analyze()
|
||||
{
|
||||
clear();
|
||||
|
||||
// HP 作为 flag,无论如何都识别。表明当前画面是在战斗场景的
|
||||
bool ret = hp_analyze();
|
||||
|
||||
@@ -84,6 +86,16 @@ int asst::BattleImageAnalyzer::get_kills() const noexcept
|
||||
return m_kills;
|
||||
}
|
||||
|
||||
void asst::BattleImageAnalyzer::clear() noexcept
|
||||
{
|
||||
m_opers.clear();
|
||||
m_homes.clear();
|
||||
m_ready_skills.clear();
|
||||
m_hp = 0;
|
||||
m_kills = 0;
|
||||
m_cost = 0;
|
||||
}
|
||||
|
||||
bool asst::BattleImageAnalyzer::opers_analyze()
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
@@ -35,6 +35,8 @@ namespace asst
|
||||
int get_hp() const noexcept;
|
||||
int get_kills() const noexcept;
|
||||
|
||||
void clear() noexcept;
|
||||
|
||||
protected:
|
||||
bool opers_analyze(); // 识别干员
|
||||
BattleRole oper_role_analyze(const Rect& roi);
|
||||
|
||||
@@ -95,6 +95,13 @@ bool asst::BattleProcessTask::analyze_opers_preview()
|
||||
|
||||
// 干员头像出来之后,还要过 2 秒左右才可以点击,这里要加个延时
|
||||
sleep(Task.get("BattleWaitingToLoad")->rear_delay);
|
||||
while (true) {
|
||||
oper_analyzer.set_image(m_ctrler->get_image());
|
||||
if (oper_analyzer.analyze()) {
|
||||
break;
|
||||
}
|
||||
std::this_thread::yield();
|
||||
}
|
||||
battle_pause();
|
||||
|
||||
auto opers = oper_analyzer.get_opers();
|
||||
|
||||
Reference in New Issue
Block a user