mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6910] [MERGED] feat(rulesets): charged and gated ruleset items in Classic and Tactical battles #7377
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#7377
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/6910
Author: @kolacheee
Created: 9/30/2026
Status: ✅ Merged
Merged: 9/30/2026
Merged by: @kolacheee
Base:
staging← Head:feat/ruleset-items-classic-charges📝 Commits (2)
1733815feat(rulesets): charged and gated ruleset items in Classic and Tactical battles (#6909)0df29bafix(rulesets): a companion without a card rolls an item's check on a blank sheet, and one wear rule serves the Use button, the fight menu and its spends (#6909)📊 Changes
23 files changed (+1193 additions, -120 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
docs/development/game-rulesets-and-sheets-implementation.md(+37 -4)📝
docs/extending/writing-rulesets.md(+4 -1)📝
docs/game/combat.md(+1 -1)📝
e2e/game-ruleset-classic-items.e2e.ts(+178 -0)📝
packages/client/src/components/game/GameCombatUI.tsx(+4 -2)📝
packages/client/src/components/game/GameSurface.tsx(+23 -16)📝
packages/server/src/routes/combat-director.routes.ts(+43 -9)📝
packages/server/src/routes/game-inventory.routes.ts(+3 -1)📝
packages/server/src/routes/game.routes.ts(+12 -1)📝
packages/server/src/services/game/combat-director.service.ts(+35 -23)📝
packages/server/src/services/game/combat.service.ts(+21 -0)📝
packages/server/src/services/game/game-inventory.service.ts(+4 -4)📝
packages/server/src/services/game/game-item-use.service.ts(+54 -1)📝
packages/shared/src/features/rulesets/item-book.ts(+12 -1)📝
packages/shared/src/features/rulesets/item-fight.ts(+78 -24)📝
packages/shared/src/features/rulesets/item-use.ts(+39 -13)📝
packages/shared/src/types/combat-encounter.ts(+9 -0)📝
packages/shared/src/types/game.ts(+2 -0)📝
packages/shared/src/utils/game-inventory-ops.ts(+62 -2)...and 3 more files
📄 Description
Linked issue
Closes #6909
Why this change
use, but leaves out any item that spends charges (a wand, Gravewatch's dawn bell) or asks a check first (gate: a scroll, the page of the vigil litany), because those battles could not count charges or roll a check. Outside a fight the Use button already handles both, so the same item worked in the bag and vanished from the battle menu. This is slice I8-2 of the ruleset items plan.What changed
gameFightOffers, shared by the server and the screen): a charged line countsfloor(charges left / cost)over its stacks (a stack without a count is full, and none holds more than its item's most), and is offered only while a use is left. The menu says "spends 1 of 3 charges".wear: a line counts only stacks worn where the item takes slots and bound where it binds, as the Use button and a ruleset fight already do.chargeinventory op spends them:countuses by own name, each off the first usable stack with enough, the player's own first (or one bag withfrom). A stack emptied rolls the item'sbreaksOnwith the Engine's own dice and is gone when it breaks; the journal says it was used, and lost where it broke. The screen sends it after a Classic round; the director turns a charged line's spends into it when it saves a step.takeop gainsworn(via the newgameInventoryUsableStack, whichchargeshares), and a fight's spends set it. Without it the fight would count the worn tonic but drink a spare from the bag, and a worn cursed ring would use spare rings up in its place.rollRulesetItemGateis extracted from the Use button's path, androllGameFightItemGatefinds the user's card by the unit's name: only the player's own unit falls back on the player's card, and a companion with no card rolls on a blank sheet. The Classic round route rolls it for the unit using the item; the director rolls it before a player's classic or tactical item command.unlessskips it.note, and the log shows it in place of the usual line: "Ada rolls Ward to use Page of the vigil litany: 0 against 2, failed, and it is used up for nothing."docs/extending/writing-rulesets.md, the Items line indocs/game/combat.md, the I8-2 record indocs/development/game-rulesets-and-sheets-implementation.md, and a CHANGELOG entry. No Capability API change: every key read here shipped with 1.59.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Local run on this branch, rebased onto staging with #6908 (Fedora):
pnpm check,pnpm localization:checkand prettier: clean.pnpm regression: 480 of 480.pnpm smoke:ui: 7 passed.Lanes:
game-ruleset-classic-items.regression.tsgains the charges-and-gates sections: the effect (charges and the check said, a charge count read off a stat the bell does not give left out, and likewise a page whose check reads one,wear); the offers (counted in uses, a stack without a count full and capped at the most, not bound or not worn not offered, a worn tonic counting only the worn one); thechargeop (the player's own first, then the party, one bag, none left, not bound, as many as there are, the last charge rolling its die and breaking on a 1, no dice no break); thetakeop'sworn(the worn tonic drunk, never the spare before it); the gate (skipped byunless, failed for two ones, rolled for whoever uses it); the Classic round route (a page doing what it does whenunlessholds, a failed page spent for nothing, a bell with no use left refused, the check rolled for Bram rather than Ada); the inventory route'scharge(a charge spent, and the Engine's dice breaking a bell on its last); and the director (the bell offered by its uses and spending a charge, a worn page counted alone and spent before the spare, a failed page logged).combat-director-route.regression.ts: the cursed ring is now worn and bound, as a ring that binds is used; a spare in the bag is no longer spent in its place, and a ring taken off since is refused as a changed inventory, not as the curse.e2e/game-ruleset-classic-items.e2e.tsgains a Classic battle whose menu offers the dawn bell as "spends 1 of 3 charges" with two uses, spends one charge on the rat, and whose worn page Ada fails the check for: it is spent for nothing, the log says so, and the spare page stays in the bag.40 deliberate breaks, each caught by these lanes and the e2e. One slipped past on the first run: counting any stack rather than only worn ones in the director's check went unseen, since it only changed which refusal was given; the ring taken off now pins it.
Local CodeRabbit raised five findings over three passes:
rollGameFightItemGateparsed the chat's metadata with a bareJSON.parse, so corrupt metadata could throw mid-round. Fixed: it uses the inventory service's tolerantreadMetadata(now exported).chargeop refuses a shortfall itself.)ruleset.schema.ts, "An item that holds charges is one to a stack"), and every add and merge holds stacks to that limit, so such a stack cannot be made; the Use button and ruleset fights write charges the same way.The first full gate run caught one more thing:
combat-director-route's cursed ring was held bound but not worn, so the new wear rule stopped offering it. Fixing that test showed the real gap above: the fight counted only worn stacks but spent any stack. Theworntake closes it.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/combat.mdanddocs/development/game-rulesets-and-sheets-implementation.md(all carried bydocs-i18n), andCHANGELOG.md. Translations: #6813 is the items arc's follow-up; this PR is added to it there.UI evidence (if applicable)
A Classic battle's Items menu offers the dawn bell with two uses, saying "spends 1 of 3 charges", and the log reads the failed check for the worn page (captured by
e2e/game-ruleset-classic-items.e2e.tsasclassic-charges.pngandclassic-failed-gate.png).Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.