[PR #6704] [MERGED] feat(game): sections on abilities, skills and saves; untrained rules per skill or section #7293

Closed
opened 2026-10-23 04:18:21 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6704
Author: @kolacheee
Created: 9/26/2026
Status: ✅ Merged
Merged: 9/26/2026
Merged by: @kolacheee

Base: staging ← Head: feat/ruleset-sections


📝 Commits (2)

  • d84c00b feat(game): sections on abilities, skills and saves; untrained rules per skill or section
  • 758352f test(game): pin the unsectioned sheet block byte for byte

📊 Changes

37 files changed (+1371 additions, -150 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+30 -0)
📝 docs/examples/rulesets/ember-roads.json (+3 -1)
📝 docs/examples/rulesets/gravewatch.json (+30 -7)
📝 docs/extending/ruleset.schema.json (+96 -0)
📝 docs/extending/writing-rulesets.md (+21 -2)
📝 docs/game/dice-and-skill-checks.md (+1 -0)
➕ e2e/ruleset-sheet-sections.e2e.ts (+130 -0)
📝 packages/client/src/components/game/GameNarration.tsx (+9 -1)
📝 packages/client/src/components/game/GameRulesetSheet.tsx (+43 -27)
📝 packages/client/src/components/game/GameSurface.tsx (+2 -1)
📝 packages/client/src/components/rulesets/RulesetSheetEditor.tsx (+125 -71)
📝 packages/client/src/localization/locales/en.json (+3 -0)
📝 packages/server/src/routes/game.routes.ts (+11 -1)
📝 packages/server/src/routes/generate.routes.ts (+7 -2)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+25 -0)
📝 packages/server/src/services/game/gm-prompts.ts (+35 -0)
📝 packages/server/src/services/game/one-request-dice.ts (+40 -1)
📝 packages/server/src/services/game/skill-check-resolution.service.ts (+75 -5)
📝 packages/shared/src/features/rulesets/sheet-math.ts (+42 -2)

...and 17 more files

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #6655

Why this change

The author of Marinara-RPG-Extension wrote two of their shipped tabletop systems as ruleset.json files. Abilities, skills and saves printed as two flat lists, and every skill a character had no training in rolled the same way, which left two common rules unsayable:

  • Sections on abilities, skills and saves. Fields, derived values and lists could name a section; these three could not. In many systems the grouping is a rule and not only a layout: the untrained rule or its penalty differs by category, and some categories cost less to raise.
  • Untrained rules per skill or category. Every untrained skill rolled the ability alone. Systems in the report make an untrained skill one step harder, take dice off by category, or forbid rolling an untrained skill of one kind at all. The report's files carried this as guidance text per skill, which the model does not reliably follow.

This is slice 5 of the series in the plan doc (§ Gaps a ruleset author found). Slices 1 to 4 were #6663, #6669, #6682 and #6689.

What changed

Capability API 1.41 (file keys: section on abilities, skills and saves, and untrained on skills, saves and sections). None of it names one game's words.

  • Sections. Abilities, skills and saves may name one of sheet.sections, checked like the others. The sheet editor, the game's sheet (ability cards and trained chips) and the Game Master's sheet block group them under their headings, in the sheet's section order, then the ones with no section. A sheet that names no section on them prints exactly as before.
  • Untrained rules. untrained on a skill or save, or on the section it sits in (the entry's own rule wins). Untrained means the entry's tier is the first proficiency tier. A character with no sheet has no training to read, so no rule applies to them.
    • "normal": as today.
    • { "by": N } (-20 to 20): added to the check's number, dice on a pool and a flat amount on a sum, before any cap, so the sheet shows it and every check rolls it. Differs from the issue on purpose: the issue named this dice, but on a summed ruleset it is a flat number, and by is the word rests and track commands already use.
    • "harder": the per-die target goes up one (clamped to the target's range). Refused at import on a dice-sum ruleset or a pool whose target cannot move, since it could never change a roll.
    • "refuse": the check is not rolled. The engine writes the ask back with reason="untrained", which settles it: the client's fallback never rolls it, the skill-check endpoint answers 400 skill_check_untrained, and a one-request branch on it keeps neither half. The outcome narration is told the character could not attempt it (instead of "remain unresolved"), and the narration log shows "not attempted". The engine decides from the sheet either way: a reason the Game Master writes itself does not stop a roll, and no numbers, dice or difficulty it writes on a refused check get it past the refusal.
  • Branch checks (a fix found on the way). A one-request branch check dropped who=, with=, threshold= and bonus=, so it always rolled for the player with their default ability. It now carries them like any other check, so it rolls, or refuses untrained, for the member it names, and the record keeps whose check it was.
  • Reminder. The Game Master's check line lists the untrained rules in words, by section or by skill, and explains reason="untrained" when anything refuses.
  • Sheet editor. A skill that cannot be attempted untrained shows a dash instead of a number until it is trained. New strings are localized in en.json.
  • Install gate: each new key needs 1.41.
  • Docs: author guide (docs/extending/writing-rulesets.md), player page (docs/game/dice-and-skill-checks.md), the regenerated JSON Schema, the plan doc's slice 5 notes, CHANGELOG. Gravewatch puts its skills in Labour (untrained costs a die), The watch and Company, with Dig refused untrained and Listen one step harder; Ember Roads takes two off an untrained Tinker check.

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

Manual verification notes

Run by the agent on d84c00b58 (this branch's one commit on staging fe877afa0), all exit 0: pnpm check, pnpm localization:check, pnpm version:check, pnpm regression:node (399/399), pnpm ruleset:schema (no diff after regeneration), pnpm smoke:ui (7/7), and pnpm regression:ui e2e/ruleset-sheet-sections.e2e.ts e2e/ruleset-wound-sheet.e2e.ts e2e/game-combat-director.e2e.ts e2e/game-native-dice.e2e.ts e2e/game-one-request-dice.e2e.ts --project=desktop-chromium --workers=1 (14/14: the new sections case in light and dark, the wound sheet, the ruleset fights, and the two dice specs that pin the rewrite prompt). Mobile projects were not run locally. Local CodeRabbit, four completed passes (several more lost their connection and were re-run): nine findings, seven fixed, two declined. Fixed: a branch check carries who= and the rest (the lane case for it too); the rewrite prompt no longer says dice were rolled when none were; the general dice pass leaves a settled untrained ask alone (it was rewriting it without its reason and reporting it unresolved); the untrained refusal comes before the vouching audit, the rollability check and the difficulty read, so no record the Game Master writes gets past it; section groups have keys that cannot collide with the unsectioned group. Declined: clamping the harder target a second time (the roller already clamps it into the ruleset's range, and the lane asserts a target of 9 stays 9), and rewording ui.rulesets.sheet.untrainedRefusedFor (its {{name}} is the skill's label, so it reads "Dig cannot be attempted untrained", which the browser case checks).

  • New lane scripts/regressions/game-ruleset-sections.regression.ts covers every import refusal, section grouping (and the byte-identical output with none), each untrained rule on both kinds, the entry-over-section precedence, the stranger case, the content resolver's refusal and settled record, the endpoint's 400, the one-request branch, the narration counter, the reminder and the 1.41 gate. Twenty-five deliberate breaks were each caught, and each fix the review prompted adds a case that fails without it (a branch check for another member, a written record and an unreadable difficulty on a refused skill, the dice pass after a refusal).
  • New browser case e2e/ruleset-sheet-sections.e2e.ts renders the sheet editor for Gravewatch and Ember Roads and the game's sheet for a trained warden in light and dark: headings come before their skills in order, untrained Wrestle shows one die, Dig shows a dash, Ember Roads draws no heading and Tinker shows -2, and the trained chips sit under their headings.
  • Existing lanes that test an older gate strip the 1.41 keys, the dice-pool lane's Trained pin follows the grouped line, and gm-skill-check-resolution pins the settled-ask guard in the client fallback and the endpoint.

Still to verify by hand (not done by the agent):

  • In a Game Mode game on Gravewatch, open the ruleset sheet editor: confirm the skills sit under Labour, The watch and Company, untrained Wrestle shows one die, and Dig shows a dash, in light and dark mode and at mobile width.
  • In that game, have the Game Master ask for [skill_check: skill="Dig" dc="1"] for an untrained character: confirm nothing is rolled, the narration says they could not attempt it, and the narration log shows "Dig check: not attempted".
  • Train that character in Dig and ask again: confirm it rolls normally.
  • On Ember Roads, confirm an untrained Tinker check shows -2 on the sheet and rolls with it.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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 touched: docs/extending/writing-rulesets.md (not carried by docs-i18n), docs/game/dice-and-skill-checks.md (carried by docs-i18n), docs/extending/ruleset.schema.json, docs/examples/rulesets/gravewatch.json, docs/examples/rulesets/ember-roads.json, docs/development/game-rulesets-and-sheets-implementation.md (internal plan), CHANGELOG.md. Translations are batched into one later pass by the maintainer's standing decision, so no per-PR [docs-i18n] issue is opened here.

UI evidence (if applicable)

None attached. The new browser case saves a full-page screenshot of both sheet editors and the game's sheet in each theme; the manual steps above cover it at mobile width.

Summary by CodeRabbit

  • New Features
    • Ruleset sheets can organize abilities, skills, and saves into labeled sections, with entries that have no section remaining ungrouped.
    • Rulesets can configure untrained checks to apply a modifier, increase dice-pool difficulty, or refuse the check. Refused checks are not rolled and are clearly explained in the game narration.
    • One-request branch checks now account for the named character’s training when determining the outcome.
  • Documentation
    • Updated ruleset guidance and examples to cover sections, untrained-check rules, and compatibility requirements.

🔄 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/6704 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/26/2026 **Status:** ✅ Merged **Merged:** 9/26/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/ruleset-sections` --- ### 📝 Commits (2) - [`d84c00b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d84c00b581707dd7232eb277bae3db5139135180) feat(game): sections on abilities, skills and saves; untrained rules per skill or section - [`758352f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/758352fb86c3087e430c1ea6f3bd34123cdab378) test(game): pin the unsectioned sheet block byte for byte ### 📊 Changes **37 files changed** (+1371 additions, -150 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+30 -0) 📝 `docs/examples/rulesets/ember-roads.json` (+3 -1) 📝 `docs/examples/rulesets/gravewatch.json` (+30 -7) 📝 `docs/extending/ruleset.schema.json` (+96 -0) 📝 `docs/extending/writing-rulesets.md` (+21 -2) 📝 `docs/game/dice-and-skill-checks.md` (+1 -0) ➕ `e2e/ruleset-sheet-sections.e2e.ts` (+130 -0) 📝 `packages/client/src/components/game/GameNarration.tsx` (+9 -1) 📝 `packages/client/src/components/game/GameRulesetSheet.tsx` (+43 -27) 📝 `packages/client/src/components/game/GameSurface.tsx` (+2 -1) 📝 `packages/client/src/components/rulesets/RulesetSheetEditor.tsx` (+125 -71) 📝 `packages/client/src/localization/locales/en.json` (+3 -0) 📝 `packages/server/src/routes/game.routes.ts` (+11 -1) 📝 `packages/server/src/routes/generate.routes.ts` (+7 -2) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+25 -0) 📝 `packages/server/src/services/game/gm-prompts.ts` (+35 -0) 📝 `packages/server/src/services/game/one-request-dice.ts` (+40 -1) 📝 `packages/server/src/services/game/skill-check-resolution.service.ts` (+75 -5) 📝 `packages/shared/src/features/rulesets/sheet-math.ts` (+42 -2) _...and 17 more files_ </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #6655 ## Why this change The author of [Marinara-RPG-Extension](https://github.com/Kenhito/Marinara-RPG-Extension) wrote two of their shipped tabletop systems as `ruleset.json` files. Abilities, skills and saves printed as two flat lists, and every skill a character had no training in rolled the same way, which left two common rules unsayable: - **Sections on abilities, skills and saves.** Fields, derived values and lists could name a section; these three could not. In many systems the grouping is a rule and not only a layout: the untrained rule or its penalty differs by category, and some categories cost less to raise. - **Untrained rules per skill or category.** Every untrained skill rolled the ability alone. Systems in the report make an untrained skill one step harder, take dice off by category, or forbid rolling an untrained skill of one kind at all. The report's files carried this as guidance text per skill, which the model does not reliably follow. This is slice 5 of the series in the plan doc (§ Gaps a ruleset author found). Slices 1 to 4 were #6663, #6669, #6682 and #6689. ## What changed Capability API **1.41** (file keys: `section` on abilities, skills and saves, and `untrained` on skills, saves and sections). None of it names one game's words. - **Sections.** Abilities, skills and saves may name one of `sheet.sections`, checked like the others. The sheet editor, the game's sheet (ability cards and trained chips) and the Game Master's sheet block group them under their headings, in the sheet's section order, then the ones with no section. A sheet that names no section on them prints exactly as before. - **Untrained rules.** `untrained` on a skill or save, or on the section it sits in (the entry's own rule wins). Untrained means the entry's tier is the first proficiency tier. A character with no sheet has no training to read, so no rule applies to them. - `"normal"`: as today. - `{ "by": N }` (-20 to 20): added to the check's number, dice on a pool and a flat amount on a sum, before any `cap`, so the sheet shows it and every check rolls it. **Differs from the issue on purpose:** the issue named this `dice`, but on a summed ruleset it is a flat number, and `by` is the word rests and track commands already use. - `"harder"`: the per-die target goes up one (clamped to the target's range). Refused at import on a dice-sum ruleset or a pool whose target cannot move, since it could never change a roll. - `"refuse"`: the check is not rolled. The engine writes the ask back with `reason="untrained"`, which settles it: the client's fallback never rolls it, the skill-check endpoint answers 400 `skill_check_untrained`, and a one-request branch on it keeps neither half. The outcome narration is told the character could not attempt it (instead of "remain unresolved"), and the narration log shows "not attempted". The engine decides from the sheet either way: a `reason` the Game Master writes itself does not stop a roll, and no numbers, dice or difficulty it writes on a refused check get it past the refusal. - **Branch checks (a fix found on the way).** A one-request branch check dropped `who=`, `with=`, `threshold=` and `bonus=`, so it always rolled for the player with their default ability. It now carries them like any other check, so it rolls, or refuses untrained, for the member it names, and the record keeps whose check it was. - **Reminder.** The Game Master's check line lists the untrained rules in words, by section or by skill, and explains `reason="untrained"` when anything refuses. - **Sheet editor.** A skill that cannot be attempted untrained shows a dash instead of a number until it is trained. New strings are localized in `en.json`. - **Install gate:** each new key needs 1.41. - **Docs:** author guide (`docs/extending/writing-rulesets.md`), player page (`docs/game/dice-and-skill-checks.md`), the regenerated JSON Schema, the plan doc's slice 5 notes, CHANGELOG. **Gravewatch** puts its skills in Labour (untrained costs a die), The watch and Company, with Dig refused untrained and Listen one step harder; **Ember Roads** takes two off an untrained Tinker check. ## 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` ### Manual verification notes Run by the agent on d84c00b58 (this branch's one commit on staging fe877afa0), all exit 0: `pnpm check`, `pnpm localization:check`, `pnpm version:check`, `pnpm regression:node` (399/399), `pnpm ruleset:schema` (no diff after regeneration), `pnpm smoke:ui` (7/7), and `pnpm regression:ui e2e/ruleset-sheet-sections.e2e.ts e2e/ruleset-wound-sheet.e2e.ts e2e/game-combat-director.e2e.ts e2e/game-native-dice.e2e.ts e2e/game-one-request-dice.e2e.ts --project=desktop-chromium --workers=1` (14/14: the new sections case in light and dark, the wound sheet, the ruleset fights, and the two dice specs that pin the rewrite prompt). Mobile projects were not run locally. Local CodeRabbit, four completed passes (several more lost their connection and were re-run): nine findings, seven fixed, two declined. Fixed: a branch check carries `who=` and the rest (the lane case for it too); the rewrite prompt no longer says dice were rolled when none were; the general dice pass leaves a settled untrained ask alone (it was rewriting it without its reason and reporting it unresolved); the untrained refusal comes before the vouching audit, the rollability check and the difficulty read, so no record the Game Master writes gets past it; section groups have keys that cannot collide with the unsectioned group. Declined: clamping the harder target a second time (the roller already clamps it into the ruleset's range, and the lane asserts a target of 9 stays 9), and rewording `ui.rulesets.sheet.untrainedRefusedFor` (its `{{name}}` is the skill's label, so it reads "Dig cannot be attempted untrained", which the browser case checks). - New lane `scripts/regressions/game-ruleset-sections.regression.ts` covers every import refusal, section grouping (and the byte-identical output with none), each untrained rule on both kinds, the entry-over-section precedence, the stranger case, the content resolver's refusal and settled record, the endpoint's 400, the one-request branch, the narration counter, the reminder and the 1.41 gate. Twenty-five deliberate breaks were each caught, and each fix the review prompted adds a case that fails without it (a branch check for another member, a written record and an unreadable difficulty on a refused skill, the dice pass after a refusal). - New browser case `e2e/ruleset-sheet-sections.e2e.ts` renders the sheet editor for Gravewatch and Ember Roads and the game's sheet for a trained warden in light and dark: headings come before their skills in order, untrained Wrestle shows one die, Dig shows a dash, Ember Roads draws no heading and Tinker shows -2, and the trained chips sit under their headings. - Existing lanes that test an older gate strip the 1.41 keys, the dice-pool lane's Trained pin follows the grouped line, and `gm-skill-check-resolution` pins the settled-ask guard in the client fallback and the endpoint. Still to verify by hand (not done by the agent): - In a Game Mode game on Gravewatch, open the ruleset sheet editor: confirm the skills sit under Labour, The watch and Company, untrained Wrestle shows one die, and Dig shows a dash, in light and dark mode and at mobile width. - In that game, have the Game Master ask for `[skill_check: skill="Dig" dc="1"]` for an untrained character: confirm nothing is rolled, the narration says they could not attempt it, and the narration log shows "Dig check: not attempted". - Train that character in Dig and ask again: confirm it rolls normally. - On Ember Roads, confirm an untrained Tinker check shows -2 on the sheet and rolls with it. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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 touched: `docs/extending/writing-rulesets.md` (not carried by `docs-i18n`), `docs/game/dice-and-skill-checks.md` (carried by `docs-i18n`), `docs/extending/ruleset.schema.json`, `docs/examples/rulesets/gravewatch.json`, `docs/examples/rulesets/ember-roads.json`, `docs/development/game-rulesets-and-sheets-implementation.md` (internal plan), `CHANGELOG.md`. Translations are batched into one later pass by the maintainer's standing decision, so no per-PR `[docs-i18n]` issue is opened here. ## UI evidence (if applicable) None attached. The new browser case saves a full-page screenshot of both sheet editors and the game's sheet in each theme; the manual steps above cover it at mobile width. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Ruleset sheets can organize abilities, skills, and saves into labeled sections, with entries that have no section remaining ungrouped. * Rulesets can configure untrained checks to apply a modifier, increase dice-pool difficulty, or refuse the check. Refused checks are not rolled and are clearly explained in the game narration. * One-request branch checks now account for the named character’s training when determining the outcome. * **Documentation** * Updated ruleset guidance and examples to cover sections, untrained-check rules, and compatibility requirements. <!-- 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-23 04:18:21 +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#7293
No description provided.