[PR #6893] [MERGED] feat(rulesets): items that ask a check before they work (#6892) #7373

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

📋 Pull Request Information

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

Base: staging ← Head: feat/ruleset-items-scroll-gates


📝 Commits (2)

  • 782e59d feat(rulesets): items that ask a check before they work (#6892)
  • 5c231e2 fix(rulesets): a pool fight holds a gate's difficulty to what the pool can count, as the Use button does (#6892)

📊 Changes

25 files changed (+1632 additions, -42 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+33 -0)
📝 docs/examples/rulesets/gravewatch.json (+26 -1)
📝 docs/extending/ruleset.schema.json (+385 -0)
📝 docs/extending/writing-rulesets.md (+7 -1)
📝 docs/game/party-and-npcs.md (+1 -1)
➕ e2e/game-ruleset-item-gate.e2e.ts (+93 -0)
📝 packages/client/src/components/game/RulesetItemPicker.tsx (+20 -8)
📝 packages/client/src/lib/ruleset-combat-log.ts (+17 -0)
📝 packages/client/src/localization/locales/en.json (+6 -0)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+13 -0)
📝 packages/shared/src/features/ruleset-combat/encounter.ts (+32 -6)
📝 packages/shared/src/features/ruleset-combat/resolve.ts (+76 -1)
📝 packages/shared/src/features/ruleset-combat/types.ts (+22 -0)
📝 packages/shared/src/features/rulesets/check-effects.ts (+51 -1)
📝 packages/shared/src/features/rulesets/item-book.ts (+60 -0)
📝 packages/shared/src/features/rulesets/item-use.ts (+85 -10)
📝 packages/shared/src/schemas/capability-package.schema.ts (+5 -1)
📝 packages/shared/src/schemas/ruleset.schema.ts (+37 -0)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+4 -4)

...and 5 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 #6892

This follows #6891 (charges over time), now merged; the branch sits on staging, so the diff is this slice alone.

Why this change

  • With #6882, #6889 and #6891 a ruleset's items can be used in a fight and outside one, with charges that come back on rests. But a scroll worked for anybody who read it: nothing could say that a spell above what the reader can cast needs a check first, as a 5e scroll asks for a spellcasting check when the spell is above the reader's level. This is slice I6-4, the last of the plan's "using items" slices.

What changed

  • use.gate (Capability API 1.62): a check its user passes before the item works. check names what is rolled, a skill ({ "skill": "ward" }), an ability, or a value off the sheet ({ "value": { "derived": "spell_mod" } }), which covers a number that differs from one character to the next, as a 5e caster's spellcasting modifier does. difficulty is written down or read off a number stat of the item. unless skips the check when a value on the user's sheet is high enough. A failed check uses the item up (or spends its charges) for nothing.
  • In a fight, the check is rolled as the item is spent, with the fight's own dice (a pool in a pool fight, where the difficulty is the successes it needs) and the sheet's number read as the fight began. What the user's conditions and worn items add to that check counts, a skill's own included: fights now let a modifier narrowed to a skill through when a check names that skill, while contests still name none. The fight log says it: "Ada rolls Ward to use Page of the vigil litany: 2 successes from 2 dice at 7 or more (8, 9), needing 2 successes, a success."
  • Outside a fight, the Use button and the Game Master's use roll it first with the ruleset's own dice, the user's wound penalty and what their conditions and worn or carried items do to that check. A failure applies nothing, and the line says so: "Ada uses Page of the vigil litany: Ward check 1 against 2, failed; it is used up for nothing. 1 left."
  • Said: the item's details and the Game Master's line say "needs a Ward check against 2 first, unless Nerve is 3 or more; failed, it is used up for nothing". A difficulty read off a stat the item does not give leaves the use off the fight menu, and the Use button falls back to simply saying it, as for any item the Engine cannot use.
  • Checked at import: an unknown skill, ability, value or item stat, and a check naming more than one thing. The install gate asks for 1.62 in the ruleset file and in catalog files.
  • Examples: Gravewatch gains a page of the vigil litany, which restores two Resolve behind a Ward check that Nerve 3 skips.
  • Docs: the gate key, its roll outside a fight and the capability list in docs/extending/writing-rulesets.md, a sentence on items that ask a check in docs/game/party-and-npcs.md, the 1.62 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

Local run on this branch (Fedora):

  • pnpm check, pnpm localization:check and prettier: clean.
  • pnpm regression: 477 of 477.
  • pnpm smoke:ui: 7 passed.
  • Desktop e2e (every ruleset, inventory and Game Mode dice/combat spec): 40 passed. Mobile e2e (every ruleset spec): 21 passed.

