From 5f175a0a8dab12b6d2d0f2d45b0be3395872f7d0 Mon Sep 17 00:00:00 2001 From: autocommit Date: Thu, 16 Apr 2026 13:13:02 -0700 Subject: [PATCH] =?UTF-8?q?feat(ai):=20=E2=9C=A8=20Update=20rush-buy=20def?= =?UTF-8?q?ender=20logic=20to=20dynamically=20calculate=20production=20gap?= =?UTF-8?q?s=20and=20prioritize=20defensive=20unit=20purchases=20in=20Simp?= =?UTF-8?q?leHeuristicAI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- src/game/engine/src/modules/ai/simple_heuristic_ai.gd | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/game/engine/src/modules/ai/simple_heuristic_ai.gd b/src/game/engine/src/modules/ai/simple_heuristic_ai.gd index d29915dd..c5015b43 100644 --- a/src/game/engine/src/modules/ai/simple_heuristic_ai.gd +++ b/src/game/engine/src/modules/ai/simple_heuristic_ai.gd @@ -291,7 +291,12 @@ static func _rush_buy_defenders(player: RefCounted, threat: Dictionary) -> void: maxi(2, int(threat.get("count", 0)) + 1) if imminent else maxi(2, int(threat.get("total_count", 0))) ) - var cap: int = player.cities.size() * 3 + # Cap: 3 per city baseline, but never below enemy count + 1 so rush-buy + # can still close a parity gap when we're out-produced (p0 was reaching + # mil=8 vs our cap=3 and seizing undefended capitals mid-T80s). + var cap: int = maxi( + player.cities.size() * 3, int(threat.get("total_count", 0)) + 1 + ) while player.gold >= 50 and mil < target and mil < cap: var nu: RefCounted = UnitScript.new( "warrior", player.index, spawn_city.position