refactor(hero): 将触发技能配置从 HeroInfo 移至 HeroAttrsComp

重构英雄和怪物实体的创建逻辑,将 call、dead、fstart、fend、atking、atked 等触发技能配置从静态 HeroInfo 表复制到 HeroAttrsComp 组件实例中。
修改 SCastSystem、HeroAtkSystem、MissionComp 和 HeroViewComp 中的技能触发逻辑,改为直接读取组件内的配置。
这消除了对全局静态配置的依赖,使技能触发逻辑与实体数据更紧密地绑定,提高了代码的内聚性和可维护性。
This commit is contained in:
walkpan
2026-04-15 22:27:38 +08:00
parent ba3e416ab0
commit e3c6aad172
7 changed files with 53 additions and 28 deletions

View File

@@ -1,6 +1,4 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { Attrs } from "../common/config/HeroAttrs";
import { BuffConf } from "../common/config/SkillSet";
import { HeroDisVal, HSkillInfo, HType } from "../common/config/heroSet";
import { mLogger } from "../common/Logger";
import { Timer } from "db://oops-framework/core/common/timer/Timer";
@@ -27,6 +25,15 @@ export class HeroAttrsComp extends ecs.Comp {
// ==================== 攻击属性 (补充) ====================
skills: Record<number, HSkillInfo> = {};
// ==================== 触发类技能 ====================
call?: number[];
dead?: number[];
fstart?: number[];
fend?: number[];
atking?: {s_uuid: number, t_num: number}[];
atked?: {s_uuid: number, t_num: number}[];
// ==================== 特殊属性 ====================
critical: number = 0; // 暴击率
freeze_chance: number = 0; // 冰冻概率
@@ -180,7 +187,6 @@ export class HeroAttrsComp extends ecs.Comp {
// ==================== 技能距离缓存管理 ====================
/**
* 更新技能距离缓存
@@ -232,6 +238,12 @@ export class HeroAttrsComp extends ecs.Comp {
// 重置新增属性
this.skills = {};
this.call = undefined;
this.dead = undefined;
this.fstart = undefined;
this.fend = undefined;
this.atking = undefined;
this.atked = undefined;
this.critical = 0;
this.freeze_chance = 0;
this.revive_count = 0;