Take planets by killing what defends them
#211 conquest is the fight now: a planet registers the garrison its setup authors, each defender's own death counts against it, and the last one takes the world. The capture points - stand in a ring, wait out a timer, once per ring - are gone, along with the editor palette that placed them. #212 conquest opens a dialog on the surface naming the research points recovered; the award travels with the signal, after it is banked. #209 the prologue's charted sectors go with the breach, so the map the survivors keep is of where they now are - and "chart 30 sectors" is no longer complete before they have flown anywhere. #218 enemy variety is gated on the FLEET, not on wave strength: a starting fleet meets chasers only at any wave number, and each vessel past three opens one more kind. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019AJMdB7iuHuLFZM1aBu3GD
This commit is contained in:
parent
78836882af
commit
6e13b6397c
42 changed files with 540 additions and 749 deletions
|
|
@ -3,10 +3,10 @@ extends SceneTree
|
|||
# Headless gameplay test: run with
|
||||
# godot --headless -s res://tests/test_planet_conquest_gate.gd
|
||||
# Verifies:
|
||||
# 1. GameState starts every planet unconquered, and register_capture_points
|
||||
# is idempotent (a second call with the same total doesn't wipe progress)
|
||||
# 2. mark_point_captured only conquers once every point is captured, and
|
||||
# the planet_conquered signal fires exactly once
|
||||
# 1. GameState starts every planet unconquered, and re-registering a
|
||||
# garrison on a conquered planet cannot un-conquer it
|
||||
# 2. a planet falls only when its LAST defender does, and the
|
||||
# planet_conquered signal fires exactly once, carrying what it paid
|
||||
# 3. over an unconquered planet, the extractor build option is disabled,
|
||||
# the info popup explains why, and confirming spends nothing and builds
|
||||
# nothing
|
||||
|
|
@ -22,6 +22,9 @@ var target_chunk: Vector2i
|
|||
var stage: int = 0
|
||||
var elapsed: float = 0.0
|
||||
var conquered_signal_count: int = 0
|
||||
# #212 needs the award to travel WITH the signal, so whatever announces
|
||||
# conquest reports a number that was actually paid.
|
||||
var conquered_signal_points: int = -1
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
|
|
@ -57,22 +60,47 @@ func _initialize() -> void:
|
|||
# Unit-level checks on GameState itself, before any scene involvement.
|
||||
if game_state.is_planet_conquered(target_planet_id):
|
||||
return _fail("a fresh planet reported conquered")
|
||||
game_state.register_capture_points(target_planet_id, 3)
|
||||
game_state.mark_point_captured(target_planet_id, 0)
|
||||
game_state.register_capture_points(target_planet_id, 3) # idempotent re-registration
|
||||
if game_state.captured_point_count(target_planet_id) != 1:
|
||||
return _fail("re-registering wiped already-captured progress")
|
||||
game_state.planet_conquered.connect(func(_id): conquered_signal_count += 1)
|
||||
game_state.mark_point_captured(target_planet_id, 1)
|
||||
game_state.register_planet_garrison(target_planet_id, 3)
|
||||
if game_state.garrison_remaining(target_planet_id) != 3:
|
||||
return _fail("a garrison of 3 registered as %d" \
|
||||
% game_state.garrison_remaining(target_planet_id))
|
||||
game_state.planet_conquered.connect(func(_id, points):
|
||||
conquered_signal_count += 1
|
||||
conquered_signal_points = points)
|
||||
game_state.mark_garrison_enemy_destroyed(target_planet_id)
|
||||
game_state.mark_garrison_enemy_destroyed(target_planet_id)
|
||||
if game_state.is_planet_conquered(target_planet_id):
|
||||
return _fail("conquered with points still missing")
|
||||
game_state.mark_point_captured(target_planet_id, 2)
|
||||
return _fail("conquered with a defender still standing")
|
||||
game_state.mark_garrison_enemy_destroyed(target_planet_id)
|
||||
if not game_state.is_planet_conquered(target_planet_id):
|
||||
return _fail("all points captured but planet not marked conquered")
|
||||
# Marking an already-captured point again must not double-fire the signal.
|
||||
game_state.mark_point_captured(target_planet_id, 2)
|
||||
return _fail("the whole garrison is down but the planet is not conquered")
|
||||
# A stray kill reported after the planet has fallen must not fire again.
|
||||
game_state.mark_garrison_enemy_destroyed(target_planet_id)
|
||||
# Nor may re-landing hand the planet back: registration is refused
|
||||
# outright once it is taken.
|
||||
game_state.register_planet_garrison(target_planet_id, 3)
|
||||
if not game_state.is_planet_conquered(target_planet_id):
|
||||
return _fail("re-registering a garrison un-conquered a planet already taken")
|
||||
if conquered_signal_count != 1:
|
||||
return _fail("planet_conquered fired %d times, expected exactly 1" % conquered_signal_count)
|
||||
# This planet was registered with no definition and no override, so the
|
||||
# conquest paid nothing - and the signal has to say so rather than leave
|
||||
# the announcement to guess.
|
||||
if conquered_signal_points != 0:
|
||||
return _fail("an unrewarded conquest reported %d research points" \
|
||||
% conquered_signal_points)
|
||||
|
||||
# A rewarded one reports what it paid.
|
||||
var paid_planet_id: String = target_planet_id + ":paid"
|
||||
var points_before: int = game_state.research_points
|
||||
game_state.register_planet_garrison(paid_planet_id, 1, "", 4)
|
||||
conquered_signal_points = -1
|
||||
game_state.mark_garrison_enemy_destroyed(paid_planet_id)
|
||||
if conquered_signal_points != 4:
|
||||
return _fail("a 4-point conquest reported %d" % conquered_signal_points)
|
||||
if game_state.research_points != points_before + 4:
|
||||
return _fail("the reported points were not the ones actually banked")
|
||||
print("conquest reports the research points it paid")
|
||||
|
||||
# Reset conquest for the scene-level gate check below - this run tests
|
||||
# the unconquered path first, then conquers it.
|
||||
|
|
@ -134,9 +162,9 @@ func _process(delta: float) -> bool:
|
|||
popup.visible = false
|
||||
|
||||
# Now conquer it and confirm the same flow succeeds.
|
||||
game_state.register_capture_points(planet.planet_id, 2)
|
||||
game_state.mark_point_captured(planet.planet_id, 0)
|
||||
game_state.mark_point_captured(planet.planet_id, 1)
|
||||
game_state.register_planet_garrison(planet.planet_id, 2)
|
||||
game_state.mark_garrison_enemy_destroyed(planet.planet_id)
|
||||
game_state.mark_garrison_enemy_destroyed(planet.planet_id)
|
||||
|
||||
controller._on_build_pressed()
|
||||
if not button.enabled:
|
||||
|
|
|
|||
Loading…
Reference in a new issue