diff --git a/src/game/engine/scenes/tests/auto_play.gd b/src/game/engine/scenes/tests/auto_play.gd index ddd58b15..41909a2f 100644 --- a/src/game/engine/scenes/tests/auto_play.gd +++ b/src/game/engine/scenes/tests/auto_play.gd @@ -610,6 +610,18 @@ func _process(_delta: float) -> void: "done": if _frame == 5: + # Score-victory fallback: at the auto_play turn cap, if + # vm.check_all hasn't already declared a winner (race — + # auto_play's "done" state can fire before TurnManager's + # next_player loop calls vm.check_all on the final turn), + # invoke it now so the highest-scoring player is recorded + # as the winner. Without this, all-AI games at turn_limit + # write outcome="max_turns" with winner_index=-1, which + # fails the ultimate_stress decisive-game gate. + if not _victory: + var vm: RefCounted = TurnManager.get("_victory_manager") as RefCounted + if vm != null and vm.has_method("check_all"): + vm.check_all(GameState.get_game_map()) _screenshot("final_turn_%03d" % _turn_count) print("AutoPlay: finished — %d turns, victory=%s" % [_turn_count, _victory]) _outcome = "victory" if _victory else "max_turns"