From 9f71108719729a9f1ef603eeb87d1222a3781df7 Mon Sep 17 00:00:00 2001 From: Joywayer Date: Fri, 31 Jul 2026 12:55:08 +0800 Subject: [PATCH] =?UTF-8?q?docs(attr):=20=E5=AE=88=E5=8D=AB=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E6=94=B9=E5=BC=95=E5=87=BD=E6=95=B0=E5=90=8D=E8=80=8C?= =?UTF-8?q?=E9=9D=9E=E4=BC=9A=E8=85=90=E7=83=82=E7=9A=84=E8=A1=8C=E5=8F=B7?= =?UTF-8?q?=EF=BC=9B=E8=B0=83=E8=AF=95=E5=9C=BA=E6=99=AF=E8=A1=A5=E6=B3=A8?= =?UTF-8?q?=E5=85=A5=E9=A1=BA=E5=BA=8F=E7=90=86=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task 3 复审转来的两条 Minor。player_manager 守卫注释里的 「player_stats.gd:173/191」是行号引用,改动一次就失效,改为 _load_attr_definitions / add_modifier 两个函数名。 combat_test 的注入原先只有不变式没有理由,补上 remove→add→equip_wand 三者的先后依据(累积防护 + 守卫读的是注入结果)。 Co-Authored-By: Claude Opus 5 --- scenes/main/combat_test.gd | 2 ++ scripts/domain/player_manager.gd | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scenes/main/combat_test.gd b/scenes/main/combat_test.gd index ff68326..50e0e65 100644 --- a/scenes/main/combat_test.gd +++ b/scenes/main/combat_test.gd @@ -15,6 +15,8 @@ func _ready() -> void: # 装备法杯:wand_basic + spark_bolt var loadout: Dictionary = WandPreset.make_default_loadout() # 本场景绕过 CombatManager,故须自行注入法杖运算力份额(否则 cpu_limit=0 → MAX_OPS 退化) + # 顺序理由见 combat_manager._rebuild_wand:remove 必须先于 add(否则重复进入会累积), + # 而两者又必须都先于 equip_wand(equip_wand 里的 cpu_limit<=0 守卫读的就是注入结果) PlayerStats.remove_modifiers_from("core") PlayerStats.add_modifier("cpu_limit", "flat", float(loadout["core"].cpu_limit), "core") PlayerManager.equip_wand(loadout["core"], loadout["compiled"]) diff --git a/scripts/domain/player_manager.gd b/scripts/domain/player_manager.gd index 1fefc11..37c5259 100644 --- a/scripts/domain/player_manager.gd +++ b/scripts/domain/player_manager.gd @@ -93,7 +93,8 @@ func equip_wand(core: CoreDefinition, compiled: CompiledDeck) -> void: PlayerStats.mana_heat = 0.0 # 0 守卫:cpu_limit=0 → MAX_OPS 退化,法术近乎全静默。放在换杖处而非施法处——施法端 2 次/秒 # 会刷屏埋掉根因,且此处拿得到杖名。兜的是「新调用点忘了注入」与「cores.json 某杖配成 0」, - # 二者上游无任何报错(缺 attributes.json / attr_id 打错已分别由 player_stats.gd:173/191 报出) + # 二者上游无任何报错(缺 attributes.json / attr_id 打错已分别由 PlayerStats._load_attr_definitions + # 与 PlayerStats.add_modifier 报出) if PlayerStats.cpu_limit <= 0: push_error("PlayerManager: 装备「%s」后 cpu_limit=0,法术执行预算将退化为 40 步;检查该杖 cores.json 的 cpu_limit 与 source=\"core\" 加成注入" % (core.display_name if core else "—"))