[PR #6823] [MERGED] feat(game): a ruleset's native: false keeps untyped items out of its games #7344

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

📋 Pull Request Information

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

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


📝 Commits (6)

  • f1f069f feat(game): a ruleset's native: false keeps untyped items out of its games (#6822)
  • 222d940 Merge remote-tracking branch 'origin/staging' into feat/ruleset-items-native
  • f2369af fix(game): a directed fight keeps no guessed item effects when native items are off (#6822)
  • 9d96f6b Merge remote-tracking branch 'origin/staging' into feat/ruleset-items-native
  • c3948ad docs(changelog): say that native: false only refuses new untyped items (#6822)
  • a6b30b1 Merge remote-tracking branch 'origin/staging' into feat/ruleset-items-native

📊 Changes

19 files changed (+520 additions, -25 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+25 -0)
📝 docs/extending/writing-rulesets.md (+3 -2)
📝 docs/game/combat.md (+1 -1)
📝 docs/game/party-and-npcs.md (+1 -1)
📝 e2e/game-ruleset-items.e2e.ts (+87 -1)
📝 packages/client/src/components/game/GameSurface.tsx (+9 -3)
📝 packages/server/src/routes/combat-director.routes.ts (+11 -3)
📝 packages/server/src/routes/encounter.routes.ts (+18 -5)
📝 packages/server/src/routes/game.routes.ts (+21 -2)
📝 packages/server/src/services/game/game-inventory.service.ts (+18 -3)
📝 packages/server/src/services/game/gm-prompts.ts (+5 -0)
📝 packages/shared/src/features/rulesets/item-book.ts (+2 -2)
📝 scripts/regressions/combat-boss-provider.regression.ts (+38 -1)
📝 scripts/regressions/combat-director-route.regression.ts (+57 -0)
📝 scripts/regressions/game-inventory-turn.regression.ts (+129 -0)
📝 scripts/regressions/game-ruleset-invented-items.regression.ts (+23 -0)
📝 scripts/regressions/hybrid-terrain-route.regression.ts (+60 -1)
📝 scripts/regressions/ruleset-combat-director-route.regression.ts (+10 -0)

📄 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 #6822

Why this change

  • A ruleset could already declare items.native: false (since Capability API 1.49), meaning it wants only its own items in its games, but nothing read it. The Game Master could still hand out untyped items with no ruleset data, and every fight still asked a model to guess what each inventory item does.
  • This is slice I3-2 of the ruleset items arc. It comes right after #6816 (invented items), so a ruleset that turns native items off never leaves the Game Master unable to give anything.

What changed

  • The Game Master's adds. With native: false, its item book refuses a new untyped name as not-ruleset-item, so it gives only the ruleset's items and the ones it invents. More of something already held, removing and giving work as before.
  • Its instructions say so beside the proposal form, or say it may give only the listed items when the ruleset also forbids invention (propose: false).
  • The player is unchanged: typed-in items still follow freeform.
  • Carrying over. A new session restores what the party carried whatever the switch says, so a plain item held before the switch comes back. (The carry-over uses the Game Master's item rules, which now refuse untyped names, so it explicitly allows them there.)
  • Fights, in a game whose ruleset turns native items off:
    • the fight-start blueprint no longer asks for itemEffects, and drops any the model gives anyway;
    • a directed fight starts with no items;
    • the round and tactical routes refuse an item action ("This game's ruleset keeps its items out of fights for now.");
    • the fight screen offers no items.
      Items do nothing in a fight until a later slice (I6, I8) lets the ruleset say what they do.
  • A shared server check, gameRulesetTurnsNativeItemsOff, answers the question for all of these.
  • No new format keys and no Capability API change.

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 f1f069fb6 (one commit on staging a49d7636f):

  • pnpm check exits 0 and pnpm localization:check exits 0.
  • pnpm regression:node passes 441/441, and pnpm smoke:ui passes 7/7.
  • Before the rebase onto a49d7636f (which only adds #6821's Author's Notes fix): pnpm regression:ui e2e/game-ruleset-items.e2e.ts e2e/game-ruleset-wearing.e2e.ts e2e/game-inventory-bags.e2e.ts e2e/game-inventory-stacks.e2e.ts e2e/game-combat-ai.e2e.ts e2e/game-combat-director.e2e.ts --project=desktop-chromium --workers=1 passes 16/16, and the four ruleset and inventory specs pass 5/5 on --project=mobile-chromium.

Lanes:

  • game-inventory-turn.regression.ts, through the real routes: in an Ember Roads game with native: false, a Game Master turn's new untyped "Lamp" is refused as not-ruleset-item, while more of a held plain Rope, the catalog Hand axe and an invented Moon Charm all land; the player still types in a Candle; the next prompt carries the new instruction; and a new session brings back a plain item only the detailed inventory named.
  • game-ruleset-invented-items.regression.ts: the instruction with invention allowed, with propose: false (only the listed items), and its absence for a ruleset with Game Mode's own items.
  • combat-boss-provider.regression.ts: the fight-start route, against a local model fixture, asks for itemEffects and keeps the guess for Game Mode's own items, and for native: false asks for none and drops the one the fixture returns anyway.
  • ruleset-combat-director-route.regression.ts: the blueprint prompt without itemEffects.
  • combat-director-route.regression.ts: a directed fight in a native: false game offers no items, refuses the potion, and leaves the inventory as it was.
  • hybrid-terrain-route.regression.ts: the round route refuses the player's and an ally's item action and still takes Defend; the tactical route refuses an item action.

Thirteen deliberate breaks, in the item book's rule, the shared check, the carry-over, the instructions, the fight-start route and prompt, the directed fight and the round and tactical routes, were each caught. The browser check fails without the screen's part.

Local CodeRabbit (coderabbit review --agent): 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 native: false and Bram in the party, 5 tellings:

  • Asked for a coil of rope and a lantern bought at a market, with no hint, the model invented both as common gear with a Bulk (2 of 3 tellings; the third wrote no tag). It never wrote an untyped add, so no refusal came up; the lanes cover that.
  • Given a waystone and a lucky coin, it wrote the proposal form for both in both tellings: the Waystone was answered as the ruleset's own item, and the coin was invented.
  • It sometimes wrote tags the ruleset lacks ("utility", "charm"), which the Engine left out and said so.

Clicked through by the agent in the browser test at desktop width: the restored classic fight's Items offers the potion in a game with Game Mode's own items, and nothing in one whose ruleset turns them off.

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, docs/game/combat.md and docs/development/game-rulesets-and-sheets-implementation.md (all carried by docs-i18n), and CHANGELOG.md. Translations: #6813 is the items arc's follow-up; this PR's four pages need adding to it (docs/game/combat.md is new to the arc).

UI evidence (if applicable)

e2e/game-ruleset-items.e2e.ts restores a classic fight with a potion in the bag and an effect guessed for it, in two games: with Game Mode's own items the potion is offered under Items; with the ruleset's native: false nothing is (screenshot ruleset-fight-no-items.png).

Summary by CodeRabbit

  • New Features
    • Rulesets can disable built-in items in combat. When disabled, item effects and item actions aren’t available until the ruleset defines item behavior.
    • Game Masters can add ruleset items, permitted invented items, and more of items already held. Player-entered items remain governed by the ruleset’s custom-item settings.
    • Items already in the party’s inventory continue to carry into new sessions.
  • Documentation
    • Clarified how ruleset settings affect inventory and combat items.

🔄 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/6823 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/28/2026 **Status:** ✅ Merged **Merged:** 9/28/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/ruleset-items-native` --- ### 📝 Commits (6) - [`f1f069f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f1f069fb6e8fe161887615009caced379a932c8f) feat(game): a ruleset's native: false keeps untyped items out of its games (#6822) - [`222d940`](https://github.com/Pasta-Devs/Marinara-Engine/commit/222d9409219b6ef00d3dbc3947601ee80be7194d) Merge remote-tracking branch 'origin/staging' into feat/ruleset-items-native - [`f2369af`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f2369afb8942839170547894c6feb67fe4f96f8e) fix(game): a directed fight keeps no guessed item effects when native items are off (#6822) - [`9d96f6b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9d96f6b8a42ea39a43b5e2ad8cd6d00b97b54717) Merge remote-tracking branch 'origin/staging' into feat/ruleset-items-native - [`c3948ad`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c3948adbe9f62406c26ca139b7b65aed3483153c) docs(changelog): say that native: false only refuses new untyped items (#6822) - [`a6b30b1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a6b30b107cdd0552ca6a8aaf3bee8151a0059dee) Merge remote-tracking branch 'origin/staging' into feat/ruleset-items-native ### 📊 Changes **19 files changed** (+520 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+25 -0) 📝 `docs/extending/writing-rulesets.md` (+3 -2) 📝 `docs/game/combat.md` (+1 -1) 📝 `docs/game/party-and-npcs.md` (+1 -1) 📝 `e2e/game-ruleset-items.e2e.ts` (+87 -1) 📝 `packages/client/src/components/game/GameSurface.tsx` (+9 -3) 📝 `packages/server/src/routes/combat-director.routes.ts` (+11 -3) 📝 `packages/server/src/routes/encounter.routes.ts` (+18 -5) 📝 `packages/server/src/routes/game.routes.ts` (+21 -2) 📝 `packages/server/src/services/game/game-inventory.service.ts` (+18 -3) 📝 `packages/server/src/services/game/gm-prompts.ts` (+5 -0) 📝 `packages/shared/src/features/rulesets/item-book.ts` (+2 -2) 📝 `scripts/regressions/combat-boss-provider.regression.ts` (+38 -1) 📝 `scripts/regressions/combat-director-route.regression.ts` (+57 -0) 📝 `scripts/regressions/game-inventory-turn.regression.ts` (+129 -0) 📝 `scripts/regressions/game-ruleset-invented-items.regression.ts` (+23 -0) 📝 `scripts/regressions/hybrid-terrain-route.regression.ts` (+60 -1) 📝 `scripts/regressions/ruleset-combat-director-route.regression.ts` (+10 -0) </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 #6822 ## Why this change - A ruleset could already declare `items.native: false` (since Capability API 1.49), meaning it wants only its own items in its games, but nothing read it. The Game Master could still hand out untyped items with no ruleset data, and every fight still asked a model to guess what each inventory item does. - This is slice I3-2 of the ruleset items arc. It comes right after #6816 (invented items), so a ruleset that turns native items off never leaves the Game Master unable to give anything. ## What changed - **The Game Master's adds.** With `native: false`, its item book refuses a new untyped name as `not-ruleset-item`, so it gives only the ruleset's items and the ones it invents. More of something already held, removing and giving work as before. - **Its instructions** say so beside the proposal form, or say it may give only the listed items when the ruleset also forbids invention (`propose: false`). - **The player** is unchanged: typed-in items still follow `freeform`. - **Carrying over.** A new session restores what the party carried whatever the switch says, so a plain item held before the switch comes back. (The carry-over uses the Game Master's item rules, which now refuse untyped names, so it explicitly allows them there.) - **Fights**, in a game whose ruleset turns native items off: - the fight-start blueprint no longer asks for `itemEffects`, and drops any the model gives anyway; - a directed fight starts with no items; - the round and tactical routes refuse an item action ("This game's ruleset keeps its items out of fights for now."); - the fight screen offers no items. Items do nothing in a fight until a later slice (I6, I8) lets the ruleset say what they do. - A shared server check, `gameRulesetTurnsNativeItemsOff`, answers the question for all of these. - No new format keys and no Capability API change. ## 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 f1f069fb6 (one commit on staging a49d7636f): - `pnpm check` exits 0 and `pnpm localization:check` exits 0. - `pnpm regression:node` passes 441/441, and `pnpm smoke:ui` passes 7/7. - Before the rebase onto a49d7636f (which only adds #6821's Author's Notes fix): `pnpm regression:ui e2e/game-ruleset-items.e2e.ts e2e/game-ruleset-wearing.e2e.ts e2e/game-inventory-bags.e2e.ts e2e/game-inventory-stacks.e2e.ts e2e/game-combat-ai.e2e.ts e2e/game-combat-director.e2e.ts --project=desktop-chromium --workers=1` passes 16/16, and the four ruleset and inventory specs pass 5/5 on `--project=mobile-chromium`. Lanes: - `game-inventory-turn.regression.ts`, through the real routes: in an Ember Roads game with `native: false`, a Game Master turn's new untyped "Lamp" is refused as `not-ruleset-item`, while more of a held plain Rope, the catalog Hand axe and an invented Moon Charm all land; the player still types in a Candle; the next prompt carries the new instruction; and a new session brings back a plain item only the detailed inventory named. - `game-ruleset-invented-items.regression.ts`: the instruction with invention allowed, with `propose: false` (only the listed items), and its absence for a ruleset with Game Mode's own items. - `combat-boss-provider.regression.ts`: the fight-start route, against a local model fixture, asks for `itemEffects` and keeps the guess for Game Mode's own items, and for `native: false` asks for none and drops the one the fixture returns anyway. - `ruleset-combat-director-route.regression.ts`: the blueprint prompt without `itemEffects`. - `combat-director-route.regression.ts`: a directed fight in a `native: false` game offers no items, refuses the potion, and leaves the inventory as it was. - `hybrid-terrain-route.regression.ts`: the round route refuses the player's and an ally's item action and still takes Defend; the tactical route refuses an item action. Thirteen deliberate breaks, in the item book's rule, the shared check, the carry-over, the instructions, the fight-start route and prompt, the directed fight and the round and tactical routes, were each caught. The browser check fails without the screen's part. Local CodeRabbit (`coderabbit review --agent`): 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 `native: false` and Bram in the party, 5 tellings: - Asked for a coil of rope and a lantern bought at a market, with no hint, the model invented both as common gear with a Bulk (2 of 3 tellings; the third wrote no tag). It never wrote an untyped add, so no refusal came up; the lanes cover that. - Given a waystone and a lucky coin, it wrote the proposal form for both in both tellings: the Waystone was answered as the ruleset's own item, and the coin was invented. - It sometimes wrote tags the ruleset lacks ("utility", "charm"), which the Engine left out and said so. Clicked through by the agent in the browser test at desktop width: the restored classic fight's **Items** offers the potion in a game with Game Mode's own items, and nothing in one whose ruleset turns them off. ## 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`, `docs/game/combat.md` and `docs/development/game-rulesets-and-sheets-implementation.md` (all carried by `docs-i18n`), and `CHANGELOG.md`. Translations: #6813 is the items arc's follow-up; this PR's four pages need adding to it (`docs/game/combat.md` is new to the arc). ## UI evidence (if applicable) `e2e/game-ruleset-items.e2e.ts` restores a classic fight with a potion in the bag and an effect guessed for it, in two games: with Game Mode's own items the potion is offered under **Items**; with the ruleset's `native: false` nothing is (screenshot `ruleset-fight-no-items.png`). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Rulesets can disable built-in items in combat. When disabled, item effects and item actions aren’t available until the ruleset defines item behavior. * Game Masters can add ruleset items, permitted invented items, and more of items already held. Player-entered items remain governed by the ruleset’s custom-item settings. * Items already in the party’s inventory continue to carry into new sessions. * **Documentation** * Clarified how ruleset settings affect inventory and combat items. <!-- 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:50 +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#7344
No description provided.