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:
Loïc Wisniewski 2026-09-05 13:31:25 +02:00
commit 6e13b6397c
42 changed files with 540 additions and 749 deletions

View file

@ -3,20 +3,22 @@ extends SceneTree
# Headless gameplay test: run with
# godot --headless -s res://tests/test_conquered_planet_clear.gd
# A planet's garrison was destroyed to take it, so it must not be standing
# there again the next time the player lands. Capture points already came
# back marked captured; the enemies came back alive, which read as the
# conquest having quietly been undone.
# there again the next time the player lands.
#
# #211 made the garrison the whole of conquest: killing the last defender
# takes the planet, and there are no capture points beside them any more.
#
# Covers:
# A. an unconquered planet lays out its authored enemies, as before
# B. once every capture point is taken, re-landing places no enemies - and
# still places the capture points, marked captured
# C. a setup that authors enemies but NO capture points keeps them. Such a
# planet counts as vacuously conquered (nothing to capture), so keying
# only off the conquered flag would delete a garrison nobody has beaten
# B. killing the last of them conquers it, and re-landing places none
# C. a setup with NO enemies counts as vacuously conquered - there is
# nothing there to beat
# D. a half-cleared planet the player left comes back whole, and its count
# with it, rather than falling to a single kill on the next visit
const PLANET_KEY: String = "test_conquered_planet_clear"
const OPEN_PLANET_KEY: String = "test_conquered_planet_clear_open"
const LEFT_PLANET_KEY: String = "test_conquered_planet_clear_left"
var game_state: Node
var host_scene: PackedScene
@ -41,42 +43,54 @@ func _process(delta: float) -> bool:
# --- A. unconquered: the garrison is there ---------------------------
game_state.planet_id = PLANET_KEY
game_state.planet_definition_id = "rocky"
var setup: Resource = _make_setup(2, 3)
var setup: Resource = _make_setup(3)
var enemies: int = _apply_and_count_enemies(setup)
if enemies != 3:
return _fail("an unconquered planet placed %d of its 3 authored enemies" % enemies)
if game_state.is_planet_conquered(PLANET_KEY):
return _fail("a planet with 2 uncaptured points reported itself conquered")
return _fail("a planet with 3 defenders standing reported itself conquered")
print("unconquered planet: 3 enemies placed")
# --- B. conquered: the garrison stays destroyed ----------------------
game_state.mark_point_captured(PLANET_KEY, 0)
game_state.mark_point_captured(PLANET_KEY, 1)
# --- B. the last kill takes it, and it stays taken -------------------
game_state.mark_garrison_enemy_destroyed(PLANET_KEY)
game_state.mark_garrison_enemy_destroyed(PLANET_KEY)
if game_state.is_planet_conquered(PLANET_KEY):
return _fail("the planet fell with a defender still standing")
game_state.mark_garrison_enemy_destroyed(PLANET_KEY)
if not game_state.is_planet_conquered(PLANET_KEY):
return _fail("capturing every point did not conquer the planet")
return _fail("killing the whole garrison did not conquer the planet")
var host: Node = host_scene.instantiate()
root.add_child(host)
host.apply_setup(setup)
var remaining: int = _count_enemies(host)
var points: int = _count_capture_points(host)
host.free()
var remaining: int = _apply_and_count_enemies(setup)
if remaining != 0:
return _fail("re-landing on a conquered planet placed %d enemies" % remaining)
if points != 2:
return _fail("a conquered planet placed %d of its 2 capture points - conquest should clear the garrison, not the map" % points)
print("conquered planet: 0 enemies, both capture points still placed")
print("conquered planet: last kill took it, re-landing places nobody")
# --- C. a setup with nothing to capture keeps its enemies ------------
# --- C. nothing to fight is nothing to take --------------------------
game_state.planet_id = OPEN_PLANET_KEY
var open_setup: Resource = _make_setup(0, 2)
var open_setup: Resource = _make_setup(0)
var open_enemies: int = _apply_and_count_enemies(open_setup)
if not game_state.is_planet_conquered(OPEN_PLANET_KEY):
return _fail("a setup with no capture points was expected to register as vacuously conquered, and did not - so this case no longer tests what it claims to")
if open_enemies != 2:
return _fail("a setup with no capture points lost %d of its 2 enemies to the conquest rule" \
% (2 - open_enemies))
print("setup with no capture points: both enemies kept, despite counting as conquered")
return _fail("a setup with no enemies was expected to be vacuously conquered")
if open_enemies != 0:
return _fail("a setup authoring no enemies placed %d" % open_enemies)
print("setup with no garrison: vacuously conquered, nobody placed")
# --- D. leaving mid-fight does not bank the kills --------------------
# The garrison is re-placed in full on the next landing, so its count
# has to start again with it - otherwise a planet left at one-from-
# clear would fall to a single kill against three fresh defenders.
game_state.planet_id = LEFT_PLANET_KEY
var left_setup: Resource = _make_setup(3)
_apply_and_count_enemies(left_setup)
game_state.mark_garrison_enemy_destroyed(LEFT_PLANET_KEY)
game_state.mark_garrison_enemy_destroyed(LEFT_PLANET_KEY)
var returned: int = _apply_and_count_enemies(left_setup)
if returned != 3:
return _fail("returning to a half-cleared planet placed %d of 3 defenders" % returned)
game_state.mark_garrison_enemy_destroyed(LEFT_PLANET_KEY)
if game_state.is_planet_conquered(LEFT_PLANET_KEY):
return _fail("one kill took a planet defended by three - the count did not reset with the garrison")
print("returning mid-fight: the garrison and its count both start again")
print("TEST_CONQUERED_PLANET_CLEAR: PASS")
quit(0)
@ -84,14 +98,10 @@ func _process(delta: float) -> bool:
return false
func _make_setup(capture_count: int, enemy_count: int) -> Resource:
func _make_setup(enemy_count: int) -> Resource:
var setup: Resource = load("res://surface/PlanetSetup.gd").new()
setup.setup_id = "in_memory"
setup.surface_profile_id = "rocky"
var points: PackedVector2Array = PackedVector2Array()
for i in range(capture_count):
points.append(Vector2(200.0 * float(i + 1), 0.0))
setup.capture_points = points
var spawn_script: Script = load("res://surface/PlanetSetupSpawn.gd")
for i in range(enemy_count):
var spawn: Resource = spawn_script.new()
@ -121,16 +131,6 @@ func _count_enemies(host: Node) -> int:
return count
func _count_capture_points(host: Node) -> int:
var count: int = 0
for child in host.get_children():
if child.is_in_group("enemies"):
continue
if "point_index" in child:
count += 1
return count
func _fail(message: String) -> bool:
print("TEST_CONQUERED_PLANET_CLEAR: FAIL (%s)" % message)
quit(1)