feat(hero): 新增英雄等级进化配置与属性技能变更逻辑

实现了英雄从2级开始的等级进化系统,支持替换普攻技能、覆盖各类触发技能、添加额外属性加成,同时在英雄配置中添加了进化配置的类型定义与示例配置
This commit is contained in:
walkpan
2026-05-28 22:27:38 +08:00
parent 9ddf5b99c5
commit 62a92ab9b6
2 changed files with 66 additions and 0 deletions

View File

@@ -159,6 +159,37 @@ export class Hero extends ecs.Entity {
// 最终技能等级 = 初始技能等级 + 英雄等级增量,且下限为 0
model.skills[skill.uuid] = { ...skill, lv: Math.max(0,skill.lv + hero_lv - 2), ccd: 0 };
}
// 应用等级进化配置(从 lv2 开始逐级覆盖)
if (hero.evolve) {
for (let elv = 2; elv <= hero_lv; elv++) {
const evo = hero.evolve[elv];
if (!evo) continue;
// 替换普攻技能
if (evo.skill) {
const oldSkill = Object.values(model.skills)[0];
model.skills = {};
model.skills[evo.skill.s_uuid] = {
uuid: evo.skill.s_uuid,
lv: Math.max(0, 1 + hero_lv - 2),
cd: evo.skill.cd ?? oldSkill?.cd ?? 1,
ccd: 0,
overrides: evo.skill.overrides,
};
}
// 覆盖触发技能
if (evo.atking) model.atking = evo.atking;
if (evo.atked) model.atked = evo.atked;
if (evo.dead) model.dead = evo.dead;
if (evo.fstart) model.fstart = evo.fstart;
if (evo.fend) model.fend = evo.fend;
if (evo.revive) model.revive = evo.revive;
// 额外属性加成
if (evo.ap_bonus) model.ap += evo.ap_bonus;
if (evo.hp_bonus) { model.hp += evo.hp_bonus; model.hp_max += evo.hp_bonus; }
}
}
// 缓存技能射程等派生数据,减少战斗帧内重复计算
model.updateSkillDistanceCache();