From 68e3edbc7d8873b3620b801bb0d07d15a9e45b71 Mon Sep 17 00:00:00 2001 From: Joywayer Date: Mon, 3 Aug 2026 11:17:35 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E8=AE=A2=E6=AD=A3=20pct=20=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E5=85=AC=E5=BC=8F=E2=80=94=E2=80=94=E5=BF=85=E9=A1=BB?= =?UTF-8?q?=E6=8C=89=20combine=20=E5=88=86=E6=94=AF=EF=BC=8Cinverse=20?= =?UTF-8?q?=E7=94=A8=201=E2=88=92(1=E2=88=92step)^n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit spec §2.4 与计划 Task2 写的 merged = (1+step)^n − 1 只对 hybrid 成立 (AttributeFormula 对 hybrid 用 f=1+v)。inverse 用的是 f=1−v,于是 cast_delay_mod 实际算成 f = 2−1.1^n 而非意图中的 0.9^n: n=2 应 0.81 实得 0.79;n=7 应 0.478 实得 0.0513 后果是该属性在第 7 次购买就撞 soft 封顶(设计意图约 22 次), 可购买次数砍到 1/3、边际收益曲线整体错误,且零诊断。 评审真机连续购买 7 次坐实。此为 spec 源头错误,非实现偏差。 Co-Authored-By: Claude Opus 5 --- docs_dev/plans/2026-07-31-shelf-c-attribute-shop.md | 12 ++++++++++-- .../2026-07-31-shelf-c-attribute-shop-design.md | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docs_dev/plans/2026-07-31-shelf-c-attribute-shop.md b/docs_dev/plans/2026-07-31-shelf-c-attribute-shop.md index 371721b..caddae7 100644 --- a/docs_dev/plans/2026-07-31-shelf-c-attribute-shop.md +++ b/docs_dev/plans/2026-07-31-shelf-c-attribute-shop.md @@ -371,8 +371,16 @@ func _apply_attr_purchases() -> void: continue var mode: String = String(sp.get("mode", "flat")) var step: float = float(sp.get("step", 0.0)) - # pct 合并:n 次 +step 在连乘下等价于单条 (1+step)^n − 1 - var merged: float = (pow(1.0 + step, float(n)) - 1.0) if mode == "pct" else (step * float(n)) + # pct 合并必须按属性的 combine 分支——AttributeFormula 对 hybrid 用 f=1+v、对 inverse 用 f=1-v, + # 故两者的等价单条值不同。写错会让 inverse 属性(cast_delay_mod)的曲线整体偏离且零诊断。 + var combine: String = String(_attr_def.get(id, {}).get("combine", "hybrid")) + var merged: float = 0.0 + if mode == "pct": + # hybrid: 需 f=(1+step)^n → merged=(1+step)^n−1 + # inverse: 需 f=(1−step)^n → merged=1−(1−step)^n + merged = (1.0 - pow(1.0 - step, float(n))) if combine == "inverse" else (pow(1.0 + step, float(n)) - 1.0) + else: + merged = step * float(n) # flat 线性可加,与 combine 无关 PlayerStats.add_modifier(id, mode, merged, MOD_SOURCE_SHOP_C) ## 存档:只存次数,加成是派生物(回读时经 _apply_attr_purchases 重建) diff --git a/docs_dev/specs/2026-07-31-shelf-c-attribute-shop-design.md b/docs_dev/specs/2026-07-31-shelf-c-attribute-shop-design.md index 05a4d11..94a850f 100644 --- a/docs_dev/specs/2026-07-31-shelf-c-attribute-shop-design.md +++ b/docs_dev/specs/2026-07-31-shelf-c-attribute-shop-design.md @@ -180,7 +180,8 @@ for id in _attr_purchases: var n: int = _attr_purchases[id] if n <= 0: continue var sp: Dictionary = - var merged: float = (pow(1.0 + step, n) - 1.0) if mode == "pct" else (step * n) + # pct 合并须按 combine 分支:AttributeFormula 对 hybrid 用 f=1+v、对 inverse 用 f=1−v + var merged: float = (1.0 - pow(1.0 - step, n)) if (mode == "pct" and combine == "inverse") else ((pow(1.0 + step, n) - 1.0) if mode == "pct" else (step * n)) PlayerStats.add_modifier(id, mode, merged, MOD_SOURCE_SHOP_C) ```