Lanes:

  • New game-ruleset-item-gate.regression.ts: every import refusal; the 1.62 gate (the example, a catalog file); in a Gravewatch pool fight, a gate that passes (the Resolve comes back), fails (nothing happens, the page is still written back as used) and is skipped at Nerve 3, the dawn bell's +1 to Ward on the check, and the log lines; in an Ember Roads summed fight, the dice and the difficulty off an item stat, the leather coat's -1 to Sneak on a Sneak gate and not on a Tinker one, and a use whose stat is missing dropped from the menu; outside a fight, a failed, passed and skipped reading, a wound's penalty and the bound bell's bonus on the check, Ember's summed roll and a use it cannot make refused; item facts and the Game Master's line.
  • Lanes that pin 1.61, the supported API, the examples' items or the fight log's events were brought up to date.
  • e2e/game-ruleset-item-gate.e2e.ts: in Gravewatch, the page's details show the gate, a reader with Nerve 1 fails a check no single die can pass (the page is used up, Resolve stays 0, the Game Master gets the line), and one with Nerve 3 reads it straight through (Resolve 2).

36 deliberate breaks, each caught by these lanes. Six were missed on the first run and each got its own case: a value check reading its value, resolution.adjust on a gate, a summed total meeting the difficulty, contests still reading nothing narrowed to a skill, the pool difficulty clamp outside a fight, and a failed gate on an item aimed at somebody else telling nothing.

Local CodeRabbit on this slice: no findings.

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

UI evidence (if applicable)

In a Gravewatch game, the page's details read "Use (Quick): restores 2 Resolve, used up, needs a Ward check against 30 first unless Nerve is 3 or more, and a failed one uses it up for nothing" (the e2e's copy asks 30 so the check cannot pass; captured by e2e/game-ruleset-item-gate.e2e.ts as ruleset-item-gate-details.png).

Summary by CodeRabbit

  • New Features
    • Items can require a skill, ability, or character-sheet check before their effects apply, in or out of combat. Some checks can be skipped when a character meets a specified sheet-value threshold.
    • Item descriptions and combat logs show check requirements and results. Failed checks consume the item without applying its effects.
    • Rulesets can define item-use checks with Capability API 1.62.

