mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 02:10:21 +08:00
fix: 简化和调整干员部署操作
This commit is contained in:
@@ -479,10 +479,8 @@ bool asst::BattleProcessTask::oper_deploy(const BattleAction& action)
|
||||
Point placed_point = m_side_tile_info[action.location].pos;
|
||||
|
||||
Rect placed_rect{ placed_point.x ,placed_point.y, 0, 0 };
|
||||
int dist = static_cast<int>(
|
||||
std::sqrt(
|
||||
(std::pow(std::abs(placed_point.x - oper_rect.x), 2))
|
||||
+ (std::pow(std::abs(placed_point.y - oper_rect.y), 2))));
|
||||
int dist = static_cast<int>(Point::distance(
|
||||
placed_point, {oper_rect.x + oper_rect.width / 2, oper_rect.y + oper_rect.height / 2}));
|
||||
// 1000 是随便取的一个系数,把整数的 pre_delay 转成小数用的
|
||||
int duration = static_cast<int>(swipe_oper_task_ptr->pre_delay / 1000.0 * dist * log10(dist));
|
||||
m_ctrler->swipe(oper_rect, placed_rect, duration, true, 0);
|
||||
@@ -503,15 +501,8 @@ bool asst::BattleProcessTask::oper_deploy(const BattleAction& action)
|
||||
Point direction = DirectionMapping.at(action.direction);
|
||||
|
||||
// 将方向转换为实际的 swipe end 坐标点
|
||||
Point end_point = placed_point;
|
||||
constexpr int coeff = 500;
|
||||
end_point.x += direction.x * coeff;
|
||||
end_point.y += direction.y * coeff;
|
||||
|
||||
end_point.x = std::max(0, end_point.x);
|
||||
end_point.x = std::min(end_point.x, WindowWidthDefault);
|
||||
end_point.y = std::max(0, end_point.y);
|
||||
end_point.y = std::min(end_point.y, WindowHeightDefault);
|
||||
Point end_point = placed_point + (direction * coeff);
|
||||
|
||||
m_ctrler->swipe(placed_point, end_point, swipe_oper_task_ptr->rear_delay, true, 100);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user