fix: 修正英雄移动逻辑中距离判断条件

将原条件 `dist < minRange` 改为 `dist >= minRange`,并与阵型移动需求结合。原逻辑在距离过近时也会触发移动,导致英雄可能无法保持在有效攻击范围内。新逻辑确保仅在距离足够且需要调整阵型位置时才移动。
This commit is contained in:
panw
2026-03-17 14:57:07 +08:00
parent 8dc3bccbd8
commit 8667656e48

View File

@@ -198,8 +198,8 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
const [minRange, maxRange] = this.resolveCombatRange(model, defaultMin, defaultMax);
const dist = Math.abs(currentX - enemyX);
const needMoveToFormation = Math.abs(currentX - targetX) > 5;
const shouldKeepDistance = dist < minRange;
if (needMoveToFormation || shouldKeepDistance) {
if (dist >= minRange && needMoveToFormation) {
const dir = targetX > currentX ? 1 : -1;
move.direction = dir;
const speed = model.speed / 3;