Add artifact win condition #3

Merged
mlangkabel merged 6 commits from feature/win-condition-artifacts into master 2026-07-01 20:27:30 +00:00

6 Commits

Author SHA1 Message Date
a5cccc03ba Freeze replay at the run's terminal state (win/defeat)
Playback only stopped when the recorded command stream ran out, so a run that
ended on the artifact win (e.g. 3/3) kept ticking during replay because win and
game-over are gated off in replay mode and the recording ran a few ticks past
the win.

Stop advancing when m_sim->isWon() || isGameOver() (in addition to the stream
end), and show it in the replay overlay: "Replay ended — Victory" / "— Defeat"
(desync still takes priority). This matches where the real game froze.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DUsFgd2Ga6pmLz8giS8WUn
2026-07-01 22:14:43 +02:00
d38f68e301 Fix artifact header showing "0/?" during replay
The artifact-count poll was gated behind if (!m_replayPlayer) (from the merge
resolution), so ArtifactCountChangedEvent never fired in replay mode: the header
stayed at its initial "Artifacts: 0/?" literal and never reflected replayed
artifact picks.

Unlike the schematic/win/game-over polls (live-input sources / interruptions
that stay gated), artifact count is a passive reflection of sim state. Move it
out of the replay gate so it tracks m_sim->artifactCount() during playback too,
including the first-frame emit that populates the win-count max.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DUsFgd2Ga6pmLz8giS8WUn
2026-07-01 22:06:32 +02:00
5bdf0d5b8a Merge master (replay feature) into feature/win-condition-artifacts
Resolves conflicts from the merged replay/command-chokepoint work:

- src/test/CMakeLists.txt: keep both new test sets (artifact + replay).
- GameWorldView::onFrame: keep the replay gate (if (!m_replayPlayer)) and
  place the artifact-count / win / game-over polls inside it, de-duplicating
  the game-over check.
- ArtifactWinConditionTest.cpp: route applySchematicChoice through
  SimulationTestAccess (the mutator is now private post-lockdown).
- Simulation::computeStateChecksum: fold in m_isWon and m_artifactCount so the
  new artifact state is covered by determinism/replay desync detection.

Simulation.h/.cpp auto-merged cleanly (applySchematicChoice landed private;
artifact accessors public; reset() clears artifact state; the artifact roll
draws from m_rng so it stays deterministic under replay).

All targets build; 365 cases / 3469 assertions pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DUsFgd2Ga6pmLz8giS8WUn
2026-07-01 21:32:24 +02:00
09313c2d8a add tests for artifact win condition
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DUsFgd2Ga6pmLz8giS8WUn
2026-06-30 09:58:39 +02:00
2b6dafcf50 implement artifact win condition (REQ-WIN-ARTIFACT-COUNT, REQ-WIN-SCREEN)
- Add [artifacts] config section to world.toml with artifact_chance_formula (x = station level) and artifact_win_count
- Roll artifact chance before each schematic drop; on success show 2 schematics + Artifact option instead of 3
- Selecting Artifact increments artifact count; reaching artifact_win_count triggers win screen
- Display "Artifacts: x/y" in header bar via ArtifactCountChangedEvent
- Win screen mirrors game-over screen with "Won!" caption and same Restart/Quit buttons

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DUsFgd2Ga6pmLz8giS8WUn
2026-06-30 09:18:19 +02:00
e7d70a3640 add win condition and artifact system to requirements
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DUsFgd2Ga6pmLz8giS8WUn
2026-06-30 08:44:02 +02:00