diff --git a/assets/script/game/common/SingletonModuleComp.ts b/assets/script/game/common/SingletonModuleComp.ts index 4880e6fb..ab8ce538 100644 --- a/assets/script/game/common/SingletonModuleComp.ts +++ b/assets/script/game/common/SingletonModuleComp.ts @@ -142,6 +142,17 @@ export class SingletonModuleComp extends ecs.Comp { + // 全局属性加成 {attrIndex: [value, count]} + global_attrs: Record = { + [Attrs.AP]: [1, 100], // 攻击力 + [Attrs.HP_MAX]: [1, 10000], // 生命上限 + [Attrs.DEF]: [1, 0], // 防御 + [Attrs.SPEED]: [1, 0], // 速度 + [Attrs.CRITICAL]: [1, 0], // 暴击率 + [Attrs.STUN_CHANCE]: [1, 0], // 眩晕率 + [Attrs.WFUNY]: [1, 0], // 风怒率 + }; + /** * 记录天赋获取 * @param id 天赋ID diff --git a/assets/script/game/hero/HeroAttrsComp.ts b/assets/script/game/hero/HeroAttrsComp.ts index 0c19de3f..f7549f7c 100644 --- a/assets/script/game/hero/HeroAttrsComp.ts +++ b/assets/script/game/hero/HeroAttrsComp.ts @@ -369,6 +369,12 @@ export class HeroAttrsComp extends ecs.Comp { totalRatio += buff.value; } } + + // 全局属性加成 + if (smc.global_attrs[attrIndex]) { + const [val, count] = smc.global_attrs[attrIndex]; + totalRatio += val * count; + } // 4. 根据属性类型计算最终值 const attrType = AttrsType[attrIndex];