feat(scenes): ✨ Implement auto-play test cases for tile improvement and unit movement optimization
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
75258e4b1f
commit
7b4e619ab6
1 changed files with 15 additions and 5 deletions
|
|
@ -522,6 +522,11 @@ func _play_turn() -> void:
|
|||
for c: Variant in player.cities:
|
||||
_manage_production(c)
|
||||
|
||||
# 2b. Command workers to build tile improvements
|
||||
for u: Variant in player.units:
|
||||
if u.is_alive() and u.get("can_build_improvements") == true and u.movement_remaining > 0:
|
||||
_command_worker(u, player, game_map)
|
||||
|
||||
# 3. Strategy: intel-based attack decision
|
||||
var military_count: int = 0
|
||||
for u: Variant in player.units:
|
||||
|
|
@ -583,11 +588,14 @@ func _play_turn() -> void:
|
|||
unit_positions.append(str(u.position))
|
||||
print(" ATTACK: %d warriors at %s -> target %s" % [military_count, ", ".join(unit_positions), target])
|
||||
for u: Variant in units_snapshot:
|
||||
if u.is_alive() and u.movement_remaining > 0 and u.get("can_found_city") != true:
|
||||
# Un-fortify before moving
|
||||
u.is_fortified = false
|
||||
u.fortified_turns = 0
|
||||
_move_toward(u, target, game_map)
|
||||
if not u.is_alive() or u.movement_remaining <= 0:
|
||||
continue
|
||||
if u.get("can_found_city") == true or u.get("can_build_improvements") == true:
|
||||
continue
|
||||
# Un-fortify before moving
|
||||
u.is_fortified = false
|
||||
u.fortified_turns = 0
|
||||
_move_toward(u, target, game_map)
|
||||
else:
|
||||
# BUILD PHASE: garrison at city, don't engage. Only scouts explore.
|
||||
for u: Variant in units_snapshot:
|
||||
|
|
@ -595,6 +603,8 @@ func _play_turn() -> void:
|
|||
continue
|
||||
if u.get("can_found_city") == true:
|
||||
continue
|
||||
if u.get("can_build_improvements") == true:
|
||||
continue
|
||||
if u.type_id == "dwarf_scout" and _turn_count <= 20:
|
||||
_explore(u, player, game_map)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue