refactor(ai): ♻️ Remove capital wall construction priority logic from simple heuristic AI to simplify early-game production decisions
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
4fc3170bc5
commit
c57720ad70
1 changed files with 14 additions and 14 deletions
|
|
@ -512,20 +512,6 @@ 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
|
||||
|
|
@ -533,6 +519,20 @@ static func _decide_production(
|
|||
# T100. After T80 the standard Priority 4 target takes over.
|
||||
var early_mil_floor: int = 4 if GameState.turn_number <= 80 else 0
|
||||
if military_count < maxi(1, early_mil_floor):
|
||||
# Capital walls interject: non-threatened 1-city capital with ≥1
|
||||
# defender and age >20 takes walls instead of stacking a 4th warrior.
|
||||
# Without this, walls are never built before T80 because the mil
|
||||
# floor keeps firing. `not threatened` gates it so we don't slot
|
||||
# walls while an enemy is actually closing.
|
||||
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 >= 1 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")
|
||||
var emergency_unit: String = _pick_buildable_military_unit_id(
|
||||
city, player
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue