diff --git a/assets/script/Design3.md b/assets/script/Design3.md index 5655f5b2..a4fe436c 100644 --- a/assets/script/Design3.md +++ b/assets/script/Design3.md @@ -20,8 +20,16 @@ 3) 天赋 count 配置生效 + 天赋 key 统一 -- 问题:talConf.count 在 TalComp.addTal 中未使用,且计数型天赋写入/读取 key 与 Attrs/TalEffet 混用。 -- 结果:大量天赋表现不符合描述,玩家感知不到构筑差异。 +- 问题: + - **Count 容易失效**:如果 `TalComp.addTal` 中把 `count` 写死为 `1`,配置表 `talConf.count` 就会被忽略。例如“下 5 次暴击”的天赋会退化为“下 1 次暴击”。 + - 校验点:`this.Tals[uuid].count` 必须来自 `tConf.count`,而不是常量。 + - **Key 混用导致逻辑断裂**: + - 写入方:`TalComp` 使用 `TalEffet` 枚举值写入(如 `TalEffet.DMG_RED = 10`)。 + - 读取方:`HeroAtkSystem` 使用 `Attrs` 枚举值读取(如 `Attrs.DMG_RED = 24`)。 + - 结果:天赋效果写入了错误的 Key(如 Key 10 对应 `Attrs.AP`),导致真正的伤害减免逻辑(读 Key 24)读不到数据,天赋完全失效。 +- 建议: + - 废弃 `TalEffet` 中的 Key 定义,统一使用 `Attrs` 枚举作为 Key。 + - 在 `TalComp.addTal` 中读取 `tConf.count` 写入 `talent.count`,并保证所有“次数型天赋”的消耗端也使用同一套 Key。 ## 二、把 SkillSet 变成“少字段但强表达”的可配置系统 diff --git a/assets/script/game/hero/TalComp.ts b/assets/script/game/hero/TalComp.ts index 425e5175..9c1faf26 100644 --- a/assets/script/game/hero/TalComp.ts +++ b/assets/script/game/hero/TalComp.ts @@ -68,7 +68,7 @@ export class TalComp extends ecs.Comp { * 2. 检查天赋配置是否存在 * 3. 创建并初始化天赋数据 */ - addTal(uuid: number) { + addTal(uuid: number,v_add:number = 0,c_add:number = 0,t_add:number = 0) { // 检查天赋是否已存在 if (this.Tals[uuid]) { console.error(`[TalComp]天赋已存在,天赋ID:${uuid}`); @@ -92,11 +92,11 @@ export class TalComp extends ecs.Comp { attrs: tConf.attrs, vType: tConf.vType, value: tConf.value, // 效果数值初始为配置值 - value_add: 0, // 效果数值增量初始为0 - count: 1, // 执行次数,及可以触发的次数 - count_add:0, // 执行次数增量初始为0 + value_add: v_add, // 效果数值增量初始为0 + count: tConf.count, // 执行次数,及可以触发的次数 + count_add: c_add, // 执行次数增量初始为0 Trigger: tConf.Trigger, // 触发阈值(后续可从配置中读取) - Trigger_add: 0, // 触发阈值增量初始为0 + Trigger_add: t_add, // 触发阈值增量初始为0 desc: tConf.desc, cur: 0, // 当前累积值初始为0 };