docs(attr): 守卫注释改引函数名而非会腐烂的行号;调试场景补注入顺序理由
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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"])
|
||||
|
||||
@@ -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 "—"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user