[PR #7579] [MERGED] feat(rulesets): guided character sheet builder #7811

Closed
opened 2026-10-24 04:07:42 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7579
Author: @kolacheee
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @kolacheee

Base: staging ← Head: feat/ruleset-builder


📝 Commits (10+)

  • edf40e4 feat(rulesets): a critical range off the sheet (1.76), derived values that multiply (1.77), and a sheet value added to an amount (1.78)
  • d345389 feat(rulesets): a sheet may have up to 120 derived values (1.79)
  • 48ba777 feat(rulesets): a list's number column filled by a roll (1.80)
  • 4eb6e02 fix(rulesets): a rolled cell reads an empty die as the editor shows it; e2e for the Roll button
  • c1ae9e2 test(rulesets): a rolled column throws its count of dice
  • f295f7c fix(rulesets): a critical held for a reaction stays one, the forecast counts the range, and an item's use cannot add a sheet value
  • fc338ad docs(rulesets): the JSON schema without amountAdd on an item's use
  • fe61348 fix(rulesets): a rolled cell lands on the sheet as it stands, says when the roll failed, and a range under 2 is none
  • e18c043 feat(rulesets): a sheet may declare a guided builder, and a catalog entry what a pick through it grants
  • 8ef0265 feat(rulesets): a Guided view walks a player through a ruleset's builder, beside All fields

📊 Changes

41 files changed (+17012 additions, -6168 deletions)

View changed files

📝 docs/extending/ruleset.schema.json (+8863 -5736)
📝 docs/extending/writing-rulesets.md (+75 -8)
➕ e2e/game-ruleset-sheet-builder.e2e.ts (+411 -0)
📝 e2e/game-ruleset-wearing.e2e.ts (+87 -1)
📝 packages/client/src/components/game/GameRulesetSheet.tsx (+3 -2)
📝 packages/client/src/components/game/StartingGearPicker.tsx (+51 -4)
📝 packages/client/src/components/rulesets/RulesetCatalogPicker.tsx (+6 -2)
➕ packages/client/src/components/rulesets/RulesetSheetBuilder.tsx (+935 -0)
📝 packages/client/src/components/rulesets/RulesetSheetEditor.tsx (+416 -327)
➕ packages/client/src/components/rulesets/RulesetTypedInput.tsx (+124 -0)
📝 packages/client/src/lib/ruleset-catalog.ts (+15 -2)
📝 packages/client/src/lib/ruleset-sheet-view.ts (+33 -0)
📝 packages/client/src/localization/locales/en.json (+67 -0)
📝 packages/server/src/routes/game.routes.ts (+2 -1)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+336 -0)
📝 packages/shared/src/features/ruleset-combat/encounter.ts (+66 -8)
📝 packages/shared/src/features/ruleset-combat/options.ts (+7 -3)
📝 packages/shared/src/features/ruleset-combat/resolve.ts (+33 -8)
📝 packages/shared/src/features/ruleset-combat/types.ts (+6 -0)
📝 packages/shared/src/features/rulesets/item-book.ts (+31 -9)

...and 21 more files

📄 Description

Linked issue

Part of #7469

This follows #7563 (merged). This branch is up to date with staging and holds only the sheet builder. Staging's avatar agents took Capability API 1.73, so every version here moved up by one: this PR uses 1.81 through 1.112. 1.80 stays reserved for Pixelforge's map pack tiles and 1.101-1.103 for the 5e combat rules, which come in a later PR. The GM rules, maps and the rest follow this one at a time.

Why this change

  • A player making a character for a ruleset had to fill every field of the sheet by hand, with nothing to say which picks a class or background allows, how scores are bought or rolled, or what a pick gives.
  • Rulesets could not express several common 5e sheet rules: a hit point maximum that multiplies, a critical range read off the sheet, list cells filled by a die roll, weapons that read the holder's sheet, or more than 60 derived values.

