Commit graph

10 commits

Author SHA1 Message Date
8a377c2e41 Add recurring-demand mode with shortage tracking
DemandDef gains optional ConsumptionPerTurn and SustainTurns. When
ConsumptionPerTurn > 0 the demand maintains a buffer filled by
deliveries and drained each turn. Shortage fires the first turn the
buffer can't cover consumption; it clears when the buffer refills.
SustainedTurns counts consecutive non-shortage turns, and IsSatisfied
flips to true once it meets SustainTurns — so the victory condition
becomes "no shortage for N consecutive turns" as soon as a mission opts
in. Classic demands (ConsumptionPerTurn = 0) behave exactly as before.

TurnExecutor runs the consumption sub-phase after transfers. Two new
events (DemandShortageStarted / DemandShortageCleared) let the
presentation surface the state later. BoardSnapshot + CampaignLoader
carry the new fields; no existing mission opts in yet, so
campaign_01.json is unaffected.
2026-04-17 22:39:28 +02:00
e3eb10570b Extend campaign_01 to 9 missions with a finale cathedral
Renames mission 7 from "Le Couronnement" to "Le Comptoir" (it only sets
up the tools→gold chain — the coronation is now the final mission) and
adds:

  - Mission 8 "L'Expansion Finale" (12×10): a Forge Est (wood→tools) and
    an Armurerie Est (stone→arms) on new rightmost columns, plus walls
    that force pieces to route around them. An Entrepôt Est demand on
    (11,9) gives the mission its own goal without depending on the old
    demands.
  - Mission 9 "Le Couronnement" (12×12): the Cathédrale occupies row 11
    as three adjacent demands — outils, armes, and or — so the player
    must keep all three transformation chains running simultaneously to
    complete the campaign.

Existing file tests updated for the new count and rename; new
Campaign01Tests asserts structure and non-regressive terrain across all
nine missions.
2026-04-17 22:34:11 +02:00
97bca7d7df Add Undo (Ctrl+Z) backed by the WorldSave checkpoint mechanism
GameSim snapshots the state before each undoable command
(PlacePiece / RemovePiece / MovePiece) into a bounded LinkedList stack
(max 32). Undo() pops the last checkpoint and emits StateRestoredEvent,
reusing the presentation rebuild path already wired for QuickLoad.

Ctrl+Z in Main triggers the engine method; the harness exposes undo()
for tests. QuickLoad clears the stack (fresh timeline). Seven unit tests
cover empty stack, place/remove/move undo, reverse-order multiple undos,
rejected commands not checkpointing, and post-simulation rewind.
2026-04-17 22:14:06 +02:00
2537bfe828 Add QuickSave/QuickLoad with full state restore and visual rebuild
BoardState.CaptureSave/RestoreFromSave deep-copy every mutable field
(grid, pieces, demands, transformers, buffers, stock, campaign progress)
into a WorldSave slot. GameSim.QuickSave/QuickLoad expose slotted saves
and emit StateSavedEvent / StateRestoredEvent — the latter carries a
fresh BoardSnapshot so the presentation can rebuild board, pieces,
trajectories, objectives, stock, camera, and control bar in one pass.

F5/F9 trigger it in Main; harness gains quick_save/quick_load commands so
UI tests can checkpoint a scenario and resume without replaying from
scratch. Seven xUnit tests cover the roundtrip (including independence
from post-save mutations, campaign state, and multi-slot isolation).
2026-04-17 22:10:06 +02:00
Samuel Bouchet
2d1aea0a7a Snapshot campaign system progress before automation harness
Bundles in-flight work on the campaign/missions system (CampaignDef,
MissionDef, TerrainPatch, TransformerDef, MissionChecker, CampaignLoader,
FlavorBanner, transformer rules), plan files, and matching tests. Baseline
commit so the upcoming automation testing harness lands on a clean tree.
2026-04-16 21:22:49 +02:00
a7280b1a5a Overhaul turn mechanics, collision destruction, and visual animations
- New turn order: produce -> transfer -> move -> collision resolution
- Collisions now destroy weaker pieces (status > level > mutual destruction)
  instead of halting the simulation. SimPhase.Collision removed.
- Add piece Level property (all level 1 in proto, prepared for future)
- Production fires every turn (interval concept removed), buffer = Amount
  (default 1, future 2-4), leftovers overwritten each turn
- Transfer tiebreaker: status > level > clockwise direction (alternating
  even/odd turns in y-up coords), replaces distance-to-production
- Demands always accept matching cargo even when already satisfied
- TurnNumber added to all turn events for animation grouping
- Simultaneous animations: produce flash, cargo slide, parallel piece moves
- Camera centering fix + middle-click pan
- GDD updated with new rules + lore section added

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 21:44:12 +02:00
dd43df8820 Add technical files 2026-04-10 17:14:09 +02:00
3120d9835e Phase 2: cargo-type aware transfers via CargoFilter
Add CargoFilter property to PieceState, auto-assigned at placement
by tracing relay chain back to production. TransferResolver now
enforces cargo-type filtering and uses forward-direction sorting
with cargo-aware distance calculations. Prevents cross-route
contamination on multi-cargo boards.

Level 3 restored to dual-cargo (Wood+Stone) with correct 10R+2K stock.
Two new solvability tests validate filter auto-assignment and chain
propagation. All 60 tests green.
2026-04-10 15:35:37 +02:00
2b3d27d295 Fix transfer direction bug, validate GDD levels via red-green testing
- Fix cargo bouncing in relay chains: piece-to-piece transfers now prefer
  receivers farther from production (forward flow) instead of closer (backward)
- Level 2 stock corrected: 4R+1B → 6R+1B to match required solution
- Level 3 simplified to single cargo type (6R+1K) — dual-cargo on 6x6
  requires engine support for cargo-type filtering (Phase 2)
- Add PLAN.md with prototype roadmap (phases 2-6)
- 57 tests passing
2026-04-10 15:25:25 +02:00
e6eaae43ab Initial commit: Chessistics prototype v0.3
Black box sim engine (commands in, events out) with 3 piece types
(Rook, Bishop, Knight), cargo transfer system with social status
priority, collision detection, and victory/defeat conditions.

57 tests covering rules, simulation, loading, and solvability.
Godot 4 presentation layer scaffolding.
2026-04-10 14:58:03 +02:00