Files
gplan-2/game/core/run_ledger.gd
T
DKChan b605022001 feat(迭代27 T5): 波五a 类型闸拉起+存量收口——审计器 0 存量+warning 配置在位
P1-6 类型闸(须 T1-T4 全落后——本波按执行顺序锁殿后):
- tools/audit_type_hints.py 新机器闸(V7): R1 无类型容器注解/R2 有值返回缺返回类型/
  R3 参数缺类型三规则+行级 # type-hint: ignore 显式白名单通道;产品码 core/data/presentation
- 存量收口: 368 处显式 Array/Dictionary 非参数化注解→机械参数化(Array[Variant]/
  Dictionary[Variant, Variant] 零行为面);13 处参数真类型(SaveManagerCore/ConfigDb/
  BattleOrchestrator/MinesweeperRules/LevelRunner/SettingsStore 等)
- 白名单豁免四处: board_generator generate/_attempt/legality/_finalize 的 db 参——
  测量面 _BoardRowStub 冒烟夹具鸭子型注入(typed 参拒 stub)
- project.godot 拉起 gdscript/warnings/untyped_declaration=1(V7 源码断言在 smoke _smoke_type_gate)
- static_scan 新 S9 类型闸规则;顺修历史 cd 错位(9-24 布局迁移后 /.. 落 game/ 致守卫
  恒跳过静默空转——修复后 S1-S4/S9 首次实跑全绿)+S1/S2 增 ADR-0007-exempt 标记豁免通道
  (main _seed_value 引擎熵源=文档化豁免面)

验收: 冒烟 1081/0(+V7×2)+run_all 27 套+static_scan 全绿+probe click+render golden+对拍三变体全同
2026-10-15 01:05:17 +08:00

52 lines
2.6 KiB
GDScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
class_name RunLedger
extends RefCounted
# 共享四本账显式承载(迭代 27 T3——审计 P1-4「共享可变字典跨三层:所有权名义单点、实际三处
# 可写」收口;裁点②甲 = 单类持四账)。
# 所有权:AdventureRunner 持有(开局构造、冒险全程唯一宿主);LevelRunner 经 set_run_ledger
# 下传并装配 encounter;战斗侧(BattleOrchestrator)经 encounter["ledger"] 拿本类引用,
# 只走下方 read/append 原语——战末 export/开局 seed 时点语义不变(确定性设计原样保留,
# 只把「函数签名上不可见的共享可变引用」换成签名可见的显式类)。
var attune_charges: Dictionary[Variant, Variant] = {} # 同调主动件充能账(迭代 11 第①批 T6——use_treasure 扣减;断点随局回档)
var vision_counter: Dictionary[Variant, Variant] = {} # 真视类使用计数(迭代 22 秘宝批 T3——冒险开始置 {"used":0};
# 缺省空 = 调试/单场战斗不计——原 enc 缺键守卫语义)
var adventure_counters: Dictionary[Variant, Variant] = {} # adventure 域效果计数器(迭代 20 T6——rebuild 回灌/战末导出回写目标)
var bonus: Dictionary[Variant, Variant] = {} # 统一冒险加算区(冒险开始置四轴零账——商店购买/三选一属性件/战末 bonus_delta 汇入)
# ---- 战斗侧原语(裁点②甲:战斗侧只拿 read/append 两族;宿主侧冒险/关卡域直读字段域) ----
func attune_charge_has(item_id: String) -> bool:
return attune_charges.has(item_id)
func attune_charge_set(item_id: String, value: int) -> void:
attune_charges[item_id] = value
func attune_charge_consume(item_id: String) -> void:
# 原编排器 use_treasure 扣减语义逐字(has 闸 + maxi(0,·) 下限)
if attune_charges.has(item_id):
attune_charges[item_id] = maxi(0, int(attune_charges[item_id]) - 1)
func vision_count_add(n: int) -> void:
vision_counter["used"] = int(vision_counter.get("used", 0)) + n
func counters_seed_snapshot() -> Dictionary:
return adventure_counters # 回灌读面(时点 = begin_battle rebuild 后——语义不变)
func counters_merge_export(exported: Dictionary) -> void:
# 战末回写(原编排器逐字语义:仅非空账参与、逐键覆写)
if adventure_counters.is_empty():
return
for cid in exported.keys():
adventure_counters[cid] = int(exported[cid])
func bonus_add_axis(axis: String, delta: int) -> void:
# 原编排器战末汇入逐字语义(has 闸——账外轴丢弃)
if bonus.has(axis):
bonus[axis] = int(bonus.get(axis, 0)) + delta