feat(victory): ✨ Introduce grace period delay for victory checks in VictoryManager
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
eb22568828
commit
d36d5fc4d5
1 changed files with 9 additions and 0 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue