test(scenes): Add test cases for auto-play behavior in auto_play.gd

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
autocommit 2026-04-26 03:25:48 -07:00
parent c6c8f6f9fc
commit 1e52e6cb3a

View file

@ -1580,6 +1580,41 @@ func _next_building(city: Variant, player: Variant, city_count: int, has_founder
_score_add(scores, "forge_titan", 12.0)
_score_add(scores, "mithril_vanguard", 18.0)
# World wonders: scored alongside units/buildings so they actually compete
# (warcouncil p0-01 wonder gate). Earlier override-after-pick approaches
# rarely fired because the picker preferred tier units. Now wonders enter
# the scoring loop directly with personality-weighted score.
# Score = (era * 1.5 + 4) * personality_axis
# personality_axis ∈ [0.4, 1.6]: tall (deepforge/ironhold high-prod) +
# wealthy (goldvein high-wealth) clans value wonders; aggressive
# (blackhammer high-agg) clans don't.
# Gated on city.buildings >= 3 so very early game still prioritizes the
# fundamental forge / monument / walls chain.
if Array(city.buildings).size() >= 3:
var clan_id_w: String = str(player.get("clan_id") if player.get("clan_id") != null else "")
var w_axis: float = 1.0
if not clan_id_w.is_empty():
var pers_w: Dictionary = DataLoader.get_ai_personality(clan_id_w)
if not pers_w.is_empty():
var axes_w: Dictionary = pers_w.get("strategic_axes", {})
var prod_w: float = _norm_axis(axes_w, "production")
var wlth_w: float = _norm_axis(axes_w, "wealth")
var agg_w: float = _norm_axis(axes_w, "aggression")
w_axis = clampf(0.4 + (prod_w + wlth_w) * 0.6 - agg_w * 0.3, 0.4, 1.6)
var existing_blds: Array = Array(city.buildings)
for wb: Dictionary in DataLoader.get_all_buildings():
var wid: String = str(wb.get("id", ""))
if wid.is_empty() or wid in existing_blds:
continue
if wb.get("wonder_type") == null:
continue
if not city.can_build(wid, player):
continue
var era_w: int = int(wb.get("era", 1))
# Score band: era 1 wonder ~ 5.5, era 5 wonder ~ 11.5, era 10 wonder ~ 19
# (× 0.4-1.6 personality) — competitive with cavalry (5) → ironwarden (8) → forge_titan (12) → mithril_vanguard (18).
scores[wid] = (4.0 + era_w * 1.5) * w_axis
# Log top-3 each time production is selected — emergent strategy visibility
if not scores.is_empty():
var ranked: Array = scores.keys()