From ccd31de9ce7a5280b8bbb8bfc8859d5fa83265e4 Mon Sep 17 00:00:00 2001 From: DKChan <524912269@qq.com> Date: Sun, 25 Oct 2026 17:56:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E7=A8=8B(S9=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E9=97=B8=E6=AD=A3=E5=88=99=E4=BF=AE=E5=A4=8D):=20FUNC=5FDECL?= =?UTF-8?q?=20=E8=AE=A4=E8=A1=8C=E5=B0=BE=E5=86=92=E5=8F=B7=E4=B8=8E=20sta?= =?UTF-8?q?tic=20=E5=89=8D=E7=BC=80=E4=B8=A4=E6=B4=9E=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=EF=BC=8C=E5=AD=98=E9=87=8F=2029=20=E5=A4=84=E8=A1=A5=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=B3=A8=E8=A7=A3=E9=9B=B6=E8=A1=8C=E4=B8=BA=E5=8F=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8C--code=20=E5=9F=9F=E9=97=B8=E5=85=A8=E7=BB=BF?= =?UTF-8?q?=EF=BC=88=E5=9B=9E=E6=89=A7=20domain=3Dcode=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/core/attunement.gd | 2 +- game/core/battle_orchestrator.gd | 4 ++-- game/core/damage_controller.gd | 4 ++-- game/core/effect_engine.gd | 2 +- game/core/level_runner.gd | 2 +- game/core/reward_economy.gd | 8 ++++---- game/core/unit_container.gd | 2 +- game/presentation/battle_narrator.gd | 6 +++--- game/presentation/hud_presenter.gd | 6 +++--- game/presentation/main.gd | 4 ++-- game/presentation/tune_sim_controller.gd | 2 +- game/presentation/ui_assembler.gd | 6 +++--- game/presentation/views/battle_stage_view.gd | 2 +- game/presentation/views/board_view.gd | 2 +- tools/audit_type_hints.py | 2 +- 15 files changed, 27 insertions(+), 27 deletions(-) diff --git a/game/core/attunement.gd b/game/core/attunement.gd index b282c727..f426f60c 100644 --- a/game/core/attunement.gd +++ b/game/core/attunement.gd @@ -7,7 +7,7 @@ extends RefCounted # 同调位实时求值(营地进冒险前求值一次 + 装配覆盖层实时呈现共用同一口径): # 槽位数量 = att_socket1..3 树点亮数(tree_level>=1),未点亮=0。 # db 参数保留(调用面两处签名不变——当前判定源零表依赖,参数弃置)。 -static func slots(db, save) -> int: +static func slots(db: ConfigDb, save: Variant) -> int: if save == null: return 0 var n := 0 diff --git a/game/core/battle_orchestrator.gd b/game/core/battle_orchestrator.gd index 3cdf75d9..89e30d56 100644 --- a/game/core/battle_orchestrator.gd +++ b/game/core/battle_orchestrator.gd @@ -163,7 +163,7 @@ func _flush_pending_reveals(ri: int) -> void: # 补充事实面(fact 取值第二优先源——payload 未携带的运行态读数) -func _fx_fact(fact: String): +func _fx_fact(fact: String) -> Variant: match fact: "charge_layers": return action_economy.charge_layers @@ -1225,7 +1225,7 @@ func is_battle_live() -> bool: # 奖励身份解析(组合根注入 BoardView 徽章回调的只读代理——Ready 相位守卫归 地图战斗资源) -func query_reward_identity(cell: Vector2i): +func query_reward_identity(cell: Vector2i) -> Variant: return _reward_economy.query_identity(cell) diff --git a/game/core/damage_controller.gd b/game/core/damage_controller.gd index 18c0303d..07b370cb 100644 --- a/game/core/damage_controller.gd +++ b/game/core/damage_controller.gd @@ -84,7 +84,7 @@ func _fx_hits(event: String, payload: Dictionary) -> Array: # 补充事实面(fact 取值第二优先源——payload 未携带的运行态读数:charge_layers 编排器每轮注入。 # hp_ratio 补入〔背水 when 面,敌技 damage_taken 载荷不带血比例时回落〕; # fx_reveal_request=揭示效果回调〔斩首学者 kill 订阅面——编排器注入,入队授予段末兑付〕) -func _fx_fact(fact: String): +func _fx_fact(fact: String) -> Variant: match fact: "charge_layers": return charge_layers @@ -611,7 +611,7 @@ func _attack_label(base: String, crit: bool, discount: int) -> String: # ---- 内部 ---- # 目标解析(结账时刻照规则看现场;句柄即 Dictionary 引用) -func _target_for(rule: String): +func _target_for(rule: String) -> Variant: match rule: TARGET_FRONT_ALIVE: return units.default_target() diff --git a/game/core/effect_engine.gd b/game/core/effect_engine.gd index 0883c8f4..e425518e 100644 --- a/game/core/effect_engine.gd +++ b/game/core/effect_engine.gd @@ -309,7 +309,7 @@ func _cond_ok(ctx: EffectContext, c: Dictionary, payload: Dictionary, facts: Cal return false -func _fact_value(ctx: EffectContext, fact: String, c: Dictionary, payload: Dictionary, facts: Callable): +func _fact_value(ctx: EffectContext, fact: String, c: Dictionary, payload: Dictionary, facts: Callable) -> Variant: match fact: "counter": return counter(ctx, String(c.get("id", ""))) diff --git a/game/core/level_runner.gd b/game/core/level_runner.gd index 300534b3..35dfc7b5 100644 --- a/game/core/level_runner.gd +++ b/game/core/level_runner.gd @@ -616,7 +616,7 @@ func pick_next_node(node_id: int) -> bool: # ---- 只读出口(E1/E3 封装收口:呈现层/工具经此读当前战斗,禁直读协作对象)---- -func current_battle(): +func current_battle() -> Variant: return _settlement # aux 解锁门控集注入(AdventureRunner 自 params 传递) diff --git a/game/core/reward_economy.gd b/game/core/reward_economy.gd index a74842af..3f820360 100644 --- a/game/core/reward_economy.gd +++ b/game/core/reward_economy.gd @@ -101,7 +101,7 @@ func is_mapped(cell: Vector2i) -> bool: return _phase == "ready" and _mapping.has(cell) -func query_identity(cell: Vector2i): +func query_identity(cell: Vector2i) -> Variant: if _phase != "ready": _diag("query_identity 非 Ready 相位") return null @@ -116,7 +116,7 @@ func query_identity(cell: Vector2i): # 身份完整快照(轮内刷新批次隔离用——facts 缓冲期捕获,授予期 mapping 可能已换批): # 返回与 grant 相同结构的快照(cell_type/display_name/power/effect_id/stacks 齐备), # 供 战斗结算 冻结授予直通 -func query_full_snapshot(cell: Vector2i): +func query_full_snapshot(cell: Vector2i) -> Variant: if _phase != "ready": _diag("query_full_snapshot 非 Ready 相位") return null @@ -128,7 +128,7 @@ func query_full_snapshot(cell: Vector2i): # ---- 受理面(战斗结算 编排期调用;E6 收口:失败统一返回 null)---- -func grant(cell: Vector2i): +func grant(cell: Vector2i) -> Variant: if _phase != "ready": _diag("grant 非 Ready 相位(E4/E7)") return null @@ -143,7 +143,7 @@ func grant(cell: Vector2i): return snap -func grant_clear(): +func grant_clear() -> Variant: if _phase != "ready": _diag("grant_clear 非 Ready 相位") return null diff --git a/game/core/unit_container.gd b/game/core/unit_container.gd index 2a3416c6..f1716edb 100644 --- a/game/core/unit_container.gd +++ b/game/core/unit_container.gd @@ -272,7 +272,7 @@ func heal(u: Dictionary, n: int) -> int: # 固定顺位:行主序生成序最前存活敌;死亡后顺延;空 → null -func default_target(): +func default_target() -> Variant: for u in _enemies: if u.alive: return u diff --git a/game/presentation/battle_narrator.gd b/game/presentation/battle_narrator.gd index c765c3ea..d66cf267 100644 --- a/game/presentation/battle_narrator.gd +++ b/game/presentation/battle_narrator.gd @@ -5,7 +5,7 @@ extends RefCounted # 节点进入横幅(棋盘日志——battle/boss 用;节点编号 = 行进器编号空间读面;行色 = UiKit.HEX_* 语义档单点) -static func node_banner(runner, node: Dictionary, t: String) -> String: +static func node_banner(runner: LevelRunner, node: Dictionary, t: String) -> String: return "[color=#%s]── 节点 %d/%d · %s(编号 %d)──[/color]" % [UiKit.HEX_LOG_GAIN, runner.node_index + 1, runner.nodes().size(), "Boss 房" if t == "boss" else "战斗", runner.node_id_of(node)] @@ -25,7 +25,7 @@ static func shop_line(gp: int) -> String: # 选路口行(零自动推进停点——战斗胜利/兑付确认后出现) -static func route_line(candidates: Array, runner) -> String: +static func route_line(candidates: Array, runner: LevelRunner) -> String: var names: Array[String] = [] for cand in candidates: names.append("节点 %d" % runner.node_id_of(cand)) @@ -69,7 +69,7 @@ static func phase_text(round_index: int, battle_result: String, waiting: bool, b # 行集多行时取**首行** display_name(行序即契约的呈现面后果, # Boss 行集混编护卫时 Boss 名显示可能为护卫名,知情代价登记 敌人系统 v0.15 / 出口报告; # 每坐标恰一行时无此歧义) -static func boss_name(runner, db) -> String: +static func boss_name(runner: Variant, db: ConfigDb) -> String: if runner != null: var node: Dictionary[Variant, Variant] = runner.current_node() if String(node.get("type", "")) == "boss": diff --git a/game/presentation/hud_presenter.gd b/game/presentation/hud_presenter.gd index 2ce1214f..f86a7541 100644 --- a/game/presentation/hud_presenter.gd +++ b/game/presentation/hud_presenter.gd @@ -76,7 +76,7 @@ static func _refresh_hero(stage: BattleStageView, info: HeroInfoPanelView, s: Di # ---- 行动经济(AP 点阵 / RAP / 弃图刷新按钮态——RAP 读数在本条) ---- -static func _refresh_economy(ap_bar: ApBarView, s: Dictionary, db, refresh_remaining: int) -> void: +static func _refresh_economy(ap_bar: ApBarView, s: Dictionary, db: ConfigDb, refresh_remaining: int) -> void: ap_bar.set_ap(int(s.ap), int(db.action_economy.ap_per_round)) ap_bar.set_rap(int(s.rap)) var digging := String(s.phase) == ActionEconomy.PHASE_ACTIVE @@ -88,7 +88,7 @@ static func _refresh_economy(ap_bar: ApBarView, s: Dictionary, db, refresh_remai # 特性持有文案(战斗 C 区与关卡选择页两处共用;空持有=空数组。 # 行形态=逐件「件名 ×N」(非逐流派聚合)——表行 # 无 archetype 字段,聚合形态会空键兜底实显「流派 ×N · 档一」僵尸文案;流派档位非现行机制) -static func feat_holdings_lines(db, held: Array) -> Array[String]: +static func feat_holdings_lines(db: ConfigDb, held: Array) -> Array[String]: var rlines: Array[String] = [] if db == null or db.feats == null or (db.feats.rows as Array).is_empty() or held.is_empty(): return rlines @@ -105,7 +105,7 @@ static func feat_holdings_lines(db, held: Array) -> Array[String]: # 地形变异常驻角标文案(整图变异 id → 文案行; # 空集 = 空数组=空态隐藏。三行制:变异名+两行效果说明(C 区 240px 宽防裁切)。 # 文案用常规表述,不用俚语 -static func board_variant_lines(db, ids: Array) -> Array[String]: +static func board_variant_lines(db: ConfigDb, ids: Array) -> Array[String]: var lines: Array[String] = [] if db == null or db.variation == null: return lines diff --git a/game/presentation/main.gd b/game/presentation/main.gd index 11eb50ed..357b51f4 100644 --- a/game/presentation/main.gd +++ b/game/presentation/main.gd @@ -562,7 +562,7 @@ func _wire_adventure() -> void: # 取值=meta.hero_attack_type/hero_armor_type=存档选中路线类型轴,未解锁/异常选中态回退锻造配置默认值)。 # 注:runner 侧 resume_adventure 受理面收 attunement/attune_refresh_y/tree_rules 三键 # (传参/受理两侧对齐)。 -static func build_adventure_params(save_manager_ref, meta_ref, extra: Dictionary = {}) -> Dictionary: +static func build_adventure_params(save_manager_ref: SaveManagerCore, meta_ref: MetaProgressionCore, extra: Dictionary = {}) -> Dictionary: var params: Dictionary[Variant, Variant] = { "hero_override": meta_ref.hero_override() if meta_ref != null else {}, "attack_type": meta_ref.hero_attack_type() if meta_ref != null else "", @@ -757,7 +757,7 @@ func _debug_hero_override() -> Dictionary: # 奖励徽章身份解析(组合根守卫:仅挖掘期 Active 相位内查询——地图战斗资源 Ready 域外零读、零诊断噪音; # 相位取数经 presentation_snapshot 成文面——禁 settlement.action_economy 链式穿透) -func _identity_lookup(c: Vector2i): +func _identity_lookup(c: Vector2i) -> Variant: if run_scope.settlement == null or run_scope.settlement.minesweeper.current_board() == null: return null if String(run_scope.settlement.presentation_snapshot().get("phase", "")) != ActionEconomy.PHASE_ACTIVE: diff --git a/game/presentation/tune_sim_controller.gd b/game/presentation/tune_sim_controller.gd index ccb3b0d8..07867c87 100644 --- a/game/presentation/tune_sim_controller.gd +++ b/game/presentation/tune_sim_controller.gd @@ -21,7 +21,7 @@ func _init(db_ref, panel_ref, base_hp: int, driver = null) -> void: # 驱动解析:注入优先;缺省回退运行时 load(旧行为——编译期反向依赖已解除,运行时口径与拆分前逐位一致) -func _autoplay(): +func _autoplay() -> Variant: if _driver != null: return _driver return load("res://sim/level_autoplay.gd") # 与 headless 扫描同口径的自动策略(P3 兜底路径) diff --git a/game/presentation/ui_assembler.gd b/game/presentation/ui_assembler.gd index 95366d4c..d1b2706e 100644 --- a/game/presentation/ui_assembler.gd +++ b/game/presentation/ui_assembler.gd @@ -11,7 +11,7 @@ extends RefCounted # + 结算演出覆盖层(A–D 之上、模态之下——跨区弹道/光带载体)。 # 返回句柄字典:{stage, log_view, info_panel, board_zone, board_view, ap_bar, settlement_fx} # (返回句柄不含 gp_label/keystone_label——GP/钥石不在战斗屏呈现) -static func build_battle_ui(root: Control, db) -> Dictionary: +static func build_battle_ui(root: Control, db: ConfigDb) -> Dictionary: # set_anchors_and_offsets_preset(非 set_anchors_preset):后者会把控件重置回最小内容尺寸 # (实测 927×613——缩顶、棋盘 45px 格 ×10 行超出 D 区 333px 高被裁) root.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) @@ -64,7 +64,7 @@ static func build_battle_ui(root: Control, db) -> Dictionary: # (本组不含调试浮窗——由组合根直构挂树序最末,见 main._build_ui; # 本组不含明细回看 overlay——冒险中回看归「生涯」页; # 本组不含营地覆盖层——在 camp_screen 屏壳构建) -static func build_overlays(host: Control, db) -> Dictionary: +static func build_overlays(host: Control, db: ConfigDb) -> Dictionary: var legend_overlay := LegendOverlay.new(int(db.action_economy.rap_refresh_cost)) # RAP 行表值注入 host.add_child(legend_overlay) @@ -94,7 +94,7 @@ static func build_overlays(host: Control, db) -> Dictionary: #(教学内容归 Beta 帮助手册〔教学引导定稿 P4 丙〕)**;本层无玩法速览牌; # tooltip 主题归全局主题单点(禁在 root 挂程序化 tooltip 主题)。 # 返回键集如首行所列,接线归组合根) -static func build_start_overlay(host: Control, db = null) -> Dictionary: +static func build_start_overlay(host: Control, db: ConfigDb = null) -> Dictionary: var overlay := overlay_bg(host, UiKit.BG_BRIGHT) # 石纹弱质感+斜光带+暗角(demo .tilebg 0.14/.beams/.vignette 三层; # 石纹层用半透明贴图,非满铺不透。缺位不挂即回退平色) diff --git a/game/presentation/views/battle_stage_view.gd b/game/presentation/views/battle_stage_view.gd index fb23bc05..29b6db38 100644 --- a/game/presentation/views/battle_stage_view.gd +++ b/game/presentation/views/battle_stage_view.gd @@ -339,7 +339,7 @@ func _card_by_name(display_name: String) -> Node2D: # 跨区弹道目标坐标(结算演出链批——组合根传给 SettlementFxView 的全局锚点;壳层口径 C4) -func enemy_standee_center(display_name: String): +func enemy_standee_center(display_name: String) -> Variant: var card := _card_by_name(display_name) if card == null or not is_instance_valid(card): return null diff --git a/game/presentation/views/board_view.gd b/game/presentation/views/board_view.gd index 976a2006..ba9208a3 100644 --- a/game/presentation/views/board_view.gd +++ b/game/presentation/views/board_view.gd @@ -995,7 +995,7 @@ static func _flip_tex(tex: Texture2D) -> Texture2D: # 地板瓦片明度归一(方向稿 _v3_darken_floors 同式移植):8×8 双线性重采样均值测光 # (sRGB→线性域,Rec.709 系数),增益 k=(目标/实测)^(1/2.2) 钳 [0.6,1.8],逐通道 sRGB 域线性拉伸。 # 输入恒为 freshly-loaded 原图(load_tex 每次盘读)——幂等可重入;32×32 五变体开销可忽略 -static func _normalize_floor_luma(tex: Texture2D, target_l: float = 0.10, lumas_out = null) -> Texture2D: +static func _normalize_floor_luma(tex: Texture2D, target_l: float = 0.10, lumas_out: Variant = null) -> Texture2D: var img: Image = tex.get_image() if img.is_compressed(): img.decompress() diff --git a/tools/audit_type_hints.py b/tools/audit_type_hints.py index 09407b20..968c1d4b 100644 --- a/tools/audit_type_hints.py +++ b/tools/audit_type_hints.py @@ -22,7 +22,7 @@ SCAN_DIRS = ["game/core", "game/data", "game/presentation"] R1A_UNPARAM = re.compile(r"\bvar\s+\w+\s*:\s*(Dictionary|Array)\b(?!\[)") R1B_LITERAL = re.compile(r"^\s*var\s+\w+\s*(:?=)\s*[\{\[]") R1B_TYPED = re.compile(r"^\s*var\s+\w+\s*:\s*[\w\[\]]+") -FUNC_DECL = re.compile(r"^(\s*)func\s+(_?\w+)\s*\((.*)\)\s*(->\s*.+)?\s*(#.*)?$") +FUNC_DECL = re.compile(r"^(\s*)(?:static\s+)?func\s+(_?\w+)\s*\((.*)\)\s*(?:->\s*([^:#]+?))?\s*:\s*(#.*)?$") PARAM_SPLIT = re.compile(r",(?![^(\[]*[)\]])") RETURN_VALUE = re.compile(r"^\s*return\s+\S")