fix(战斗): 修复英雄移动和施法逻辑

- 移动系统现在会在需要保持距离时也执行移动,避免过于靠近敌人
- 施法系统重构目标选择逻辑,确保在射程内寻找最近敌人
- 添加近战施法距离常量,根据英雄类型动态计算最大施法范围
- 移除不必要的攻击状态检查,优化施法条件判断
This commit is contained in:
panw
2026-03-17 17:00:01 +08:00
parent f713a82a2d
commit 20aa067c9c
2 changed files with 56 additions and 6 deletions

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;
if (dist >= minRange && needMoveToFormation) {
const shouldKeepDistance = dist < minRange;
if (needMoveToFormation || shouldKeepDistance) {
const dir = targetX > currentX ? 1 : -1;
move.direction = dir;
const speed = model.speed / 3;