fix(ai): 🐛 update capital walls priority logic

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-04-16 13:30:45 -07:00
parent f7b4de6dc2
commit 6e530cb139
2 changed files with 15 additions and 1 deletions

View file

@ -553,6 +553,20 @@ static func _decide_production(
if not rush_unit.is_empty():
return _prod_unit(city_index, rush_unit)
# Capital walls interject: non-threatened 1-city capital, >20 turns old,
# with at least 2 defenders gets walls slotted in before early_mil_floor
# and founders. Walls were previously starved by mil-floor then founder
# priorities, deferring walls indefinitely even when gold was plentiful.
var capital_age: int = GameState.turn_number - int(city.turn_founded)
var capital_needs_walls: bool = (
not threatened and city_count == 1 and city_index == 0
and military_count >= 2 and capital_age > 20
and not city.has_building("walls")
and city.can_build("walls", player)
)
if capital_needs_walls:
return _prod_building(city_index, "walls")
# Priority 0: Early military floor — maintain 4 warriors during the
# first 80 turns before committing to walls/happiness/founder. Early
# combat attrition (p0 harasses) was dropping mil to 1-2 by T75; this

View file

@ -1,4 +1,4 @@
use std::collections::{BTreeMap, HashMap, HashSet};
use std::collections::{BTreeMap, BTreeSet, HashMap};
use mc_core::algorithms::hex;
use mc_core::grid::GridState;