feat(victory): Introduce grace period delay for victory checks in VictoryManager

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Claude Code 2026-04-10 20:31:44 -07:00
parent eb22568828
commit d36d5fc4d5

View file

@ -12,6 +12,13 @@ extends RefCounted
const PlayerScript: GDScript = preload("res://engine/src/entities/player.gd")
const UnitScript: GDScript = preload("res://engine/src/entities/unit.gd")
## Minimum turn before any victory check fires. Without this, the very first
## skirmish on turn 1 or 2 — when one side founds before the other or one
## founder dies to a scout rush — would declare premature victory. The grace
## period gives both players time to stand up an empire before the game can
## be decided.
const VICTORY_GRACE_TURNS: int = 10
var _game_over: bool = false
@ -20,6 +27,8 @@ var _game_over: bool = false
func check_all(_game_map: RefCounted) -> void:
if _game_over:
return
if GameState.turn_number < VICTORY_GRACE_TURNS:
return
var winner_index: int = _check_domination()
if winner_index >= 0: