mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-19 02:23:01 +08:00
perf: 优化剧情跳过检测频率,修改暂停时返回值为true
This commit is contained in:
@@ -91,9 +91,6 @@ bool asst::CopilotTask::set_params(const json::value& params)
|
||||
Log.error("Not support stage");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool with_formation = params.get("formation", false);
|
||||
m_formation_task_ptr->set_enable(with_formation);
|
||||
|
||||
// 自动补信赖
|
||||
m_formation_task_ptr->set_add_trust(params.get("add_trust", false));
|
||||
@@ -135,8 +132,9 @@ bool asst::CopilotTask::set_params(const json::value& params)
|
||||
m_navigate_task_ptr->set_tasks({ m_navigate_name + "@Copilot@StageNavigationBegin" });
|
||||
m_navigate_task_ptr->set_enable(need_navigate);
|
||||
|
||||
bool with_formation = params.get("formation", false);
|
||||
// 关卡名含有"TR"的为教学关,不需要编队
|
||||
m_formation_task_ptr->set_enable(m_navigate_name.find("TR") == std::string::npos);
|
||||
m_formation_task_ptr->set_enable(with_formation && m_navigate_name.find("TR") == std::string::npos);
|
||||
|
||||
std::string support_unit_name = params.get("support_unit_name", std::string());
|
||||
m_formation_task_ptr->set_support_unit_name(std::move(support_unit_name));
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "Utils/Algorithm.hpp"
|
||||
#include "Utils/ImageIo.hpp"
|
||||
#include "Utils/Logger.hpp"
|
||||
#include "Vision/Battle/BattlefieldMatcher.h"
|
||||
#include "Vision/Matcher.h"
|
||||
#include "Vision/RegionOCRer.h"
|
||||
|
||||
@@ -384,10 +385,19 @@ bool asst::BattleProcessTask::check_in_battle(const cv::Mat& reusable, bool weak
|
||||
LogTraceFunction;
|
||||
|
||||
cv::Mat image = reusable;
|
||||
if (check_skip_plot_button(image)) {
|
||||
speed_up();
|
||||
return false;
|
||||
}
|
||||
|
||||
return BattleHelper::check_in_battle(image, weak);
|
||||
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)) {
|
||||
speed_up();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_in_battle = check_pause_button(image);
|
||||
}
|
||||
return m_in_battle;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace asst
|
||||
bool enter_bullet_time(const std::string& name, const Point& location);
|
||||
void sleep_and_do_strategy(unsigned millisecond);
|
||||
|
||||
virtual bool check_in_battle(const cv::Mat& reusable = cv::Mat(), bool weak = true);
|
||||
virtual bool check_in_battle(const cv::Mat& reusable = cv::Mat(), bool weak = true) override;
|
||||
|
||||
battle::copilot::CombatData m_combat_data;
|
||||
std::unordered_map</*group*/ std::string, /*oper*/ std::string> m_oper_in_group;
|
||||
|
||||
Reference in New Issue
Block a user