mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 01:40:46 +08:00
feat: 增加暂停放技能和暂停撤退 (#9348)
This commit is contained in:
@@ -9169,6 +9169,35 @@
|
||||
],
|
||||
"postDelay": 200
|
||||
},
|
||||
"BattlePauseCancel": {
|
||||
"algorithm": "JustReturn",
|
||||
"action": "ClickRect",
|
||||
"specificRect": [
|
||||
1170,
|
||||
20,
|
||||
60,
|
||||
60
|
||||
],
|
||||
"postDelay": 50,
|
||||
"next": [
|
||||
"BattlePauseCancelCheck",
|
||||
"BattlePauseCancel"
|
||||
]
|
||||
},
|
||||
"BattlePauseCancelCheck": {
|
||||
"template": "BattleOfficiallyBegin.png",
|
||||
"roi": [
|
||||
1165,
|
||||
20,
|
||||
65,
|
||||
65
|
||||
],
|
||||
"maskRange": [
|
||||
100,
|
||||
255
|
||||
],
|
||||
"action": "DoNothing"
|
||||
},
|
||||
"BattleCancelSelection": {
|
||||
"algorithm": "JustReturn",
|
||||
"action": "ClickRect",
|
||||
|
||||
@@ -390,7 +390,7 @@ bool asst::BattleHelper::deploy_oper(
|
||||
|
||||
if (deploy_with_pause) {
|
||||
// m_inst_helper.ctrler()->press_esc();
|
||||
ProcessTask(this_task(), { "BattlePause" }).run();
|
||||
ProcessTask(this_task(), { "BattlePauseCancel" }).run();
|
||||
}
|
||||
|
||||
// for SSS, multiple operator may be deployed at the same location.
|
||||
@@ -556,8 +556,7 @@ bool asst::BattleHelper::do_strategic_action(const cv::Mat& reusable)
|
||||
bool asst::BattleHelper::use_all_ready_skill(const cv::Mat& reusable)
|
||||
{
|
||||
// TODO: 可配置延迟时间
|
||||
static constexpr auto min_frame_interval =
|
||||
std::chrono::milliseconds(1000);
|
||||
static constexpr auto min_frame_interval = std::chrono::milliseconds(1000);
|
||||
|
||||
bool used = false;
|
||||
cv::Mat image = reusable.empty() ? m_inst_helper.ctrler()->get_image() : reusable;
|
||||
@@ -572,7 +571,10 @@ bool asst::BattleHelper::use_all_ready_skill(const cv::Mat& reusable)
|
||||
|
||||
const auto now = std::chrono::steady_clock::now();
|
||||
if (auto interval = now - last_use_time; min_frame_interval > interval) {
|
||||
Log.debug(name, "use skill too fast, interval time:", std::chrono::duration_cast<std::chrono::milliseconds>(interval));
|
||||
Log.debug(
|
||||
name,
|
||||
"use skill too fast, interval time:",
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(interval));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -727,16 +729,33 @@ bool asst::BattleHelper::click_oper_on_battlefield(const Point& loc)
|
||||
bool asst::BattleHelper::click_retreat()
|
||||
{
|
||||
LogTraceFunction;
|
||||
bool deploy_with_pause = ControlFeat::support(
|
||||
m_inst_helper.ctrler()->support_features(),
|
||||
ControlFeat::SWIPE_WITH_PAUSE);
|
||||
|
||||
if (deploy_with_pause) {
|
||||
ProcessTask(this_task(), { "BattlePause" }).run();
|
||||
}
|
||||
// return ProcessTask(this_task(), { "BattleOperRetreatJustClick" }).run();
|
||||
return m_inst_helper.ctrler()->click(m_retreat_button_pos);
|
||||
bool ret = m_inst_helper.ctrler()->click(m_retreat_button_pos);
|
||||
|
||||
if (deploy_with_pause) {
|
||||
ProcessTask(this_task(), { "BattlePauseCancel" }).run();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// TODO: use m_skill_button_pos
|
||||
bool asst::BattleHelper::click_skill(bool keep_waiting)
|
||||
{
|
||||
LogTraceFunction;
|
||||
bool deploy_with_pause = ControlFeat::support(
|
||||
m_inst_helper.ctrler()->support_features(),
|
||||
ControlFeat::SWIPE_WITH_PAUSE);
|
||||
|
||||
if (!keep_waiting && deploy_with_pause) {
|
||||
ProcessTask(this_task(), { "BattlePause" }).run();
|
||||
}
|
||||
ProcessTask skill_task(
|
||||
this_task(),
|
||||
{ "BattleSkillReadyOnClick",
|
||||
@@ -753,6 +772,9 @@ bool asst::BattleHelper::click_skill(bool keep_waiting)
|
||||
if (!ret) {
|
||||
cancel_oper_selection();
|
||||
}
|
||||
if (deploy_with_pause) {
|
||||
ProcessTask(this_task(), { "BattlePauseCancel" }).run();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user