refactor: 简化攻击距离与职业类型系统

- 移除 SkillRange 枚举和 SkillDisVal 常量,统一使用 HType 表示攻击距离
- 删除 heroInfo 中的 rangeType 字段,直接使用 type 字段
- 更新英雄配置,将职业类型简化为近战、中程、远程三类
- 移除怪物属性中的 mp 和 def 字段,简化属性计算
- 更新移动和技能距离计算逻辑,直接使用 HType 判断
This commit is contained in:
panw
2026-03-16 15:54:49 +08:00
parent 11e6f49479
commit 95edd6fd6d
6 changed files with 54 additions and 136 deletions

View File

@@ -1,7 +1,7 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { Attrs, BType } from "../common/config/HeroAttrs";
import { BuffConf, BuffRunType, SkillDisVal, SkillRange } from "../common/config/SkillSet";
import { HeroInfo, HType } from "../common/config/heroSet";
import { BuffConf, BuffRunType } from "../common/config/SkillSet";
import { HeroDisVal, HeroInfo, HType } from "../common/config/heroSet";
import { mLogger } from "../common/Logger";
import { smc } from "../common/SingletonModuleComp";
import { HeroViewComp } from "./HeroViewComp";
@@ -47,7 +47,6 @@ export class HeroAttrsComp extends ecs.Comp {
lv: number = 1;
type: number = 0; // 0近战 1远程 2辅助
fac: number = 0; // 0:hero 1:monster
rangeType:SkillRange = SkillRange.Melee;
// ==================== 基础属性(有初始值) ====================
ap: number = 0; // 基础攻击
hp: number = 100; // 基础血量
@@ -451,22 +450,13 @@ export class HeroAttrsComp extends ecs.Comp {
*/
public updateSkillDistanceCache(skill_id:number): void {
void skill_id;
let rangeType = this.rangeType;
if (rangeType === undefined || rangeType === null) {
if (this.type === HType.remote) {
rangeType = SkillRange.Long;
} else if (this.type === HType.mage || this.type === HType.support) {
rangeType = SkillRange.Mid;
} else {
rangeType = SkillRange.Melee;
}
}
const maxRange = SkillDisVal[rangeType];
const rangeType = this.type as HType.Melee | HType.Mid | HType.Long;
const maxRange = HeroDisVal[rangeType];
let minRange = 0;
if (rangeType === SkillRange.Mid) {
minRange = SkillDisVal[SkillRange.Melee];
} else if (rangeType === SkillRange.Long) {
minRange = SkillDisVal[SkillRange.Mid];
if (rangeType === HType.Mid) {
minRange = HeroDisVal[HType.Melee];
} else if (rangeType === HType.Long) {
minRange = HeroDisVal[HType.Mid];
}
this.maxSkillDistance = maxRange;
this.minSkillDistance = minRange;
@@ -495,7 +485,6 @@ export class HeroAttrsComp extends ecs.Comp {
this.lv = 1;
this.type = 0;
this.fac = 0;
this.rangeType = SkillRange.Melee;
this.ap = 0;
this.hp = 100;
this.hp_max = 100;