feat(entities): ✨ Introduce AutoPlay class for automated player behavior in entities and its unit tests
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
e898a751dd
commit
ba37c4460b
1 changed files with 0 additions and 14 deletions
|
|
@ -43,11 +43,6 @@ var _attack_commitment_turns: int = 0
|
|||
# Recomputed each turn during _play_turn, read by _next_building + rush-buy.
|
||||
var _active_attack_mil_count: int = 0
|
||||
var _in_attack_phase: bool = false
|
||||
# Stack-of-doom cap: tracks how many times a city has been attacked this turn
|
||||
# (keyed by city position string). Reset at the start of each player's turn.
|
||||
# Limits pile-ons so a 10-warrior stack can't one-shot a city in a single turn.
|
||||
var _city_attacks_this_turn: Dictionary = {}
|
||||
const MAX_CITY_ATTACKS_PER_TURN: int = 3
|
||||
|
||||
# Test harness state (AUTO_PLAY_SEED path)
|
||||
var _seed: int = 0
|
||||
|
|
@ -948,9 +943,6 @@ func _play_turn() -> void:
|
|||
if player.researching.is_empty():
|
||||
_pick_research(player)
|
||||
|
||||
# Reset per-turn city attack counter (stack-of-doom cap).
|
||||
_city_attacks_this_turn.clear()
|
||||
|
||||
# Refresh attack-phase signals and stack-sustain telemetry for this turn.
|
||||
# _attack_commitment_turns reflects prior-turn commitment; rush-buy and
|
||||
# building scoring both key off it so they respond mid-siege.
|
||||
|
|
@ -2041,16 +2033,10 @@ func _try_attack_adjacent(unit: Variant, game_map: RefCounted) -> void:
|
|||
for c: Variant in p.cities:
|
||||
var dist: int = HexUtilsScript.hex_distance(unit.position, c.position)
|
||||
if dist <= 1:
|
||||
var city_key: String = "%d,%d" % [c.position.x, c.position.y]
|
||||
var attacks_so_far: int = _city_attacks_this_turn.get(city_key, 0)
|
||||
if attacks_so_far >= MAX_CITY_ATTACKS_PER_TURN:
|
||||
# Stack-of-doom cap: don't pile on beyond the limit this turn.
|
||||
return
|
||||
print(" ATTACKING CITY: %s at %s -> city at %s (dist=%d)" % [unit.type_id, unit.position, c.position, dist])
|
||||
var resolver_script: GDScript = load("res://engine/src/modules/combat/combat_resolver.gd")
|
||||
var resolver: RefCounted = resolver_script.new()
|
||||
resolver.resolve(unit, c, game_map, all_units)
|
||||
_city_attacks_this_turn[city_key] = attacks_so_far + 1
|
||||
unit.movement_remaining = 0
|
||||
return
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue