feat: 简单支持了下保全开局跳过换人

This commit is contained in:
MistEO
2023-01-08 22:07:04 +08:00
parent ab6c167597
commit 7353abd4e2
5 changed files with 26 additions and 5 deletions

View File

@@ -9529,6 +9529,15 @@
144
]
},
"SSSFightDirectly": {
"action": "ClickSelf",
"roi": [
1052,
360,
154,
144
]
},
"SSSDrawCard": {
"action": "ClickSelf",
"roi": [

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -49,7 +49,7 @@ namespace asst
bool use_skill(const std::string& name, bool keep_waiting = true);
bool use_skill(const Point& loc, bool keep_waiting = true);
bool check_pause_button();
bool wait_until_start();
virtual bool wait_until_start();
bool wait_until_end();
bool use_all_ready_skill(const cv::Mat& reusable = cv::Mat());
bool check_and_use_skill(const std::string& name, const cv::Mat& reusable = cv::Mat());

View File

@@ -39,7 +39,7 @@ bool asst::SSSBattleProcessTask::do_derived_action(size_t action_index)
switch (action.type) {
case battle::copilot::ActionType::DrawCard:
return draw_card();
return draw_card(true);
case battle::copilot::ActionType::CheckIfStartOver:
return check_if_start_over(action);
default:
@@ -112,6 +112,13 @@ bool asst::SSSBattleProcessTask::do_strategic_action(const cv::Mat& reusable)
return true;
}
bool asst::SSSBattleProcessTask::wait_until_start()
{
LogTraceFunction;
return ProcessTask(*this, { "SSSFightDirectly" }).set_retry_times(300).run();
}
bool asst::SSSBattleProcessTask::check_if_start_over(const battle::copilot::Action& action)
{
LogTraceFunction;
@@ -143,7 +150,11 @@ bool asst::SSSBattleProcessTask::check_if_start_over(const battle::copilot::Acti
return true;
}
bool asst::SSSBattleProcessTask::draw_card()
bool asst::SSSBattleProcessTask::draw_card(bool with_retry)
{
return ProcessTask(*this, { "SSSDrawCard" }).run();
ProcessTask task(*this, { "SSSDrawCard" });
if (!with_retry) {
task.set_retry_times(0);
}
return task.run();
}

View File

@@ -17,9 +17,10 @@ namespace asst
virtual battle::copilot::CombatData& get_combat_data() { return m_sss_combat_data; }
virtual const std::string oper_name_ocr_task_name() const noexcept { return "SSSBattleOperName"; }
virtual bool need_to_wait_until_end() const { return true; }
virtual bool wait_until_start() override;
bool check_if_start_over(const battle::copilot::Action& action);
bool draw_card();
bool draw_card(bool with_retry = true);
battle::sss::CombatData m_sss_combat_data;
std::unordered_set<std::string> m_all_cores;