feat(test): add victory fallback check in auto-play test

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-04-25 04:09:14 -07:00
parent ad7845d793
commit 0c8128e5c0

View file

@ -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"