fix(战斗): 修复英雄移动和施法逻辑
- 移动系统现在会在需要保持距离时也执行移动,避免过于靠近敌人 - 施法系统重构目标选择逻辑,确保在射程内寻找最近敌人 - 添加近战施法距离常量,根据英雄类型动态计算最大施法范围 - 移除不必要的攻击状态检查,优化施法条件判断
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user