What changed

  • Guided builder: a sheet may declare a builder, a list of steps that pick catalog entries, fill fields, set ability scores (point buy, standard array, rolled or manual) and choose skills, saves and starting gear (Capability API 1.86). The sheet editor gains a Guided view beside All fields, which walks the player through the steps, says what each one waits on, and shows the sheet's own summary numbers. It takes back only what it wrote, keeps its choices through a game's Edit, and never changes an existing character for picking what it already is.
  • Builder rules: a step can start on a default method and offer entries up to a sheet value (1.87), ask for as many picks as the sheet says (1.90), offer entries only while the sheet allows them (offeredWhen, 1.99 and 1.100), keep one pick of an exclusive group (1.94), and show fields only while the sheet allows (shownWhen, 1.107). A pick can grant entries of another catalog to choose (1.91, held to their offeredWhen in 1.106), and score choices that repeat a score (1.93) or stop at a cap (1.96). Skill and save choices never offer what the picks already train (1.104) and can build on training already held (1.105). A catalog step can stamp columns onto its rows (1.108), a starting-gear step can hold its gear to what the sheet fits (1.109), a catalog step can ask for up to 40 entries and manual scores can be bounded (1.110), and a builder may have up to 24 steps (1.112).
  • Sheet math: a critical range off the sheet (combat.attackRoll.criticalFrom, 1.81), derived values that multiply (1.82), a sheet value added to an entry's amount (amountAdd, 1.83), list number columns filled by a roll with a Roll button in the editor (1.85), and up to 120, 240 and then 400 derived values (1.84, 1.88, 1.111).
  • Catalogs and items: a coin may name one of itself (one: "penny", 1.89), one entry may keep several rows of a list up to date, told apart by name (1.92), an item's to-hit may add a value off its holder's sheet (1.95), and a weapon's damage may add one in one hand (1.97) or reroll low dice while wielded two-handed (1.98). Each class casts with its own spellcasting ability.
  • docs/extending/writing-rulesets.md covers all of it, and docs/extending/ruleset.schema.json is regenerated.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md
  • On this branch merged with staging 4ae372567: pnpm check green (one existing exhaustive-deps warning), and the capability (19), avatar (13) and game-ruleset-sheet lanes pass. Before the last staging merge (#7555, avatars only), the game-ruleset (63), package (7), creature (4), professor-mari (18), open-issues and combat (26) lanes passed on the renumbered branch.
  • E2E, run one at a time: game-ruleset-sheet-builder, game-ruleset-wearing, game-ruleset-starting-gear and game-ruleset-package-import.

Manual verification notes

  • The guided builder was driven in the browser through the e2e spec: picks, rolled and bought scores, and saving the sheet.
  • Not checked by a person yet: the builder on a full 5e ruleset in a live game.

Changed test expectations

No maintainer asked for these; each follows a change on staging or in this PR, and the check it replaces is kept:

  • Supported Capability API 1.79 to 1.112, and the unsupported fixture 1.80 to 1.113 (capability-package-lifecycle): this PR's versions run to 1.112.
  • game-ruleset-wearing and game-ruleset-sheet-builder e2e open the party from the Character Profiles window button, because staging replaced the party members button with it. They still open the same character sheet.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)
  • docs/extending/writing-rulesets.md changed and docs/extending/ruleset.schema.json is regenerated. The translations are tracked on #7512.

UI evidence (if applicable)

No screenshots attached. The e2e specs above drive the builder.

