From ce724828a7585ce2eab10772c265f2f188f437b8 Mon Sep 17 00:00:00 2001 From: panw Date: Mon, 2 Feb 2026 15:33:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=8B=B1=E9=9B=84=E5=B1=9E=E6=80=A7):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=A8=E5=B1=80=E5=B1=9E=E6=80=A7=E5=8A=A0?= =?UTF-8?q?=E6=88=90=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在英雄属性计算中集成全局属性加成,通过 SingletonModuleComp 中的 global_attrs 配置为特定属性提供基础值和数量加成。 --- assets/script/game/common/SingletonModuleComp.ts | 11 +++++++++++ assets/script/game/hero/HeroAttrsComp.ts | 6 ++++++ 2 files changed, 17 insertions(+) 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];