refactor(skill): 重构技能数据结构并支持技能等级

- 将 HeroAttrsComp 中的技能数组和独立 CD 映射重构为统一的 HSkillInfo 对象记录
- 在 SDataCom 中新增 skill_lv 字段,并在 Skill 加载时传入技能等级
- 更新 Hero 和 Monster 初始化逻辑以适配新的技能数据结构
- 修改 SCastSystem 以传递技能等级并影响技能效果
- 更新 heroSet 配置,将 skills 字段类型改为 Record<number, HSkillInfo>
This commit is contained in:
walkpan
2026-03-22 16:25:46 +08:00
parent be4884d28a
commit 0f56591376
7 changed files with 92 additions and 93 deletions

View File

@@ -11,6 +11,7 @@ export class SDataCom extends ecs.Comp {
group:BoxSet=BoxSet.HERO
fac: number = 0; // 0:hero 1:monster
s_uuid:number=0
skill_lv:number=1
ext_dmg:number=0 //额外伤害
dmg_ratio:number=1 //伤害比例
hit_count:number=0 //击中数量
@@ -20,6 +21,7 @@ export class SDataCom extends ecs.Comp {
this.group=BoxSet.HERO
this.fac=0
this.s_uuid=0
this.skill_lv=1
this.casterEid = -1;
this.hit_count=0
this.max_hit_count=0

View File

@@ -101,7 +101,7 @@ export class Skill extends ecs.Entity {
this.addComponents<SMoveDataComp>(SMoveDataComp);
}
load(startPos: Vec3, parent: Node, s_uuid: number, targetPos: Vec3,
caster:HeroViewComp,cAttrsComp:HeroAttrsComp, ext_dmg:number=0) {
caster:HeroViewComp,cAttrsComp:HeroAttrsComp, skill_lv:number=1, ext_dmg:number=0) {
const config = SkillSet[s_uuid];
if (!config) {
mLogger.error(this.debugMode, 'Skill', "[Skill] 技能配置不存在:", s_uuid);
@@ -212,6 +212,7 @@ export class Skill extends ecs.Entity {
sDataCom.Attrs[Attrs.freeze_chance] = cAttrsComp.freeze_chance + addFrz;
sDataCom.Attrs[Attrs.back_chance] = cAttrsComp.back_chance + addBck;
sDataCom.s_uuid=s_uuid
sDataCom.skill_lv = Math.max(1, skill_lv);
sDataCom.fac=cAttrsComp.fac
sDataCom.ext_dmg=ext_dmg
sDataCom.hit_count = 0
@@ -241,4 +242,3 @@ export class Skill extends ecs.Entity {
}
}