mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6816] [MERGED] feat(game): the Game Master invents a ruleset's items, checked and capped by rarity #7339
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#7339
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6816
Author: @kolacheee
Created: 9/28/2026
Status: ✅ Merged
Merged: 9/28/2026
Merged by: @kolacheee
Base:
staging← Head:feat/ruleset-items-invented📝 Commits (5)
5c37399feat(game): the Game Master invents a ruleset's items, checked and capped by rarity (#6814)5b5ab34fix(game): prune invented items at a new session even without the ruleset (#6814)fb1b791Merge remote-tracking branch 'origin/staging' into feat/ruleset-items-invented183ecc7fix(game): invented items keep each telling's item and hide what the GM is not shown (#6814)eb27d24test(game): find the Inventory button by its icon on phones instead of naming it📊 Changes
35 files changed (+1611 additions, -94 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
docs/development/game-rulesets-and-sheets-implementation.md(+38 -0)📝
docs/examples/rulesets/ember-roads.json(+6 -1)📝
docs/extending/ruleset.schema.json(+32 -0)📝
docs/extending/writing-rulesets.md(+9 -1)📝
docs/game/party-and-npcs.md(+1 -1)📝
e2e/game-inventory-bags.e2e.ts(+2 -5)➕
e2e/game-inventory-fixture.ts(+13 -0)📝
e2e/game-inventory-stacks.e2e.ts(+2 -5)📝
e2e/game-ruleset-items.e2e.ts(+40 -8)📝
e2e/game-ruleset-wearing.e2e.ts(+3 -10)📝
packages/client/src/components/game/GameInventory.tsx(+15 -0)📝
packages/client/src/components/game/GameSurface.tsx(+3 -3)📝
packages/client/src/hooks/use-ruleset-item-book.ts(+10 -2)📝
packages/client/src/localization/locales/en.json(+2 -0)📝
packages/client/vite.config.ts(+4 -0)📝
packages/server/src/routes/game.routes.ts(+19 -1)📝
packages/server/src/routes/generate.routes.ts(+23 -8)📝
packages/server/src/services/capability-packages/package-manager.service.ts(+12 -0)📝
packages/server/src/services/game/game-inventory.service.ts(+4 -0)...and 15 more files
📄 Description
Linked issue
Closes #6814
Why this change
native: falseswitch off untyped Game Master items; it comes after this one so the Game Master can always invent when native items are off.What changed
like=(one of the ruleset's items to start from),category=,rarity=,tags=,stats=(id=valuepairs),slots=(id=count),binds=(yes,cursedorno) andsummary=, each part by id or label in any case. Without a ruleset the parts are ignored and the name is added as before.features/rulesets/invented-items.ts). What the ruleset does not have is left out, a rarity it lacks becomes its lowest, a value its stat cannot hold is left out, and a number is rounded, held to its range and then to its rarity's cap, including whatlikestarted it from. A name that is one of the ruleset's own items is that item. Every change is one plain sentence (at most eight), returned in the answer'snote=and kept on the item.items.rarityCaps(the largest value of each number stat an invented item of a rarity may give; the ruleset's own catalog items are never capped) anditems.propose(falseforbids invention), with cross-checks, the install gate, the published schema, and Ember Roads capping Guard at 1, 2 and 3.gameInventedItems, saved in the same write as the turn's stacks and kept only while the stacks or the turn's remembered tellings hold it. A stack of it isinvented:<id>. A name still held is that item; otherwise a proposal is an item of its own under a new id, so a retold turn never overwrites the first telling's item and switching back finds it. Read back only while every part is still one of the ruleset's words, excluded from chat profiles, and carried into a new session only while a carried stack holds it. At most 200 per game.ruleset-items), since this slice's code took the game tag parser's chunk past the 500 KiB budget.inventoryRefusalhook dependencies from #6810 that ESLint warned about.e2e/game-inventory-fixture.ts): by its name where it has one, and by its icon on phones, where the button has no accessible name (#6796, which stays the maintainer's). They now pass on mobile Chromium too.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Run by the agent on this branch at
183ecc7bf(5c37399b8,5b5ab341a, the staging mergefb1b79138and183ecc7bf), and again foreb27d24f1as noted:pnpm checkexits 0 andpnpm localization:checkexits 0.pnpm regression:nodepasses 441/441.pnpm smoke:uipasses 7/7.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=1passes 15/15, and ateb27d24f1(the Inventory button change reverted, the tests' helper instead) the four ruleset and inventory specs pass 4/4 on both--project=desktop-chromiumand--project=mobile-chromium; on phones all four failed before, on staging's code too, since the button has no name there.pnpm checkexits 0 ateb27d24f1.From the maintainer's review, fixed in
183ecc7bf: a whole-number stat takes only whole-number caps; a stat hidden from the Game Master is kept out of its words, its caps line and an answer's note (the item's details still show every change); a retold turn's proposal is an item of its own under a new id, and a turn's save keeps only what the stacks or the remembered tellings hold, so switching back to the first telling finds its own item. From CodeRabbit:5b5ab341aprunes invented items at a new session even without a readable ruleset.Lanes:
game-ruleset-invented-items.regression.ts:rarityCapsandproposeparsed and refused six ways (unknown rarity, twice, unknown stat, dice, outside the stat's range, no rarities); the 1.51 gate for either key while items alone stay 1.49; every change a proposal can meet (labels and ids in any case, unknown words left out, the lowest rarity, rounding, ranges, caps on whatlikestarted it from, slots past a character, binds without binding, at most eight notes); the book (a catalog name is that item,propose: false, a held name reused, an unheld one made anew under the same id, a colliding id numbered,likeby id or name or neither, the player cannot invent, 200 at most, read-back only of what the ruleset can still read, catalog names first); the tag's parts, itsnote=answer and a game without a ruleset; the proposal form and the ruleset's words only where invention is allowed.game-inventory-turn.regression.ts, through the real routes: a Game Master turn invents the Mourning Edge (Guard capped from 4 to 3 at Storied) and saves it with the stacks; a retold turn's blade is an item of its own; switching back to the first telling holds the first blade, unchanged, and forward again; the next prompt reads it like a catalog item with the proposal form and caps; a new session keeps what is held and drops the rest, with or without a readable ruleset.capability-package-lifecycle(the supported version),game-ruleset-catalogs(its package declares 1.51, since the example now carries caps) andgame-ruleset-items(its 1.49 gate checks read the example without the caps).Fifty-five deliberate breaks of these rules, in the format, the gate, the proposal reader, the book, the tag, the server's read and save, the session carry-over, the prompt and the chat-profile exclusion, were each caught.
Local CodeRabbit (
coderabbit review --agent): before opening, the first pass found one issue, fixed (the guide's Ember Roads snippet cappedguardwithout declaring it), and the second found none; on the review fixes, one more (an unreadable or zero slot count was described as the slot's capacity), fixed in183ecc7bf.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 Bram in the party, 10 tellings:
like=: once with the form's own placeholder ("one of its items"), twice with the rarity or a description ("storied", "storied sword"). The Engine answered each with "No item ... to start from." Fixed here:likeis now described in a sentence rather than shown in the example tag, and the next three tellings wrote no straylike.tags=, which the Engine left out and said so.who=, which the Engine carries out as written.Clicked through by the agent in the browser test at desktop width (screenshot of the invented item's details): the category and rarity chips, the stats line, the summary, "Invented by the Game Master." and the expanded list of changes.
Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Docs touched:
docs/extending/writing-rulesets.md,docs/game/party-and-npcs.mdanddocs/development/game-rulesets-and-sheets-implementation.md(all carried bydocs-i18n), the generateddocs/extending/ruleset.schema.json, the Ember Roads example, andCHANGELOG.md. Translations: #6813 covers this PR's three guides, with #6810's.UI evidence (if applicable)
e2e/game-ruleset-items.e2e.tsnow also opens a game holding an invented item and checks its details: category, rarity, stats, summary, "Invented by the Game Master." and the list of changes. It saves a screenshot (ruleset-invented-item.png).Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.