Summary by CodeRabbit

  • New Features
    • Added a guided character builder with catalog choices, ability-score methods, training, and starting gear, alongside an All Fields view.
    • Numeric sheet values can be rolled with dice, including die sizes determined by other sheet values.
    • Rulesets can use sheet values for combat bonuses, damage rerolls, critical-hit ranges, spell attacks and saves, and catalog ability amounts.
    • Catalog choices support additional conditions and grants; named scaled list entries and singular currency names are supported.
  • Improvements
    • Starting gear can be limited to options that fit a character’s build, with a free-edit option. Coin amounts display singular labels when appropriate.
  • Bug Fixes
    • Editing a sheet no longer discards other saved sheet information.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7579 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/ruleset-builder` --- ### 📝 Commits (10+) - [`edf40e4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/edf40e481de39d5e5e4555ee989d22d1ed587ccf) feat(rulesets): a critical range off the sheet (1.76), derived values that multiply (1.77), and a sheet value added to an amount (1.78) - [`d345389`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d345389b3a781a4b4bc615990f41fb432063c565) feat(rulesets): a sheet may have up to 120 derived values (1.79) - [`48ba777`](https://github.com/Pasta-Devs/Marinara-Engine/commit/48ba777a5c9215780aa19a809b784573bff0a8df) feat(rulesets): a list's number column filled by a roll (1.80) - [`4eb6e02`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4eb6e02a75687985a9a6013b05450bfeeaeb4679) fix(rulesets): a rolled cell reads an empty die as the editor shows it; e2e for the Roll button - [`c1ae9e2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c1ae9e23581a13f28940102860727513e1797b40) test(rulesets): a rolled column throws its count of dice - [`f295f7c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f295f7c7ddb8ed8f58db0927c9e33ff79cc58a56) fix(rulesets): a critical held for a reaction stays one, the forecast counts the range, and an item's use cannot add a sheet value - [`fc338ad`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fc338addb13b18f724134c0875a0ab3d7b1c3bea) docs(rulesets): the JSON schema without amountAdd on an item's use - [`fe61348`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fe613482cd8819780500c5c24959ee3ce5340853) fix(rulesets): a rolled cell lands on the sheet as it stands, says when the roll failed, and a range under 2 is none - [`e18c043`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e18c0433f2affd10e2433901e1ed9ed7f31a96da) feat(rulesets): a sheet may declare a guided builder, and a catalog entry what a pick through it grants - [`8ef0265`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8ef0265f3d188a4043ba1e733d0d0cc75f886738) feat(rulesets): a Guided view walks a player through a ruleset's builder, beside All fields ### 📊 Changes **41 files changed** (+17012 additions, -6168 deletions) <details> <summary>View changed files</summary> 📝 `docs/extending/ruleset.schema.json` (+8863 -5736) 📝 `docs/extending/writing-rulesets.md` (+75 -8) ➕ `e2e/game-ruleset-sheet-builder.e2e.ts` (+411 -0) 📝 `e2e/game-ruleset-wearing.e2e.ts` (+87 -1) 📝 `packages/client/src/components/game/GameRulesetSheet.tsx` (+3 -2) 📝 `packages/client/src/components/game/StartingGearPicker.tsx` (+51 -4) 📝 `packages/client/src/components/rulesets/RulesetCatalogPicker.tsx` (+6 -2) ➕ `packages/client/src/components/rulesets/RulesetSheetBuilder.tsx` (+935 -0) 📝 `packages/client/src/components/rulesets/RulesetSheetEditor.tsx` (+416 -327) ➕ `packages/client/src/components/rulesets/RulesetTypedInput.tsx` (+124 -0) 📝 `packages/client/src/lib/ruleset-catalog.ts` (+15 -2) 📝 `packages/client/src/lib/ruleset-sheet-view.ts` (+33 -0) 📝 `packages/client/src/localization/locales/en.json` (+67 -0) 📝 `packages/server/src/routes/game.routes.ts` (+2 -1) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+336 -0) 📝 `packages/shared/src/features/ruleset-combat/encounter.ts` (+66 -8) 📝 `packages/shared/src/features/ruleset-combat/options.ts` (+7 -3) 📝 `packages/shared/src/features/ruleset-combat/resolve.ts` (+33 -8) 📝 `packages/shared/src/features/ruleset-combat/types.ts` (+6 -0) 📝 `packages/shared/src/features/rulesets/item-book.ts` (+31 -9) _...and 21 more files_ </details> ### 📄 Description ## Linked issue Part of #7469 This follows #7563 (merged). This branch is up to date with staging and holds only the sheet builder. Staging's avatar agents took Capability API 1.73, so every version here moved up by one: this PR uses 1.81 through 1.112. 1.80 stays reserved for Pixelforge's map pack tiles and 1.101-1.103 for the 5e combat rules, which come in a later PR. The GM rules, maps and the rest follow this one at a time. ## Why this change - A player making a character for a ruleset had to fill every field of the sheet by hand, with nothing to say which picks a class or background allows, how scores are bought or rolled, or what a pick gives. - Rulesets could not express several common 5e sheet rules: a hit point maximum that multiplies, a critical range read off the sheet, list cells filled by a die roll, weapons that read the holder's sheet, or more than 60 derived values. ## What changed - **Guided builder:** a sheet may declare a `builder`, a list of steps that pick catalog entries, fill fields, set ability scores (point buy, standard array, rolled or manual) and choose skills, saves and starting gear (Capability API 1.86). The sheet editor gains a **Guided** view beside **All fields**, which walks the player through the steps, says what each one waits on, and shows the sheet's own summary numbers. It takes back only what it wrote, keeps its choices through a game's Edit, and never changes an existing character for picking what it already is. - **Builder rules:** a step can start on a default method and offer entries up to a sheet value (1.87), ask for as many picks as the sheet says (1.90), offer entries only while the sheet allows them (`offeredWhen`, 1.99 and 1.100), keep one pick of an `exclusive` group (1.94), and show fields only while the sheet allows (`shownWhen`, 1.107). A pick can grant entries of another catalog to choose (1.91, held to their `offeredWhen` in 1.106), and score choices that repeat a score (1.93) or stop at a cap (1.96). Skill and save choices never offer what the picks already train (1.104) and can build on training already held (1.105). A catalog step can stamp columns onto its rows (1.108), a starting-gear step can hold its gear to what the sheet fits (1.109), a catalog step can ask for up to 40 entries and manual scores can be bounded (1.110), and a builder may have up to 24 steps (1.112). - **Sheet math:** a critical range off the sheet (`combat.attackRoll.criticalFrom`, 1.81), derived values that `multiply` (1.82), a sheet value added to an entry's amount (`amountAdd`, 1.83), list number columns filled by a `roll` with a Roll button in the editor (1.85), and up to 120, 240 and then 400 derived values (1.84, 1.88, 1.111). - **Catalogs and items:** a coin may name one of itself (`one: "penny"`, 1.89), one entry may keep several rows of a list up to date, told apart by name (1.92), an item's to-hit may add a value off its holder's sheet (1.95), and a weapon's damage may add one in one hand (1.97) or reroll low dice while wielded two-handed (1.98). Each class casts with its own spellcasting ability. - `docs/extending/writing-rulesets.md` covers all of it, and `docs/extending/ruleset.schema.json` is regenerated. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` - On this branch merged with staging 4ae372567: `pnpm check` green (one existing exhaustive-deps warning), and the `capability` (19), `avatar` (13) and `game-ruleset-sheet` lanes pass. Before the last staging merge (#7555, avatars only), the `game-ruleset` (63), `package` (7), `creature` (4), `professor-mari` (18), `open-issues` and `combat` (26) lanes passed on the renumbered branch. - E2E, run one at a time: `game-ruleset-sheet-builder`, `game-ruleset-wearing`, `game-ruleset-starting-gear` and `game-ruleset-package-import`. ### Manual verification notes - The guided builder was driven in the browser through the e2e spec: picks, rolled and bought scores, and saving the sheet. - Not checked by a person yet: the builder on a full 5e ruleset in a live game. ### Changed test expectations No maintainer asked for these; each follows a change on staging or in this PR, and the check it replaces is kept: - Supported Capability API 1.79 to 1.112, and the unsupported fixture 1.80 to 1.113 (`capability-package-lifecycle`): this PR's versions run to 1.112. - `game-ruleset-wearing` and `game-ruleset-sheet-builder` e2e open the party from the Character Profiles window button, because staging replaced the party members button with it. They still open the same character sheet. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README) as needed - [x] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) - `docs/extending/writing-rulesets.md` changed and `docs/extending/ruleset.schema.json` is regenerated. The translations are tracked on #7512. ## UI evidence (if applicable) No screenshots attached. The e2e specs above drive the builder. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a guided character builder with catalog choices, ability-score methods, training, and starting gear, alongside an All Fields view. * Numeric sheet values can be rolled with dice, including die sizes determined by other sheet values. * Rulesets can use sheet values for combat bonuses, damage rerolls, critical-hit ranges, spell attacks and saves, and catalog ability amounts. * Catalog choices support additional conditions and grants; named scaled list entries and singular currency names are supported. * **Improvements** * Starting gear can be limited to options that fit a character’s build, with a free-edit option. Coin amounts display singular labels when appropriate. * **Bug Fixes** * Editing a sheet no longer discards other saved sheet information. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:07:42 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7811
No description provided.