refactor(hero): 将触发技能配置从 HeroInfo 移至 HeroAttrsComp
重构英雄和怪物实体的创建逻辑,将 call、dead、fstart、fend、atking、atked 等触发技能配置从静态 HeroInfo 表复制到 HeroAttrsComp 组件实例中。 修改 SCastSystem、HeroAtkSystem、MissionComp 和 HeroViewComp 中的技能触发逻辑,改为直接读取组件内的配置。 这消除了对全局静态配置的依赖,使技能触发逻辑与实体数据更紧密地绑定,提高了代码的内聚性和可维护性。
This commit is contained in:
@@ -439,15 +439,15 @@ export class MissionComp extends CCComp {
|
||||
const attrs = entity.get(HeroAttrsComp);
|
||||
const view = entity.get(HeroViewComp);
|
||||
if (!attrs || !view || attrs.is_dead || attrs.fac !== FacSet.HERO) return;
|
||||
const info = HeroInfo[attrs.hero_uuid];
|
||||
if (!info) return;
|
||||
const skillUuid = isStart ? info.fstart : info.fend;
|
||||
if (skillUuid) {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: skillUuid,
|
||||
heroAttrs: attrs,
|
||||
heroView: view,
|
||||
triggerType: isStart ? 'fstart' : 'fend'
|
||||
const skillUuids = isStart ? attrs.fstart : attrs.fend;
|
||||
if (skillUuids && skillUuids.length > 0) {
|
||||
skillUuids.forEach(uuid => {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: uuid,
|
||||
heroAttrs: attrs,
|
||||
heroView: view,
|
||||
triggerType: isStart ? 'fstart' : 'fend'
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user