mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 09:50:40 +08:00
revert: 回调部署干员朝向滑动距离为400,回调滑动duration为100,增加补偿距离上限 (#7277)
This commit is contained in:
@@ -8182,9 +8182,10 @@
|
||||
"BattleSwipeOper": {
|
||||
"algorithm": "JustReturn",
|
||||
"preDelay": 400,
|
||||
"postDelay": 170,
|
||||
"postDelay": 100,
|
||||
"Doc": "pre 是将干员滑动到场上的 duration 系数;post 是设置干员朝向滑动的 duration",
|
||||
"specialParams": [
|
||||
400,
|
||||
200,
|
||||
2,
|
||||
0,
|
||||
@@ -8192,6 +8193,7 @@
|
||||
],
|
||||
"specialParamsDoc": [
|
||||
"设置朝向时的滑动距离",
|
||||
"补偿距离上限",
|
||||
"滑动初速度(平均速度是固定的,初速度快末速度慢相当于一直减速)",
|
||||
"滑动末速度",
|
||||
"将干员滑动到场上的 最小滑动 duration"
|
||||
@@ -16005,4 +16007,4 @@
|
||||
"Stop"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,14 +295,14 @@ bool asst::BattleHelper::deploy_oper(const std::string& name, const Point& loc,
|
||||
// 1000 是随便取的一个系数,把整数的 pre_delay 转成小数用的
|
||||
int duration = static_cast<int>(dist / 1000.0 * swipe_oper_task_ptr->pre_delay);
|
||||
// 时间太短了的压根放不上去,故意加长一点
|
||||
if (int min_duration = swipe_oper_task_ptr->special_params.at(3); duration < min_duration) {
|
||||
if (int min_duration = swipe_oper_task_ptr->special_params.at(4); duration < min_duration) {
|
||||
duration = min_duration;
|
||||
}
|
||||
bool deploy_with_pause =
|
||||
ControlFeat::support(m_inst_helper.ctrler()->support_features(), ControlFeat::SWIPE_WITH_PAUSE);
|
||||
Point oper_point(oper_rect.x + oper_rect.width / 2, oper_rect.y + oper_rect.height / 2);
|
||||
m_inst_helper.ctrler()->swipe(oper_point, target_point, duration, false, swipe_oper_task_ptr->special_params.at(1),
|
||||
swipe_oper_task_ptr->special_params.at(2), deploy_with_pause);
|
||||
m_inst_helper.ctrler()->swipe(oper_point, target_point, duration, false, swipe_oper_task_ptr->special_params.at(2),
|
||||
swipe_oper_task_ptr->special_params.at(3), deploy_with_pause);
|
||||
|
||||
// 拖动干员朝向
|
||||
if (direction != DeployDirection::None) {
|
||||
@@ -323,7 +323,8 @@ bool asst::BattleHelper::deploy_oper(const std::string& name, const Point& loc,
|
||||
|
||||
// 经粗略测算,方向区域倾斜大概是 1/5
|
||||
const static auto radian = -std::atan(0.2);
|
||||
fix_swipe_out_of_limit(target_point, end_point, scale_size.first, scale_size.second, radian);
|
||||
fix_swipe_out_of_limit(target_point, end_point, scale_size.first, scale_size.second,
|
||||
swipe_oper_task_ptr->special_params.at(1), radian);
|
||||
|
||||
m_inst_helper.sleep(use_oper_task_ptr->post_delay);
|
||||
m_inst_helper.ctrler()->swipe(target_point, end_point, swipe_oper_task_ptr->post_delay);
|
||||
@@ -649,7 +650,8 @@ bool asst::BattleHelper::cancel_oper_selection()
|
||||
return ProcessTask(this_task(), { "BattleCancelSelection" }).run();
|
||||
}
|
||||
|
||||
void asst::BattleHelper::fix_swipe_out_of_limit(Point& p1, Point& p2, int width, int height, double radian)
|
||||
void asst::BattleHelper::fix_swipe_out_of_limit(Point& p1, Point& p2, int width, int height, int max_distance,
|
||||
double radian)
|
||||
{
|
||||
Point direct = Point::zero();
|
||||
int distance = 0;
|
||||
@@ -690,6 +692,10 @@ void asst::BattleHelper::fix_swipe_out_of_limit(Point& p1, Point& p2, int width,
|
||||
static_cast<int>(std::get<1>(adjust_scale) / adjust_more * distance),
|
||||
};
|
||||
|
||||
if (auto point_distance = Point::distance(adjust, { 0, 0 }); point_distance > max_distance) {
|
||||
adjust = adjust * static_cast<int>(max_distance / point_distance);
|
||||
}
|
||||
|
||||
Log.info(__FUNCTION__, "swipe end_point out of limit, start:", p1, ", end:", p2, ", adjust:", adjust);
|
||||
p1 += adjust;
|
||||
p2 += adjust;
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace asst
|
||||
bool click_skill(bool keep_waiting = true); // 这个是带识别的,转好了才点
|
||||
bool cancel_oper_selection();
|
||||
// 修正终点超出范围的滑动,纠正时是否需要顺时针旋转
|
||||
void fix_swipe_out_of_limit(Point& p1, Point& p2, int width, int height, double radian = 0);
|
||||
void fix_swipe_out_of_limit(Point& p1, Point& p2, int width, int height, int max_distance = INT_MAX, double radian = 0);
|
||||
bool move_camera(const std::pair<double, double>& delta);
|
||||
|
||||
std::string analyze_detail_page_oper_name(const cv::Mat& image);
|
||||
|
||||
Reference in New Issue
Block a user