[PR #6838] [MERGED] feat(rulesets): conditions and worn or carried items change checks outside a fight (#6832) #7350

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/6838
Author: @kolacheee
Created: 9/29/2026
Status: ✅ Merged
Merged: 9/29/2026
Merged by: @kolacheee

Base: staging ← Head: feat/ruleset-items-worn-effects


📝 Commits (4)

  • 0ba6bd3 feat(rulesets): conditions and worn or carried items change checks outside a fight (#6832)
  • 7bd884a fix(rulesets): editors read the new modifier rules, and a claimed no-roll failure is never trusted (#6832)
  • d7a0247 Merge remote-tracking branch 'origin/staging' into feat/ruleset-items-worn-effects
  • de6a681 test(rulesets): a mode alone is a modifier in the published schema (#6832)

📊 Changes

37 files changed (+3070 additions, -112 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+46 -0)
📝 docs/examples/rulesets/ember-roads.json (+14 -8)
📝 docs/examples/rulesets/gravewatch.json (+9 -2)
📝 docs/extending/ruleset.schema.json (+985 -0)
📝 docs/extending/writing-rulesets.md (+60 -8)
➕ e2e/game-ruleset-check-effects.e2e.ts (+152 -0)
📝 packages/client/src/components/dice/AnimatedSkillCheckResult.tsx (+26 -0)
📝 packages/client/src/components/game/GameInventory.tsx (+6 -1)
📝 packages/client/src/components/game/RulesetItemPicker.tsx (+41 -0)
📝 packages/client/src/localization/locales/en.json (+13 -0)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+40 -0)
📝 packages/server/src/services/game/gm-prompts.ts (+44 -3)
📝 packages/server/src/services/game/skill-check-resolution.service.ts (+133 -19)
📝 packages/shared/src/features/ruleset-combat/encounter.ts (+35 -10)
➕ packages/shared/src/features/rulesets/check-effects.ts (+155 -0)
📝 packages/shared/src/features/rulesets/invented-items.ts (+130 -0)
📝 packages/shared/src/features/rulesets/item-book.ts (+59 -2)
📝 packages/shared/src/features/rulesets/sheet-math.ts (+2 -0)
📝 packages/shared/src/index.ts (+1 -0)

...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 #6832

This branch carries #6836 (closes #6835) as its first commit, because the checks it changes never survived a real turn in a 2d6 or pool ruleset without it. Review and merge #6836 first; this PR's own change starts at the second commit.

Why this change

  • A check outside a fight read only the sheet. A poisoned or frightened character rolled like a healthy one even where the ruleset says those conditions give disadvantage on checks, and a paralyzed one rolled the saves the ruleset says they fail. Items could be worn, bound and carried, but none could say "disadvantage on Stealth while wearing this" or "a kit that helps one kind of check", so the Game Master had to remember all of it. This is slice I4-2 of the ruleset items plan.

What changed

  • Items say what they do (Capability API 1.53): worn (while on, and bound where it binds) and carried (while only carried), in the condition vocabulary a check reads: the check and save effects, modifiers to checks or saves (flat, dice, a mode), saves failed without a roll, and skills/saves narrowing. What an item does in a fight waits for the weapons-and-armor slice and is refused for now.
  • Narrowing and modes. A condition or a level may narrow its check effects to some skills; a modifier may name its own skills or saves and roll twice with mode, so one source can make Sneak harder and Climb easier. rarityCaps[].bonus holds an invented item's worn or carried bonus. Every named skill and save is checked at import, and the install gate asks for 1.53 in the ruleset file and catalog files.
  • Checks outside a fight read the roller's active conditions, reached levels, and worn and carried items (each item once): numbers are added like resolution.adjust (dice rolled; dice on a pool), advantage and disadvantage cancel with the Game Master's mode= where the ruleset rolls twice, and a save something fails is failed without a roll or a spend. The record gains effects=, from= and automatic="true", read back after a reload; a Game Master's own numbers are never vouched for on a check something changes; the sighted pool spends a second d20 when the effects lean the roll.
  • Fights keep anything narrowed to skills out of contests, count a modifier's mode like the effect, and narrow save modifiers by their own saves.
  • Seen and said. The dice card shows "Conditions and items: -1 to this roll" and "Changed by Leather coat". An item's details and the picker say "While worn: -1 on checks (Sneak)"; the Game Master's inventory line says the same. The check line tells the Game Master the Engine applies conditions and worn or carried items, so it does not add them again.
  • Invented items take worn= and carried= ("+1 Sneak; disadvantage on Sway checks", "fails saves", "none"), read against the sheet's skills and saves, copied from like= otherwise, and held to the rarity's bonus (a bonus in dice is left out at a capped rarity; a penalty is never capped). The proposal form shows the sheet's skills and saves and each rarity's bonus.
  • Examples. Ember Roads: the leather coat costs Sneak 1 while worn, a carried waystone helps Sway, and rarity bonuses of 1, 1 and 2. Gravewatch: the bound Dawn bell adds a die to Ward, and Rattled takes one off Soothe and Barter.
  • Docs: a "Checks outside a fight" section and the new keys in docs/extending/writing-rulesets.md, the 1.53 record in docs/development/game-rulesets-and-sheets-implementation.md, the regenerated JSON schema, 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 0ba6bd3c0 (two commits on staging 6d3022d56: #6836's fix, then this change):

  • pnpm check exits 0 and pnpm localization:check exits 0.
  • pnpm regression passes 443/443, and pnpm smoke:ui passes 7/7.
  • On --project=desktop-chromium, the ruleset, inventory and game dice specs (e2e/game-ruleset-*.e2e.ts, e2e/ruleset-*.e2e.ts, e2e/game-inventory-*.e2e.ts, e2e/game-native-dice.e2e.ts, e2e/game-one-request-dice.e2e.ts) pass 19/19; the game ruleset specs pass 5/5 on --project=mobile-chromium.
  • These ran before the last change, a wording fix to the Game Master's proposal form made after the real-model run below. After it, the four lanes that read that text (game-ruleset-invented-items, game-ruleset-check-effects, game-inventory-turn, game-ruleset-items), the server type check and Prettier passed again, and so did a second CodeRabbit pass.

Lanes:

  • New game-ruleset-check-effects.regression.ts: every refusal of the new keys and the 1.53 gate (in the ruleset file, each key on its own, and in a catalog file); sources (conditions while active, levels while reached, worn while worn, carried while only carried, one item once) and narrowing (a modifier's own skills, its source's, abilities, unknown checks, saves); leans cancelling with mode=; dice and minus; checks and saves through the turn's resolver on the 5e example (Poisoned disadvantage, cancelled by the Game Master's advantage, Paralyzed failing a Dexterity save without a roll, read back after a reload), Ember Roads (coat -1 on Sneak, waystone +1 on Sway, nothing on Tinker, a Game Master's own record vouched only when nothing changes the check) and Gravewatch (the bound bell's die on Ward, Rattled's on Soothe), plus Gravewatch through the real context loader; fights (skill-narrowed parts out of contests, modes and a modifier's saves counted); item facts; invented items (bonus caps, dice left out, like=, none, unknown names, the tag, read-back); and the Game Master's line for each example.
  • game-inventory-turn.regression.ts: a real Game Master turn in an Ember Roads game saves the Sneak check with effects="-1" from="Leather coat".
  • e2e/game-ruleset-check-effects.e2e.ts (desktop and phone): the coat's details say "While worn: -1 on checks (Sneak)", and the dice card of a real turn's Sneak check shows the -1 and "Changed by Leather coat".
  • Lanes that pin the prompt text, the 1.52 gates or the examples were brought up to date.

Sixty deliberate breaks, across the format, the gate, the sources, narrowing, the resolver, the record and its read-back, fights, item facts, invented items, the Game Master's line and the two screens, were each caught (four only after the lane gained the assertions they showed were missing).

Local CodeRabbit (coderabbit review --agent --base staging): two passes, 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 the coat and carrying a waystone:

  • Sneaking past guards, 3 tellings: 2 called for Sneak and both were rolled with effects="-1" from="Leather coat"; the third wrote a malformed tag the Engine left alone, as it always has. One narration even had the coat snag.
  • Haggling with a trader, 3 tellings: 1 called for Sway, rolled with effects="+1" from="Waystone".
  • Buying boots "that give +1 to Sneak": at first the model put the bonus in stats=, then copied the form's example skill. The form now says a skill or save bonus goes in worn or carried, never in stats, and its example names no real skill; after that, 3 of 3 tellings on a fresh game invented the boots with worn: +1 on checks (Sneak). With no effect stated (a lucky charm), it invents the item without one, which is fine.

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 two example rulesets. Translations: #6813 is the items arc's follow-up; this PR is added to it there.

UI evidence (if applicable)

The dice card of a real turn's Sneak check in an Ember Roads game with the coat worn shows "Conditions and items: -1 to this roll" and "Changed by Leather coat" (5 + 5 - 1 = 9), and the coat's details say "While worn: -1 on checks (Sneak)" (captured by e2e/game-ruleset-check-effects.e2e.ts as ruleset-check-effects-card.png, desktop and phone).

Summary by CodeRabbit

  • New Features

    • Outside combat, supported checks and saves can now reflect active conditions, track levels, and worn or carried item effects—including bonuses, penalties, advantage or disadvantage, and automatic save failures.
    • Roll results show effect amounts and their sources; inventory item details describe worn and carried effects.
    • Invented-item bonuses can be limited by rarity.
  • Compatibility

    • Rulesets using these effects require Capability API 1.53 or later.

🔄 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/6838 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/29/2026 **Status:** ✅ Merged **Merged:** 9/29/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/ruleset-items-worn-effects` --- ### 📝 Commits (4) - [`0ba6bd3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0ba6bd3c07d6f5ed40905cb4c4ded28aa5e377d9) feat(rulesets): conditions and worn or carried items change checks outside a fight (#6832) - [`7bd884a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7bd884a83df4039b53bcac768e39251344f72413) fix(rulesets): editors read the new modifier rules, and a claimed no-roll failure is never trusted (#6832) - [`d7a0247`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d7a024706d6906617cbb2ba2270044dc367c3dd9) Merge remote-tracking branch 'origin/staging' into feat/ruleset-items-worn-effects - [`de6a681`](https://github.com/Pasta-Devs/Marinara-Engine/commit/de6a681e472b6525f4706db59331f4ab5a9b5081) test(rulesets): a mode alone is a modifier in the published schema (#6832) ### 📊 Changes **37 files changed** (+3070 additions, -112 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+46 -0) 📝 `docs/examples/rulesets/ember-roads.json` (+14 -8) 📝 `docs/examples/rulesets/gravewatch.json` (+9 -2) 📝 `docs/extending/ruleset.schema.json` (+985 -0) 📝 `docs/extending/writing-rulesets.md` (+60 -8) ➕ `e2e/game-ruleset-check-effects.e2e.ts` (+152 -0) 📝 `packages/client/src/components/dice/AnimatedSkillCheckResult.tsx` (+26 -0) 📝 `packages/client/src/components/game/GameInventory.tsx` (+6 -1) 📝 `packages/client/src/components/game/RulesetItemPicker.tsx` (+41 -0) 📝 `packages/client/src/localization/locales/en.json` (+13 -0) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+40 -0) 📝 `packages/server/src/services/game/gm-prompts.ts` (+44 -3) 📝 `packages/server/src/services/game/skill-check-resolution.service.ts` (+133 -19) 📝 `packages/shared/src/features/ruleset-combat/encounter.ts` (+35 -10) ➕ `packages/shared/src/features/rulesets/check-effects.ts` (+155 -0) 📝 `packages/shared/src/features/rulesets/invented-items.ts` (+130 -0) 📝 `packages/shared/src/features/rulesets/item-book.ts` (+59 -2) 📝 `packages/shared/src/features/rulesets/sheet-math.ts` (+2 -0) 📝 `packages/shared/src/index.ts` (+1 -0) _...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 #6832 This branch carries #6836 (closes #6835) as its first commit, because the checks it changes never survived a real turn in a 2d6 or pool ruleset without it. Review and merge #6836 first; this PR's own change starts at the second commit. ## Why this change - A check outside a fight read only the sheet. A poisoned or frightened character rolled like a healthy one even where the ruleset says those conditions give disadvantage on checks, and a paralyzed one rolled the saves the ruleset says they fail. Items could be worn, bound and carried, but none could say "disadvantage on Stealth while wearing this" or "a kit that helps one kind of check", so the Game Master had to remember all of it. This is slice I4-2 of the ruleset items plan. ## What changed - **Items say what they do** (Capability API 1.53): `worn` (while on, and bound where it binds) and `carried` (while only carried), in the condition vocabulary a check reads: the check and save effects, modifiers to checks or saves (flat, dice, a mode), saves failed without a roll, and `skills`/`saves` narrowing. What an item does in a fight waits for the weapons-and-armor slice and is refused for now. - **Narrowing and modes.** A condition or a level may narrow its check effects to some `skills`; a modifier may name its own `skills` or `saves` and roll twice with `mode`, so one source can make Sneak harder and Climb easier. `rarityCaps[].bonus` holds an invented item's worn or carried bonus. Every named skill and save is checked at import, and the install gate asks for 1.53 in the ruleset file and catalog files. - **Checks outside a fight** read the roller's active conditions, reached levels, and worn and carried items (each item once): numbers are added like `resolution.adjust` (dice rolled; dice on a pool), advantage and disadvantage cancel with the Game Master's `mode=` where the ruleset rolls twice, and a save something fails is failed without a roll or a spend. The record gains `effects=`, `from=` and `automatic="true"`, read back after a reload; a Game Master's own numbers are never vouched for on a check something changes; the sighted pool spends a second d20 when the effects lean the roll. - **Fights** keep anything narrowed to skills out of contests, count a modifier's mode like the effect, and narrow save modifiers by their own saves. - **Seen and said.** The dice card shows "Conditions and items: -1 to this roll" and "Changed by Leather coat". An item's details and the picker say "While worn: -1 on checks (Sneak)"; the Game Master's inventory line says the same. The check line tells the Game Master the Engine applies conditions and worn or carried items, so it does not add them again. - **Invented items** take `worn=` and `carried=` ("+1 Sneak; disadvantage on Sway checks", "fails saves", "none"), read against the sheet's skills and saves, copied from `like=` otherwise, and held to the rarity's `bonus` (a bonus in dice is left out at a capped rarity; a penalty is never capped). The proposal form shows the sheet's skills and saves and each rarity's bonus. - **Examples.** Ember Roads: the leather coat costs Sneak 1 while worn, a carried waystone helps Sway, and rarity bonuses of 1, 1 and 2. Gravewatch: the bound Dawn bell adds a die to Ward, and Rattled takes one off Soothe and Barter. - **Docs:** a "Checks outside a fight" section and the new keys in `docs/extending/writing-rulesets.md`, the 1.53 record in `docs/development/game-rulesets-and-sheets-implementation.md`, the regenerated JSON schema, 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 0ba6bd3c0 (two commits on staging 6d3022d56: #6836's fix, then this change): - `pnpm check` exits 0 and `pnpm localization:check` exits 0. - `pnpm regression` passes 443/443, and `pnpm smoke:ui` passes 7/7. - On `--project=desktop-chromium`, the ruleset, inventory and game dice specs (`e2e/game-ruleset-*.e2e.ts`, `e2e/ruleset-*.e2e.ts`, `e2e/game-inventory-*.e2e.ts`, `e2e/game-native-dice.e2e.ts`, `e2e/game-one-request-dice.e2e.ts`) pass 19/19; the game ruleset specs pass 5/5 on `--project=mobile-chromium`. - These ran before the last change, a wording fix to the Game Master's proposal form made after the real-model run below. After it, the four lanes that read that text (`game-ruleset-invented-items`, `game-ruleset-check-effects`, `game-inventory-turn`, `game-ruleset-items`), the server type check and Prettier passed again, and so did a second CodeRabbit pass. Lanes: - New `game-ruleset-check-effects.regression.ts`: every refusal of the new keys and the 1.53 gate (in the ruleset file, each key on its own, and in a catalog file); sources (conditions while active, levels while reached, worn while worn, carried while only carried, one item once) and narrowing (a modifier's own skills, its source's, abilities, unknown checks, saves); leans cancelling with `mode=`; dice and `minus`; checks and saves through the turn's resolver on the 5e example (Poisoned disadvantage, cancelled by the Game Master's advantage, Paralyzed failing a Dexterity save without a roll, read back after a reload), Ember Roads (coat -1 on Sneak, waystone +1 on Sway, nothing on Tinker, a Game Master's own record vouched only when nothing changes the check) and Gravewatch (the bound bell's die on Ward, Rattled's on Soothe), plus Gravewatch through the real context loader; fights (skill-narrowed parts out of contests, modes and a modifier's saves counted); item facts; invented items (bonus caps, dice left out, `like=`, `none`, unknown names, the tag, read-back); and the Game Master's line for each example. - `game-inventory-turn.regression.ts`: a real Game Master turn in an Ember Roads game saves the Sneak check with `effects="-1" from="Leather coat"`. - `e2e/game-ruleset-check-effects.e2e.ts` (desktop and phone): the coat's details say "While worn: -1 on checks (Sneak)", and the dice card of a real turn's Sneak check shows the -1 and "Changed by Leather coat". - Lanes that pin the prompt text, the 1.52 gates or the examples were brought up to date. Sixty deliberate breaks, across the format, the gate, the sources, narrowing, the resolver, the record and its read-back, fights, item facts, invented items, the Game Master's line and the two screens, were each caught (four only after the lane gained the assertions they showed were missing). Local CodeRabbit (`coderabbit review --agent --base staging`): two passes, 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 the coat and carrying a waystone: - Sneaking past guards, 3 tellings: 2 called for Sneak and both were rolled with `effects="-1" from="Leather coat"`; the third wrote a malformed tag the Engine left alone, as it always has. One narration even had the coat snag. - Haggling with a trader, 3 tellings: 1 called for Sway, rolled with `effects="+1" from="Waystone"`. - Buying boots "that give +1 to Sneak": at first the model put the bonus in `stats=`, then copied the form's example skill. The form now says a skill or save bonus goes in `worn` or `carried`, never in `stats`, and its example names no real skill; after that, 3 of 3 tellings on a fresh game invented the boots with `worn: +1 on checks (Sneak)`. With no effect stated (a lucky charm), it invents the item without one, which is fine. ## 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 two example rulesets. Translations: #6813 is the items arc's follow-up; this PR is added to it there. ## UI evidence (if applicable) The dice card of a real turn's Sneak check in an Ember Roads game with the coat worn shows "Conditions and items: -1 to this roll" and "Changed by Leather coat" (5 + 5 - 1 = 9), and the coat's details say "While worn: -1 on checks (Sneak)" (captured by `e2e/game-ruleset-check-effects.e2e.ts` as `ruleset-check-effects-card.png`, desktop and phone). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Outside combat, supported checks and saves can now reflect active conditions, track levels, and worn or carried item effects—including bonuses, penalties, advantage or disadvantage, and automatic save failures. * Roll results show effect amounts and their sources; inventory item details describe worn and carried effects. * Invented-item bonuses can be limited by rarity. * **Compatibility** * Rulesets using these effects require Capability API 1.53 or later. <!-- 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#7350
No description provided.