test(scenes): Add/modify test cases for auto-play behavior, including scene transitions and edge cases

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
autocommit 2026-04-13 06:16:52 -07:00
parent ae980a68ce
commit 6fbf710139

View file

@ -375,21 +375,51 @@ func _manage_production(city: Variant) -> void:
for u: Variant in player.units:
if u.get("can_found_city") == true:
has_settler = true
# Build walls first (defense)
if not city.has_building("walls"):
city.add_to_queue("building", "walls")
# Then happiness building
elif player.happiness < -4 and not city.has_building("brewery") and player.has_tech("brewing"):
city.add_to_queue("building", "brewery")
# Then expand
elif city_count < 3 and not has_settler:
city.add_to_queue("unit", "settler")
# Then forge
elif not city.has_building("forge"):
city.add_to_queue("building", "forge")
# Then warriors
# Smart build order: interleave buildings with military
var built: String = _next_building(city, player, city_count, has_settler)
if not built.is_empty():
if built == "settler":
city.add_to_queue("unit", "settler")
else:
city.add_to_queue("building", built)
else:
city.add_to_queue("unit", "warrior")
func _next_building(city: Variant, player: Variant, city_count: int, has_settler: bool) -> String:
## Return the next building/unit to produce, or "" for warrior.
# Walls first (defense)
if not city.has_building("walls"):
return "walls"
# One warrior before expanding
var military: int = 0
for u: Variant in player.units:
if u.is_alive() and u.get("can_found_city") != true:
military += 1
if military == 0:
return "" # build warrior
# Expand to 3 cities
if city_count < 3 and not has_settler:
return "settler"
# Economic buildings (cycle through all available)
var econ_buildings: Array[Array] = [
["forge", ""], # no tech needed
["brewery", "brewing"],
["library", "scholarship"],
["marketplace", "trade_routes"],
["barracks", "military_doctrine"],
["monument", "ancestor_rites"],
["castle", "fortification"],
]
for entry: Array in econ_buildings:
var bid: String = entry[0]
var tech: String = entry[1]
if city.has_building(bid):
continue
if not tech.is_empty() and not player.has_tech(tech):
continue
return bid
return "" # all buildings built, produce warriors
if _turn_count <= 5 or _turn_count % 20 == 0:
var q_size: int = city.production_queue.size()
var progress: int = city.production_progress