mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 17:57:01 +08:00
fix: 修复单步任务不执行的问题,添加一些日志
This commit is contained in:
@@ -11,6 +11,8 @@ asst::SingleStepTask::SingleStepTask(const AsstCallback& callback, Assistant* in
|
||||
|
||||
bool asst::SingleStepTask::set_params(const json::value& params)
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
std::string type = params.get("type", "");
|
||||
std::string subtype = params.get("subtype", "");
|
||||
auto details_opt = params.find("details");
|
||||
@@ -28,6 +30,8 @@ bool asst::SingleStepTask::set_params(const json::value& params)
|
||||
|
||||
bool asst::SingleStepTask::append_copllot_start()
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
auto start_2_tp = std::make_shared<ProcessTask>(m_callback, m_inst, TaskType);
|
||||
start_2_tp->set_tasks({ "BattleStartAll" }).set_ignore_error(false);
|
||||
m_subtasks.emplace_back(std::move(start_2_tp));
|
||||
@@ -37,6 +41,8 @@ bool asst::SingleStepTask::append_copllot_start()
|
||||
|
||||
bool asst::SingleStepTask::append_copilot_action(const json::value& details)
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
auto task = std::make_shared<SingleStepBattleProcessTask>(m_callback, m_inst, TaskType);
|
||||
|
||||
// for debug
|
||||
|
||||
@@ -244,7 +244,10 @@ bool asst::BattleProcessTask::wait_condition(const Action& action)
|
||||
{
|
||||
cv::Mat image;
|
||||
auto update_image_if_empty = [&]() {
|
||||
if (image.empty()) image = ctrler()->get_image();
|
||||
if (image.empty()) {
|
||||
image = ctrler()->get_image();
|
||||
check_in_battle(image);
|
||||
}
|
||||
};
|
||||
auto do_strategy_and_update_image = [&]() {
|
||||
do_strategic_action(image);
|
||||
|
||||
@@ -19,7 +19,7 @@ bool asst::SingleStepBattleProcessTask::_run()
|
||||
}
|
||||
|
||||
size_t action_size = m_actions.size();
|
||||
for (size_t i = 0; i < action_size && !need_exit() && m_in_battle; ++i) {
|
||||
for (size_t i = 0; i < action_size && !need_exit(); ++i) {
|
||||
const auto& action = m_actions.at(i);
|
||||
do_action(action, i);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user