mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6810] [MERGED] feat(game): wear, bind and carry a ruleset's items #7338
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#7338
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/6810
Author: @kolacheee
Created: 9/28/2026
Status: ✅ Merged
Merged: 9/28/2026
Merged by: @SpicyMarinara
Base:
staging← Head:feat/ruleset-items-wearing📝 Commits (10+)
9c79723feat(game): wear, bind and carry a ruleset's items858f274test(game): wearing and carrying checks, and the same player sheet on the screen and the serverda91690docs(game): wearing, binding and carrying ruleset items1b8e7f0fix(game): keep every card's sheet for its own bag, and announce all picks together67a9acdtest(game): a give past the limit, the most room first, and bound items counted per bag38eaebcfix(game): the player cannot use up a bound cursed item by name either1e01866fix(game): weigh a Game Master's give by what it would move, and compare holders by their bag keye89ca0ffix(game): ask each bag once when placing an addition, and read the player's sheet only when their name changesa546953fix(game): offer the Game Master only the wear actions a ruleset has (#6801)b8cc844fix(game): hold merges to the carrying limit and keep cursed items out of fights (#6801)📊 Changes
24 files changed (+2567 additions, -147 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
docs/extending/writing-rulesets.md(+6 -1)📝
docs/game/party-and-npcs.md(+13 -3)📝
e2e/game-ruleset-items.e2e.ts(+4 -0)➕
e2e/game-ruleset-wearing.e2e.ts(+246 -0)📝
packages/client/src/components/game/GameInventory.tsx(+200 -10)📝
packages/client/src/components/game/GameSurface.tsx(+245 -35)📝
packages/client/src/hooks/use-ruleset-item-book.ts(+10 -3)📝
packages/client/src/localization/locales/en.json(+28 -0)📝
packages/server/src/routes/combat-director.routes.ts(+16 -2)📝
packages/server/src/routes/generate.routes.ts(+18 -2)📝
packages/server/src/services/game/game-inventory.service.ts(+47 -7)📝
packages/server/src/services/game/gm-prompts.ts(+99 -10)📝
packages/shared/src/features/rulesets/item-book.ts(+70 -1)📝
packages/shared/src/utils/game-inventory-ops.ts(+106 -27)📝
packages/shared/src/utils/game-inventory-stacks.ts(+446 -29)📝
packages/shared/src/utils/game-inventory-tags.ts(+88 -2)📝
packages/shared/src/utils/game-inventory-turns.ts(+5 -3)📝
packages/shared/src/utils/inventory-command-tag.ts(+26 -10)📝
scripts/regressions/combat-director-route.regression.ts(+69 -1)...and 4 more files
📄 Description
Linked issue
Closes #6801
Why this change
A ruleset's items are in Game Mode's inventory since #6797, but nothing about wearing or carrying them worked:
slotsand an item'sslotswere only stored. Nothing let a character put an item on, and nothing stopped two suits of armor being worn at once.binding(5e attunement, PF2e investiture) and an item'sbindsdid nothing, and a cursed item could be dropped like any other.carrydid nothing: every item went to the player's own bag however much they already carried, and nobody was ever encumbered. The maintainer asked for weight to count for rulesets like 5e.This is the last part of slice I2b of the ruleset items plan (wearing and carrying), and needs no Capability API change.
What changed
equippedandbound, and such a stack is always one item. Equipping or binding one item of a larger stack takes it into a stack of its own, right after. A worn or bound stack is never topped up, merged or split, a count set past one puts the rest beside it unworn, taking by name takes what nobody wears first, and a stack handed to someone else arrives neither worn nor bound. Plain stacks and saved games are unchanged.slotson the entry) and its bearer to have those slots free (the ruleset'sitems.slots), counted per character.bind, and its bearer to be underbinding.max, read off their own sheet. A boundcurseditem stays with its bearer: the player cannot unbind it, take it off, give it away or remove it. The Game Master can, so a curse can end in the story.carry.stat, and a character's load is what their bag weighs, againstencumberedAboveandlimitread off their own sheet (rulesetItemBearers). An item added into the shared view (the player's Add or picker from All, or the Game Master'saddwith nowho=) is placed as the plan says (placeGameInventoryAddition): all of it to the first who can carry it without becoming encumbered (the player first, then the party in order); otherwise split by the room each has left; what still does not fit, one at a time to whoever is then least over. Nothing goes past anyone'slimit: what nobody can carry is left behind and reported. Adding into one bag, raising a count, and giving are held to that bag's limit too. A game whose ruleset has nocarrykeeps adding to the player's bag, as before.action="equip|unequip|bind|unbind", taught only when the ruleset has slots or binding. Putting on prefers the item already bound, and binding the one worn. A sharedaddis answered once per bag it went into (the player's naming nobody), plus atoo-heavyrefusal for what was left behind, and a give past the receiver's limit is refused astoo-heavy. Its block shows each item's worn and bound counts, such asHunting bow ×2 (1 worn), and each character's load, bound items and slots, such as- Ada (load 8 of 6, most 12, encumbered; Hands 2 of 2). The carrying sentence appears only withcarry.docs/game/party-and-npcs.mdgains "Wearing, binding and carrying", and the author guide's "What reads items" says what slots, binding and carrying now do, including"integer": falsefor fractional weights. CHANGELOG entry.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Run by the agent on this branch at
b8cc84482(9c79723aeand the follow-up commits858f2743e,da9169005,1b8e7f063,67a9acdbe,38eaebc63,1e0186631,e89ca0f26,a546953d9andb8cc84482, rebased on staginge75e5ff61):pnpm checkandpnpm localization:checkexit 0 (atb8cc84482).pnpm regression:nodepasses 422/422 (atb8cc84482).pnpm smoke:uipasses 7/7 (atb8cc84482; one earlier run lost the home-screen test toERR_NETWORK_IO_SUSPENDEDon this laptop and passed on the rerun).pnpm regression:ui e2e/game-ruleset-wearing.e2e.ts e2e/game-ruleset-items.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 (atb8cc84482, and the three inventory specs again after its last client change).Lanes:
game-inventory-stacks.regression.ts: worn and bound marks read on one item only; equipping takes free slots per bearer (a second two-handed bow finds no hand free, an item without slots cannot be worn) and one item of a larger stack into its own; binding up to the bearer's maximum (a companion's bound item not counted), only what binds; a bound cursed item kept for the player (no unbinding, taking off, giving, removing or using up by name) but not for the Game Master; worn stacks never topped up or merged, a count set past one going beside it unworn, a give arriving unworn, taking by name taking unworn first; loads with fractions; placement (whole to the first who can, the most room first, least over, never past a limit, left behind, weightless and no-carryto the first, into one bag up to its limit, a bag named twice asked once); the operations'placed,left,too-heavy,cursedand wear answers, a raised count held to the limit; worn and bound counts in totals and the turn record.game-inventory-bags.regression.ts: the grammar'sequip,unequip,bindandunbind; zero kept in an answer; the Game Master's shared adds answered per bag and with atoo-heavyrefusal for what was left, an add into one bag up to its limit, a give past the receiver's limit refused while a give of more than the giver holds weighs only what it holds; putting on, binding and ending a curse by name, each answered with how many are so now.game-ruleset-items.regression.ts: weights, slots, binding and curses from both example rulesets; each character's carrying and binding limits read off their own sheet (a missing sheet reads blank); the Game Master's block with worn and bound counts, each character's load, bound items and slots, the carrying sentence only withcarry, andequipandunequipoffered only with slots andbindandunbindonly with binding (a slots-only, a binding-only and a both ruleset).game-inventory-turn.regression.ts, through the real routes: the player's shared adds placed by who can carry them; a real Game Master turn sharing ten arrows between the player and Bram, then four bows with one left behind; a give past Bram's limit refused; the coat and a bow equipped and the second bow finding no free hand; the next prompt showing each character's load, slots and what is worn; Gravewatch's binding up to Nerve, the cursed ring refused for the player four ways and unbound by the Game Master; a game whose only card is a companion's still reading it for their own bag.Sixty deliberate breaks of these rules, in the shared helpers, the operations, the Game Master's tags and grammar, the item book, the inventory service, the generate route and the prompt, were each caught. The first full run caught 52 of 55; the three it missed (the give helper's own weight guard, the order room is shared out in, bound items counted per bag) now each have a check that catches them.
Found and fixed along the way:
From the maintainer's review, in
b8cc84482: dragging a stack onto one in another character's bag skipped the carrying limit that Give applies. The merge now weighs what actually moves against the receiver's limit and answerstoo-heavy, with a message naming who cannot carry it; merges within one bag are unchanged.game-inventory-stacks.regression.tsand the browser test cover it.From the maintainer's review, in
b8cc84482: a directed fight could use up a bound cursed item. The fight now reads the player's item rules, refuses that spend with a message, and rolls the whole step back if any take comes up short.combat-director-route.regression.tsproves it through the real routes with Gravewatch's Widow's ring.The screen and the server read the player's sheet differently: the screen showed "Bound 1/2" where the server allowed one. Both now read the card named for who the chat plays as, else the first card (
858f2743e).Raising a count with the amount field was not held to the carrying limit, though adding and giving were (
858f2743e).Equipping by the Game Master put on the unbound ring of two after binding one; it now prefers the item already bound, and binding the one worn (
858f2743e).Local CodeRabbit (
coderabbit review --agent), before opening:1b8e7f063: the party's sheets keep every card, so the first card read for the player still carries by its own sheet when it is a companion's; and items picked together are announced together, with one message for what nobody could carry.38eaebc63: taking by name (a classic fight's Use) could use up a bound cursed item for the player.1e0186631: a Game Master's give of more than the giver holds was weighed by the whole request; and the screen compared holders by their raw names.e89ca0f26: a bag named twice among those an addition may go to had its room counted twice, and the screen rebuilt the party's sheets whenever the party list changed rather than when the player's name did.e89ca0f26, run once the rate limit lifted: no findings. The wear-line fix from the real-model run (a546953d9) came after it.b8cc84482: one finding, fixed inb8cc84482(a drag that merges nothing for another reason now says so too).Clicked through by the agent in the browser test at desktop width (screenshots of the player's bag with the coat and bow worn, and of the bound cursed ring): the tabs' status line, the worn and bound marks on the slots, the Equipped and Bound toggles, the binding restriction and cursed note, and the refusal message.
At phone width (mobile-chromium, in a throwaway copy of the same test that opens the inventory by its icon, since that button has no accessible name on phones, #6796): the status chips, the marks, the details, the wrapped action row with Equipped, Bound and Use, and the Add row all fit inside the panel.
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 games with Bram in the party, 33 tellings in all:
who. The Engine gave 6 to the player (up to their limit of 12) and 12 to Bram (up to Bram's), refused the last 2 as too-heavy, and answered Bram's share with the name and the player's without one.who="Bram"(1 of 2) were put on, and the next prompt showed the new slot counts. A retelling without the tag left the item unworn.count="20, road rations") became an add of one.a546953d9: the wear line offeredbindandunbindto Ember Roads, which has no binding, and only spoke of putting an item on, which does not fit a bow. It now listsequipandunequiponly with slots andbindandunbindonly with binding, and says "puts on, wields or readies". A check ingame-ruleset-items.regression.tscatches the old line that offered all four.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/game/party-and-npcs.mdanddocs/extending/writing-rulesets.md(both carried bydocs-i18n) andCHANGELOG.md. The translation follow-up for this wearing, binding and carrying slice is tracked in #6813; it covers both changed documentation pages and every translated language pack ondocs-i18n.UI evidence (if applicable)
The new browser test
e2e/game-ruleset-wearing.e2e.tschecks each bag's load in the shared view, picks a bow and a coat that fit the player and a second coat that goes to a party member, puts both items on with Equipped (with the body and hands counts), and binds a cursed ring that then cannot be unbound. It saves screenshots of both.Summary by CodeRabbit
Maintainer verification
The carry-capacity and cursed-item findings are fixed. Independent runtime proofs confirm that cross-bag merges reject excess weight, same-bag merges still work, Classic combat refuses a cursed-item spend without saving any part of the action, and retrying with an unbound spare succeeds while preserving the bound item. Three focused retained regressions pass, and earlier hosted comments are addressed.
The prepared staging integration passes
pnpm check, three prompt regressions and the real inventory-turn regression. Its 21 author-only files and 101 incoming-only files match their respective parents; the two shared source files match Git's automatic merge, and both changelog blocks are retained. Later staging follow-ups are incorporated verbatim with exact file-equivalence checks. Manual validation checkboxes remain unchanged.Current-head hosted CodeRabbit and required checks remain merge gates.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.