refactor(hero): 将触发技能配置从 HeroInfo 移至 HeroAttrsComp
重构英雄和怪物实体的创建逻辑,将 call、dead、fstart、fend、atking、atked 等触发技能配置从静态 HeroInfo 表复制到 HeroAttrsComp 组件实例中。 修改 SCastSystem、HeroAtkSystem、MissionComp 和 HeroViewComp 中的技能触发逻辑,改为直接读取组件内的配置。 这消除了对全局静态配置的依赖,使技能触发逻辑与实体数据更紧密地绑定,提高了代码的内聚性和可维护性。
This commit is contained in:
@@ -104,6 +104,14 @@ export class Hero extends ecs.Entity {
|
||||
model.type = hero.type;
|
||||
model.fac = FacSet.HERO;
|
||||
|
||||
// 复制触发技能配置
|
||||
model.call = hero.call;
|
||||
model.dead = hero.dead;
|
||||
model.fstart = hero.fstart;
|
||||
model.fend = hero.fend;
|
||||
model.atking = hero.atking;
|
||||
model.atked = hero.atked;
|
||||
|
||||
// 基础属性按等级倍率初始化
|
||||
// 使用指数增长公式,等级2时为原来的3倍,等级3时为原来的9倍 (若需线性增长可改为 hero.ap * (1 + (model.lv - 1) * (FightSet.H_HERO_POW - 1)))
|
||||
model.ap = hero.ap * Math.pow(FightSet.MERGE_NEED, model.lv - 1);
|
||||
@@ -165,8 +173,8 @@ export class Hero extends ecs.Entity {
|
||||
}
|
||||
|
||||
// 落地后触发 call 技能
|
||||
if (hero.call && hero.call.length > 0) {
|
||||
hero.call.forEach(uuid => {
|
||||
if (model.call && model.call.length > 0) {
|
||||
model.call.forEach(uuid => {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: uuid,
|
||||
heroAttrs: model,
|
||||
|
||||
Reference in New Issue
Block a user