# VERTICAL SLICE - NOT FOR PRODUCTION # 战斗驱动循环单点——smoke 族探针共用的「挖掘至停手」整轮驱动。 # 策略 = AutoPlayer.choose_dig(O4 单一实现):挖最近可挖格(异格先移位)/ 无可挖或相位离 Active 停手。 # 语义锚(monte_carlo 原型逐位保持):guard 400 步防挂死;移位后相位/轮次离场即 break; # 轮末仍 Active 且未换轮 → settle_batch stop。smoke_all._run_battle/_auto_play_round 为冒烟本体 # 不经本面(含回归断言,禁并入);fx_shot_probe 为带墙钟抓帧的异步变体亦不在列。 extends RefCounted const AutoPlayer := preload("res://sim/auto_player.gd") const GUARD_ACTIONS := 400 # 单轮动作步防挂死上限(被收口探针原值逐一同值) # 驱动一整轮挖掘。still_running = 调用方战斗活性谓词(缺省恒真): # monte_carlo / skill_rhythm 传 `func(): return out.result == ""`(battle_finished 已发的轮内不再动手), # damage_probe 关卡驱动传 runner 绑定 + battle_result 谓词,battle 级探针传空即可。 static func drive_round(settlement, still_running: Callable = Callable()) -> void: var start_round: int = settlement.round_index var minesweeper = settlement.minesweeper var guard := GUARD_ACTIONS while _alive(still_running) and settlement.action_economy.phase == "Active" \ and settlement.round_index == start_round and guard > 0: guard -= 1 var plan := AutoPlayer.choose_dig(minesweeper) if plan.is_empty(): break if plan.hero_cell != minesweeper.hero_pos(): minesweeper.settle_batch([{"action": "move", "cell": plan.hero_cell}]) if settlement.action_economy.phase != "Active" or settlement.round_index != start_round: break minesweeper.settle_batch([{"action": "dig", "cell": plan.dig_cell}]) if _alive(still_running) and settlement.action_economy.phase == "Active" and settlement.round_index == start_round: minesweeper.settle_batch([{"action": "stop"}]) static func _alive(still_running: Callable) -> bool: return still_running.is_null() or bool(still_running.call())