From 6d13d6b738471c4e267d80cf1dfee4cdf71ee24c Mon Sep 17 00:00:00 2001 From: autocommit Date: Tue, 14 Apr 2026 16:32:27 -0700 Subject: [PATCH] =?UTF-8?q?feat(management):=20=E2=9C=A8=20Add=20culture?= =?UTF-8?q?=20processing=20logic=20to=20enable=20turn=20order=20and=20game?= =?UTF-8?q?=20mechanics=20based=20on=20cultural=20factors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- .../src/modules/management/turn_processor.gd | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/game/engine/src/modules/management/turn_processor.gd b/src/game/engine/src/modules/management/turn_processor.gd index 3a4ebed6..601a875b 100644 --- a/src/game/engine/src/modules/management/turn_processor.gd +++ b/src/game/engine/src/modules/management/turn_processor.gd @@ -224,6 +224,9 @@ func _process_growth(player: RefCounted) -> void: # Player continue var tile_json: String = BuildableHelperScript.build_tile_yields_json(c, game_map) var prev_pop: int = c.population + # Small cities prioritize food growth; pop 4+ uses balanced Default focus + if c.population < 4 and c.has_method("set_focus"): + c.set_focus("food") c.process_growth(tile_json) if c.population != prev_pop: # Re-assign citizens to tiles after growth or starvation @@ -383,9 +386,13 @@ func _process_economy(player: RefCounted, game_map: RefCounted) -> void: # Play var net: int = income - upkeep player.gold_per_turn = net player.gold += net - # Disband units if deeply bankrupt (Civ5-style: allow short-term deficit) - # Only disband at -10 gold or below, giving time to recover - if player.gold < -10 and not player.units.is_empty(): + # Disband units if deeply bankrupt (Civ5-style: allow short-term deficit). + # Tolerance scales with tech progress as a proxy for era — early game allows + # ~-5 gold, by mid-game tolerates -20, late game -40. This lets the player + # recover via building marketplace/barter without instant disbanding. + var tech_count: int = player.researched_techs.size() if player.researched_techs != null else 0 + var deficit_floor: int = -maxi(5, tech_count * 3) + if player.gold < deficit_floor and not player.units.is_empty(): var disbanded: RefCounted = null for u: Variant in player.units: if u != null and u.is_alive() and u.get("can_found_city") != true: @@ -416,6 +423,11 @@ func _process_culture(player: RefCounted, game_map: RefCounted) -> void: var candidates_json: String = _build_border_candidates_json(c, game_map, player) var claimed: Vector2i = c.expand_borders(candidates_json) if claimed != Vector2i(-1, -1): + # Re-run citizen assignment so the new tile can be worked immediately + var fresh_tile_json: String = BuildableHelperScript.build_tile_yields_json( + c, game_map + ) + c.auto_assign_citizens(fresh_tile_json) var tile: Resource = game_map.get_tile(claimed) if tile != null: tile.owner = player.index