refactor(hero&monster): 统一使用dis字段获取攻击距离

移除HeroDisVal映射表,改为直接从实体组件读取配置的dis属性作为攻击距离,同时补全所有英雄和怪物配置中的dis字段
This commit is contained in:
walkpan
2026-05-18 09:29:22 +08:00
parent 39316cf266
commit 3e84566f94
7 changed files with 43 additions and 45 deletions

View File

@@ -180,8 +180,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
private isEnemyInAttackRange(model: HeroAttrsComp, selfX: number, enemyX: number): boolean {
const dist = Math.abs(selfX - enemyX);
const rangeType = model.type as HType.Melee | HType.Mid | HType.Long;
const attackRange = HeroDisVal[rangeType];
const attackRange = model.dis;
return dist <= attackRange;
}