Skip to content

feat(quests): gems ride on generated tray pieces, not pre-placed - #17

Merged
uhmin99 merged 1 commit into
devfrom
feat/tray-gems
Jul 15, 2026
Merged

uhmin99 merged 1 commit into
devfrom
feat/tray-gems

Conversation

@uhmin99

@uhmin99 uhmin99 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Reworks gem-goal quest stages so gems appear on generated tray pieces
instead of being pre-placed on the board.

Why

Pre-placing all goal gems on the grid made some stages trivially easy and
others too hard, and capped how high a goal could be. Now gems spawn on
new pieces (0, 1, or 2 per piece), drawn only from colors still needed,
so goals can be large and multi-color, and a fully-collected color stops
spawning.

Model

  • GameState.trayGems (per-slot cell-index→gem, parallel to tray) and
    GameState.gemGoal (target per color). Both round-trip through save JSON
    (emitted only when non-empty).
  • assignGems(tray, needed) in the piece generator: weighted by remaining
    need, gemSpawnChance per piece, gemSecondChance for ≥4-cell pieces.
    Deterministic from the RNG.
  • stampWithGems places a piece carrying its gems; gems collect when a
    line through them clears. Over-collecting is fine (win is ≥ goal).

Render

  • Tray pieces and board cells draw a shared paintGemStar.

Content

  • 20 gem stages across starter / deep-dig / treasure-trail: board gems
    stripped to plain blocks; goals raised (single 8, two 6 each, three 5
    each). Checksums updated.

Docs & tests

  • ARCHITECTURE / SAVE_MODEL / CONTRIBUTING_QUESTS updated.
  • New tests: gem collection on clear, refill spawns only-needed colors,
    over-collect exceeds goal, assignGems determinism, save round-trip.
    89 tests pass, analyze clean.

🤖 Generated with Claude Code

User feedback: pre-placing every gem on the grid made stages swingy and
kept goals small. Now gems spawn on generated tray pieces — assignGems
attaches gems (~50% of pieces, big pieces sometimes two) drawing only
colors still needed; a fully-collected color stops appearing; a placed
gem is collected when a line through it clears; over-collecting is fine.

- Model: GameState.trayGems (per-slot cell->color) + gemGoal;
  placement.stampWithGems; engine threads gems through place/refill;
  quest controller passes the goal.
- Render: placed gems keep the piece color (pre-placed stay light);
  tray pieces show their gems (shared paintGemStar).
- Validator: dropped the obsolete 'board must contain the gems' rule,
  added a gem-count range. All 20 gem stages stripped of board gems,
  goals raised (single 8 / two 6 / three 5).

Tests: engine gem collection + needed-only refill + over-collect;
assignGems needed-only/deterministic; trayGems/gemGoal save round-trip.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@uhmin99
uhmin99 merged commit 63ea230 into dev Jul 15, 2026
5 checks passed
@uhmin99
uhmin99 deleted the feat/tray-gems branch July 15, 2026 22:53
uhmin99 added a commit that referenced this pull request Jul 15, 2026
#18)

User feedback: pre-placing every gem on the grid made stages swingy and
kept goals small. Now gems spawn on generated tray pieces — assignGems
attaches gems (~50% of pieces, big pieces sometimes two) drawing only
colors still needed; a fully-collected color stops appearing; a placed
gem is collected when a line through it clears; over-collecting is fine.

- Model: GameState.trayGems (per-slot cell->color) + gemGoal;
  placement.stampWithGems; engine threads gems through place/refill;
  quest controller passes the goal.
- Render: placed gems keep the piece color (pre-placed stay light);
  tray pieces show their gems (shared paintGemStar).
- Validator: dropped the obsolete 'board must contain the gems' rule,
  added a gem-count range. All 20 gem stages stripped of board gems,
  goals raised (single 8 / two 6 / three 5).

Tests: engine gem collection + needed-only refill + over-collect;
assignGems needed-only/deterministic; trayGems/gemGoal save round-trip.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant