[PR #6827] [MERGED] feat(rulesets): let a ruleset's sheet read the items a character holds (#6826) #7348

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

📋 Pull Request Information

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

Base: staging ← Head: feat/ruleset-items-sheet


📝 Commits (2)

  • 42d41b0 feat(rulesets): let a ruleset's sheet read the items a character holds (#6826)
  • 68762db fix(rulesets): count an item whose stat is 0 as giving it, like the other picks (#6826)

📊 Changes

35 files changed (+2654 additions, -47 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+34 -0)
📝 docs/examples/rulesets/ember-roads.json (+9 -2)
📝 docs/extending/ruleset.schema.json (+1540 -10)
📝 docs/extending/writing-rulesets.md (+27 -3)
📝 e2e/game-ruleset-wearing.e2e.ts (+85 -1)
📝 packages/client/src/components/game/GameCharacterSheet.tsx (+4 -0)
📝 packages/client/src/components/game/GameRulesetSheet.tsx (+11 -2)
📝 packages/client/src/components/game/GameSurface.tsx (+17 -0)
📝 packages/client/src/components/rulesets/RulesetSheetEditor.tsx (+9 -1)
📝 packages/server/src/routes/combat-director.routes.ts (+17 -0)
📝 packages/server/src/routes/generate.routes.ts (+7 -0)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+22 -0)
📝 packages/server/src/services/game/ruleset-combat-director.service.ts (+4 -0)
📝 packages/server/src/services/game/ruleset-sheet-turn.service.ts (+25 -3)
📝 packages/server/src/services/game/skill-check-resolution.service.ts (+26 -1)
📝 packages/shared/src/features/ruleset-combat/encounter.ts (+13 -4)
📝 packages/shared/src/features/ruleset-combat/types.ts (+10 -1)
📝 packages/shared/src/features/rulesets/item-book.ts (+46 -1)
📝 packages/shared/src/features/rulesets/live-state.ts (+7 -1)

...and 15 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 #6826

Why this change

  • A ruleset's items could be worn, bound and carried (#6810), but nothing on the sheet could read them. Armor did not change a defense, and a ruleset had no way to say that it should. This is slice I4-1 of the ruleset items plan: the sheet learns what a character holds, so the later slices (worn and carried effects on checks, requirements, encumbrance levels) have something to build on.

What changed

  • A new value reference, itemStat (Capability API 1.52): a stat over the items a character wears (worn), only carries (carried) or both (all), read as a sum (value times how many), the highest (max), the lowest (min) or a count, optionally only one slot, category or tag, with a default when nothing is picked. Worn means on, and bound where the item must be.
  • Checked at import. It needs the items block, names only the ruleset's own stat, slot, category and tag, reads only a number stat unless it counts, and names a stat unless it counts. Items change in play, so it is refused wherever a live read is refused (pool and track maximums, the proficiency bonus, binding.max, the carry numbers, scaled columns and scaling), directly or through a derived value. The install gate asks for 1.52, in the ruleset file and in catalog files. The published JSON schema is regenerated.
  • Every in-game sheet reads it. The player's card reads the player's bag and every other card its own (the same rule carrying and binding already use). The sheet on screen and its editor, a check, the Game Master's sheet block, and a ruleset fight as it starts all pass the holder's items; a fight keeps what each fighter held for anything it works out again, such as initiative thrown every round. The inventory and item catalogs are only read when the ruleset has an itemStat anywhere. Outside a game nothing is held.
  • Ember Roads now adds the guard of worn armor to Guard (so a worn leather coat makes a traveller harder to hit), and its Game Master summary shows Guard. Lanes that model an older Engine strip that read along with the items block.
  • Docs: itemStat and a new "Items on the sheet" section in docs/extending/writing-rulesets.md, the 1.52 record in docs/development/game-rulesets-and-sheets-implementation.md, and a CHANGELOG entry.

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 this branch at 42d41b0c3 (one commit on staging e28e80d14):

  • pnpm check exits 0 and pnpm localization:check exits 0.
  • pnpm regression passes 442/442, and pnpm smoke:ui passes 7/7.
  • The ruleset and inventory specs (e2e/game-ruleset-*.e2e.ts, e2e/ruleset-*.e2e.ts, e2e/game-inventory-*.e2e.ts) pass 13/13 on --project=desktop-chromium. On --project=mobile-chromium the new sheet test first failed (on a phone Bram's portrait is inside the party members menu); after that locator fix the game ruleset specs pass 4/4 there, the wearing spec passes 2/2 on desktop again, and pnpm check:e2e-types passes.

Lanes:

  • New game-ruleset-item-stats.regression.ts: every import refusal (no items block, unknown stat, slot, category or tag, a non-number stat read as a number, a sum with no stat) and every live-refused place (pool and track maximums, the carry limit, the carry line through Guard); the 1.52 install gate in the ruleset file, in a check modifier and in a catalog file; every pick and filter with quantities and defaults; worn by slots and binding; each card's own bag and the player's card rule; a fight's initiative worked out again from what was held; and, through the real services and routes, a check's sheets, the Game Master's sheet block, and a ruleset fight started with the player's worn coat (defense 7) beside Bram's packed one (6).
  • game-inventory-turn.regression.ts: on a real Game Master turn, the prompt's sheet block shows Guard 7 for the player wearing the coat and 6 for Bram.
  • e2e/game-ruleset-wearing.e2e.ts (desktop and phone): Bram's in-game sheet shows Guard 6 with his coat in the pack, and 7 after it is put on with Equipped in the inventory.
  • Lanes that model an older Engine strip Ember Roads' new read along with the items block.

Forty deliberate breaks, in the reader, the worn rule, whose bag, every import check, the install gate, the check loader, the sheet block, the generate route, the fight seed, route and start, the live evaluation, the prompt renderer and the two screens, were each caught.

Local CodeRabbit (coderabbit review --agent --base staging): one pass, no findings.

Game Master turns on a real local model (Gemma 4 E4B, Q8, through llama.cpp) on an isolated Engine from this branch, in Ember Roads with the player wearing a leather coat and Bram carrying his in the pack, 3 tellings of an out-of-character question about the party's Guard: all 3 answered Ada 7 and Bram 6, from the sheet block. None named the coat as the reason; the inventory block says it is worn, and the sheet block gives only the number.

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 and docs/development/game-rulesets-and-sheets-implementation.md (both carried by docs-i18n), CHANGELOG.md, the generated docs/extending/ruleset.schema.json and the Ember Roads example. Translations: #6813 is the items arc's follow-up; this PR is added to it there.

UI evidence (if applicable)

The in-game sheet shows Guard 6 for a character whose leather coat is in the pack, and 7 once it is worn (captured by the e2e run as ruleset-sheet-worn-guard.png).

Summary by CodeRabbit

  • New Features
    • Rulesets can calculate values from worn, carried, or all held items, using sums, maximums, minimums, or counts with optional filters for slot, category, and tag.
    • Item-based values are reflected on character sheets and used in skill checks, Game Master summaries, and ruleset combat.
    • Capability API 1.52 supports item-based ruleset values.
  • Documentation
    • Updated ruleset guides and examples to explain item-based values, including how worn armor affects Guard.

🔄 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/6827 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/28/2026 **Status:** ✅ Merged **Merged:** 9/29/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/ruleset-items-sheet` --- ### 📝 Commits (2) - [`42d41b0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/42d41b0c338ef3c150a29dae22af2a9991a39a21) feat(rulesets): let a ruleset's sheet read the items a character holds (#6826) - [`68762db`](https://github.com/Pasta-Devs/Marinara-Engine/commit/68762db5be9821a0ed5a1dddd4d7cbfa050cb017) fix(rulesets): count an item whose stat is 0 as giving it, like the other picks (#6826) ### 📊 Changes **35 files changed** (+2654 additions, -47 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+34 -0) 📝 `docs/examples/rulesets/ember-roads.json` (+9 -2) 📝 `docs/extending/ruleset.schema.json` (+1540 -10) 📝 `docs/extending/writing-rulesets.md` (+27 -3) 📝 `e2e/game-ruleset-wearing.e2e.ts` (+85 -1) 📝 `packages/client/src/components/game/GameCharacterSheet.tsx` (+4 -0) 📝 `packages/client/src/components/game/GameRulesetSheet.tsx` (+11 -2) 📝 `packages/client/src/components/game/GameSurface.tsx` (+17 -0) 📝 `packages/client/src/components/rulesets/RulesetSheetEditor.tsx` (+9 -1) 📝 `packages/server/src/routes/combat-director.routes.ts` (+17 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+7 -0) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+22 -0) 📝 `packages/server/src/services/game/ruleset-combat-director.service.ts` (+4 -0) 📝 `packages/server/src/services/game/ruleset-sheet-turn.service.ts` (+25 -3) 📝 `packages/server/src/services/game/skill-check-resolution.service.ts` (+26 -1) 📝 `packages/shared/src/features/ruleset-combat/encounter.ts` (+13 -4) 📝 `packages/shared/src/features/ruleset-combat/types.ts` (+10 -1) 📝 `packages/shared/src/features/rulesets/item-book.ts` (+46 -1) 📝 `packages/shared/src/features/rulesets/live-state.ts` (+7 -1) _...and 15 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 #6826 ## Why this change - A ruleset's items could be worn, bound and carried (#6810), but nothing on the sheet could read them. Armor did not change a defense, and a ruleset had no way to say that it should. This is slice I4-1 of the ruleset items plan: the sheet learns what a character holds, so the later slices (worn and carried effects on checks, requirements, encumbrance levels) have something to build on. ## What changed - **A new value reference, `itemStat`** (Capability API 1.52): a stat over the items a character wears (`worn`), only carries (`carried`) or both (`all`), read as a `sum` (value times how many), the highest (`max`), the lowest (`min`) or a `count`, optionally only one `slot`, `category` or `tag`, with a `default` when nothing is picked. Worn means on, and bound where the item must be. - **Checked at import.** It needs the items block, names only the ruleset's own stat, slot, category and tag, reads only a number stat unless it counts, and names a stat unless it counts. Items change in play, so it is refused wherever a live read is refused (pool and track maximums, the proficiency bonus, `binding.max`, the carry numbers, scaled columns and scaling), directly or through a derived value. The install gate asks for 1.52, in the ruleset file and in catalog files. The published JSON schema is regenerated. - **Every in-game sheet reads it.** The player's card reads the player's bag and every other card its own (the same rule carrying and binding already use). The sheet on screen and its editor, a check, the Game Master's sheet block, and a ruleset fight as it starts all pass the holder's items; a fight keeps what each fighter held for anything it works out again, such as initiative thrown every round. The inventory and item catalogs are only read when the ruleset has an `itemStat` anywhere. Outside a game nothing is held. - **Ember Roads** now adds the guard of worn armor to Guard (so a worn leather coat makes a traveller harder to hit), and its Game Master summary shows Guard. Lanes that model an older Engine strip that read along with the items block. - **Docs:** `itemStat` and a new "Items on the sheet" section in `docs/extending/writing-rulesets.md`, the 1.52 record in `docs/development/game-rulesets-and-sheets-implementation.md`, and a CHANGELOG entry. ## 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 this branch at 42d41b0c3 (one commit on staging e28e80d14): - `pnpm check` exits 0 and `pnpm localization:check` exits 0. - `pnpm regression` passes 442/442, and `pnpm smoke:ui` passes 7/7. - The ruleset and inventory specs (`e2e/game-ruleset-*.e2e.ts`, `e2e/ruleset-*.e2e.ts`, `e2e/game-inventory-*.e2e.ts`) pass 13/13 on `--project=desktop-chromium`. On `--project=mobile-chromium` the new sheet test first failed (on a phone Bram's portrait is inside the party members menu); after that locator fix the game ruleset specs pass 4/4 there, the wearing spec passes 2/2 on desktop again, and `pnpm check:e2e-types` passes. Lanes: - New `game-ruleset-item-stats.regression.ts`: every import refusal (no items block, unknown stat, slot, category or tag, a non-number stat read as a number, a sum with no stat) and every live-refused place (pool and track maximums, the carry limit, the carry line through Guard); the 1.52 install gate in the ruleset file, in a check modifier and in a catalog file; every pick and filter with quantities and defaults; worn by slots and binding; each card's own bag and the player's card rule; a fight's initiative worked out again from what was held; and, through the real services and routes, a check's sheets, the Game Master's sheet block, and a ruleset fight started with the player's worn coat (defense 7) beside Bram's packed one (6). - `game-inventory-turn.regression.ts`: on a real Game Master turn, the prompt's sheet block shows Guard 7 for the player wearing the coat and 6 for Bram. - `e2e/game-ruleset-wearing.e2e.ts` (desktop and phone): Bram's in-game sheet shows Guard 6 with his coat in the pack, and 7 after it is put on with **Equipped** in the inventory. - Lanes that model an older Engine strip Ember Roads' new read along with the items block. Forty deliberate breaks, in the reader, the worn rule, whose bag, every import check, the install gate, the check loader, the sheet block, the generate route, the fight seed, route and start, the live evaluation, the prompt renderer and the two screens, were each caught. Local CodeRabbit (`coderabbit review --agent --base staging`): one pass, no findings. Game Master turns on a real local model (Gemma 4 E4B, Q8, through llama.cpp) on an isolated Engine from this branch, in Ember Roads with the player wearing a leather coat and Bram carrying his in the pack, 3 tellings of an out-of-character question about the party's Guard: all 3 answered Ada 7 and Bram 6, from the sheet block. None named the coat as the reason; the inventory block says it is worn, and the sheet block gives only the number. ## 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` and `docs/development/game-rulesets-and-sheets-implementation.md` (both carried by `docs-i18n`), `CHANGELOG.md`, the generated `docs/extending/ruleset.schema.json` and the Ember Roads example. Translations: #6813 is the items arc's follow-up; this PR is added to it there. ## UI evidence (if applicable) The in-game sheet shows Guard 6 for a character whose leather coat is in the pack, and 7 once it is worn (captured by the e2e run as `ruleset-sheet-worn-guard.png`). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Rulesets can calculate values from worn, carried, or all held items, using sums, maximums, minimums, or counts with optional filters for slot, category, and tag. * Item-based values are reflected on character sheets and used in skill checks, Game Master summaries, and ruleset combat. * Capability API 1.52 supports item-based ruleset values. * **Documentation** * Updated ruleset guides and examples to explain item-based values, including how worn armor affects Guard. <!-- 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:53 +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#7348
No description provided.