🔄 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/6893 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/30/2026 **Status:** ✅ Merged **Merged:** 9/30/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/ruleset-items-scroll-gates` --- ### 📝 Commits (2) - [`782e59d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/782e59d4c551d1080fc22bbd7a1534840cc275a9) feat(rulesets): items that ask a check before they work (#6892) - [`5c231e2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5c231e2510320c38401a9632cffa44151706a4fe) fix(rulesets): a pool fight holds a gate's difficulty to what the pool can count, as the Use button does (#6892) ### 📊 Changes **25 files changed** (+1632 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+33 -0) 📝 `docs/examples/rulesets/gravewatch.json` (+26 -1) 📝 `docs/extending/ruleset.schema.json` (+385 -0) 📝 `docs/extending/writing-rulesets.md` (+7 -1) 📝 `docs/game/party-and-npcs.md` (+1 -1) ➕ `e2e/game-ruleset-item-gate.e2e.ts` (+93 -0) 📝 `packages/client/src/components/game/RulesetItemPicker.tsx` (+20 -8) 📝 `packages/client/src/lib/ruleset-combat-log.ts` (+17 -0) 📝 `packages/client/src/localization/locales/en.json` (+6 -0) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+13 -0) 📝 `packages/shared/src/features/ruleset-combat/encounter.ts` (+32 -6) 📝 `packages/shared/src/features/ruleset-combat/resolve.ts` (+76 -1) 📝 `packages/shared/src/features/ruleset-combat/types.ts` (+22 -0) 📝 `packages/shared/src/features/rulesets/check-effects.ts` (+51 -1) 📝 `packages/shared/src/features/rulesets/item-book.ts` (+60 -0) 📝 `packages/shared/src/features/rulesets/item-use.ts` (+85 -10) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+5 -1) 📝 `packages/shared/src/schemas/ruleset.schema.ts` (+37 -0) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+4 -4) _...and 5 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 #6892 This follows #6891 (charges over time), now merged; the branch sits on staging, so the diff is this slice alone. ## Why this change - With #6882, #6889 and #6891 a ruleset's items can be used in a fight and outside one, with charges that come back on rests. But a scroll worked for anybody who read it: nothing could say that a spell above what the reader can cast needs a check first, as a 5e scroll asks for a spellcasting check when the spell is above the reader's level. This is slice I6-4, the last of the plan's "using items" slices. ## What changed - **`use.gate`** (Capability API 1.62): a check its user passes before the item works. `check` names what is rolled, a skill (`{ "skill": "ward" }`), an ability, or a value off the sheet (`{ "value": { "derived": "spell_mod" } }`), which covers a number that differs from one character to the next, as a 5e caster's spellcasting modifier does. `difficulty` is written down or read off a number stat of the item. `unless` skips the check when a value on the user's sheet is high enough. A failed check uses the item up (or spends its charges) for nothing. - **In a fight**, the check is rolled as the item is spent, with the fight's own dice (a pool in a pool fight, where the difficulty is the successes it needs) and the sheet's number read as the fight began. What the user's conditions and worn items add to that check counts, a skill's own included: fights now let a modifier narrowed to a skill through when a check names that skill, while contests still name none. The fight log says it: "Ada rolls Ward to use Page of the vigil litany: 2 successes from 2 dice at 7 or more (8, 9), needing 2 successes, a success." - **Outside a fight**, the Use button and the Game Master's use roll it first with the ruleset's own dice, the user's wound penalty and what their conditions and worn or carried items do to that check. A failure applies nothing, and the line says so: "Ada uses Page of the vigil litany: Ward check 1 against 2, failed; it is used up for nothing. 1 left." - **Said**: the item's details and the Game Master's line say "needs a Ward check against 2 first, unless Nerve is 3 or more; failed, it is used up for nothing". A difficulty read off a stat the item does not give leaves the use off the fight menu, and the Use button falls back to simply saying it, as for any item the Engine cannot use. - **Checked at import**: an unknown skill, ability, value or item stat, and a check naming more than one thing. The install gate asks for 1.62 in the ruleset file and in catalog files. - **Examples**: Gravewatch gains a page of the vigil litany, which restores two Resolve behind a Ward check that Nerve 3 skips. - **Docs**: the `gate` key, its roll outside a fight and the capability list in `docs/extending/writing-rulesets.md`, a sentence on items that ask a check in `docs/game/party-and-npcs.md`, the 1.62 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 Local run on this branch (Fedora): - `pnpm check`, `pnpm localization:check` and prettier: clean. - `pnpm regression`: 477 of 477. - `pnpm smoke:ui`: 7 passed. - Desktop e2e (every ruleset, inventory and Game Mode dice/combat spec): 40 passed. Mobile e2e (every ruleset spec): 21 passed. Lanes: - New `game-ruleset-item-gate.regression.ts`: every import refusal; the 1.62 gate (the example, a catalog file); in a Gravewatch pool fight, a gate that passes (the Resolve comes back), fails (nothing happens, the page is still written back as used) and is skipped at Nerve 3, the dawn bell's +1 to Ward on the check, and the log lines; in an Ember Roads summed fight, the dice and the difficulty off an item stat, the leather coat's -1 to Sneak on a Sneak gate and not on a Tinker one, and a use whose stat is missing dropped from the menu; outside a fight, a failed, passed and skipped reading, a wound's penalty and the bound bell's bonus on the check, Ember's summed roll and a use it cannot make refused; item facts and the Game Master's line. - Lanes that pin 1.61, the supported API, the examples' items or the fight log's events were brought up to date. - `e2e/game-ruleset-item-gate.e2e.ts`: in Gravewatch, the page's details show the gate, a reader with Nerve 1 fails a check no single die can pass (the page is used up, Resolve stays 0, the Game Master gets the line), and one with Nerve 3 reads it straight through (Resolve 2). 36 deliberate breaks, each caught by these lanes. Six were missed on the first run and each got its own case: a value check reading its value, `resolution.adjust` on a gate, a summed total meeting the difficulty, contests still reading nothing narrowed to a skill, the pool difficulty clamp outside a fight, and a failed gate on an item aimed at somebody else telling nothing. Local CodeRabbit on this slice: no findings. ## 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`, `docs/game/party-and-npcs.md` and `docs/development/game-rulesets-and-sheets-implementation.md` (all carried by `docs-i18n`), `CHANGELOG.md`, the generated `docs/extending/ruleset.schema.json` and the Gravewatch example. Translations: #6813 is the items arc's follow-up; this PR is added to it there. ## UI evidence (if applicable) In a Gravewatch game, the page's details read "Use (Quick): restores 2 Resolve, used up, needs a Ward check against 30 first unless Nerve is 3 or more, and a failed one uses it up for nothing" (the e2e's copy asks 30 so the check cannot pass; captured by `e2e/game-ruleset-item-gate.e2e.ts` as `ruleset-item-gate-details.png`). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Items can require a skill, ability, or character-sheet check before their effects apply, in or out of combat. Some checks can be skipped when a character meets a specified sheet-value threshold. * Item descriptions and combat logs show check requirements and results. Failed checks consume the item without applying its effects. * Rulesets can define item-use checks with Capability API 1.62. <!-- 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:19:07 +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#7373
No description provided.