[PR #6908] [MERGED] feat(rulesets): a ruleset's items fight by their own use in Classic and Tactical battles (#6905) #7378

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

📋 Pull Request Information

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

Base: staging ← Head: feat/ruleset-items-classic-fights


📝 Commits (4)

  • e18e2d4 feat(rulesets): a ruleset's items fight by their own use in Classic and Tactical battles (#6905)
  • bae5635 fix(rulesets): a plain item sharing a ruleset item's name keeps its own guess in either order (#6905)
  • 68063a6 docs: the I8-1 record holds its own break count, and an earlier record keeps its own
  • 7b0948f docs: the item-gate record keeps its own break count

📊 Changes

20 files changed (+1163 additions, -56 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+31 -0)
📝 docs/extending/writing-rulesets.md (+15 -2)
📝 docs/game/combat.md (+1 -1)
➕ e2e/game-ruleset-classic-items.e2e.ts (+196 -0)
📝 packages/client/src/components/game/GameSurface.tsx (+15 -7)
📝 packages/server/src/routes/combat-director.routes.ts (+7 -11)
📝 packages/server/src/routes/encounter.routes.ts (+30 -12)
📝 packages/server/src/routes/game.routes.ts (+36 -11)
📝 packages/server/src/services/game/combat.service.ts (+9 -5)
📝 packages/server/src/services/game/game-inventory.service.ts (+23 -0)
📝 packages/shared/src/features/rulesets/combat-bridge.ts (+2 -2)
➕ packages/shared/src/features/rulesets/item-fight.ts (+104 -0)
📝 packages/shared/src/index.ts (+1 -0)
📝 packages/shared/src/types/combat-encounter.ts (+3 -0)
📝 scripts/regressions/combat-boss-provider.regression.ts (+1 -1)
📝 scripts/regressions/combat-director-route.regression.ts (+11 -0)
➕ scripts/regressions/game-ruleset-classic-items.regression.ts (+669 -0)
📝 scripts/regressions/hybrid-terrain-route.regression.ts (+2 -2)
📝 scripts/regressions/ruleset-combat-director-route.regression.ts (+5 -2)

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

Why this change

  • A Game Mode ruleset that does not resolve its own fights leaves them to Classic and Tactical battles, and when one starts a model guesses what every item in the inventory does. That included the ruleset's own items, even though one that can be used already says exactly what it does in its use (Capability API 1.59): a poultice could be guessed as a weapon. The ruleset's items with no use (a coat, a spade) were offered too, doing whatever was guessed, and a ruleset with native items off offered nothing at all. This is slice I8-1 of the ruleset items plan.
  • The screen also sent each item's effect with the round, and the server used it as sent.

What changed

  • An item's use is its fight effect (rulesetItemFightEffect, new features/rulesets/item-fight.ts):
    • a heal heals and an attack harms by a share of the target's maximum health, from the average of its amount, on the scale the combat bridge already reads a catalog entry's numbers on (an average of 7 is 0.22 of a maximum, from 0.05 to all of it);
    • the damage type is the element, and the first applied condition goes on as a status by the ruleset's own name, for its rounds (2 without); a buff or debuff is that status alone;
    • targets, or a friend for a heal or buff and a foe otherwise;
    • consumes: true spends one, and a use without it keeps the item.
  • Which items a battle offers (gameFightItems): plain items while native items are on, and the ruleset's own items only when they have an effect. A guess for one of the ruleset's items, or one that claims to be the ruleset's, is dropped. A game without ruleset items is unchanged: every item is guessed at.
  • The server works it out everywhere:
    • the encounter's start tells the model which items it must leave alone (or asks for none with native off) and replaces what it guessed for them;
    • the combat director's start no longer trusts the screen's effects for the ruleset's items;
    • in a game with ruleset items, the Classic round route refuses an item the battle does not offer ("That item does nothing in this fight.") and puts the worked-out effect on one of the ruleset's, whatever the screen sent;
    • in such a game, the screen-played Tactical route, whose engine heals with any item it is handed and reads no effect, takes only a plain item the battle offers. The screen offers no items there; directed Tactical battles do, through the director;
    • a game without ruleset items is checked no more than before.
  • A ruleset heal heals by its own strength; a guessed heal still goes by what its name suggests, as before.
  • The screen lists one of the ruleset's items only when the battle's effects include it.
  • Left for I8-2: an item that spends charges, or asks a check first (gate), is not offered in these battles yet, as the combat bridge leaves out a skill whose cost it cannot charge.
  • Docs: a new "Items in Classic and Tactical battles" section and the native: false and "What reads items" lines in docs/extending/writing-rulesets.md, the Items line in docs/game/combat.md, the I8-1 record in docs/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 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, rebased onto staging with the money slice (Fedora):

  • pnpm check, pnpm localization:check and prettier: clean.
  • pnpm regression: 480 of 480. After the last fix, 479 of 480: mari-completion-frames timed out while the e2e ran beside it, and passes alone.
  • pnpm smoke:ui: 7 passed.
  • Desktop e2e (every ruleset, inventory, combat and Game Mode dice spec): 52 passed. Mobile e2e (every ruleset spec): 27 passed.

Lanes:

  • New game-ruleset-classic-items.regression.ts: the mapping (the poultice, a firepot with fire and Shaken for three rounds, a war horn's buff, a name the fight lists it by, the floor and the ceiling, charges and a gate left out, no use, a heal with no amount, an attack with nothing, a condition alone as a status, targets, a debuff and a buff with no strength); which items a battle offers (native on, native off, no book); the heal strength (a ruleset heal by its power, a guessed heal by its name); the server's own reading; the encounter's start through Fastify against a local model fixture (the prompt names the ruleset's items, their guesses are dropped, native off asks for none); the Classic round route (a forged effect replaced, a coat and a missing item refused, a plain rope used, a plain rope marked as the ruleset's still healing by its name, native off); the screen-played Tactical route (the poultice, the coat and a missing item refused, the rope taken); and the director's start (the forged effects replaced, the coat not offered).
  • combat-director-route.regression.ts: the cursed ring that proves a bound cursed item cannot be spent now has a use, since a ruleset item with none is no longer offered.
  • combat-boss-provider, hybrid-terrain-route and ruleset-combat-director-route follow the new native-off prompt text and refusal.
  • New e2e/game-ruleset-classic-items.e2e.ts: a real encounter start against a local model fixture, then a Classic battle whose Items menu offers the poultice as "heals 1d4 + 1, range 0" and the rope as guessed, leaves the coat out (even with an older guess for it saved in the fight), and whose poultice heals 11 of 100 and leaves two in the bag.

40 deliberate breaks, each caught by these lanes and the e2e. One slipped past on the first run: the screen hid a ruleset item only by the absence of its effect, so dropping the check that the effect is the Engine's own went unseen. The e2e now seeds a fight saved with an older guess for the coat, which must stay hidden.

Local CodeRabbit raised three findings over two passes:

  • Real: the screen-played Tactical route still used the old native-off check, so it could take a ruleset item it cannot apply, or any item with native items on. Fixed: it takes only a plain item the battle offers (pinned in the lane and by two more breaks).
  • Real: the comment above the refusal message still described the old one. Fixed.
  • Checked and already covered: it asked to strip a client-sent ruleset mark in the Classic round route. The route's schema strips unknown keys, so the mark never reaches the handler; the lane now proves it (a plain rope marked as the ruleset's heals by its name, 30 of 100, not the forged strength).
  • Declined as restyling: it asked the screen-played Tactical check to compare names through gameInventoryNameKey. The Engine names each worked effect with its line's name verbatim, so the exact comparison is already right.

The first full gate run caught one more thing: game-combat-ai.e2e.ts hands a Classic fight a Potion the chat does not hold, and the new "only what the battle offers" check had started refusing that in games without a ruleset too. That check now applies only in a game whose ruleset has items; a game without them is checked no more than it ever was (pinned in the lane for both routes, and by two more breaks).

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/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 is added to it there.

UI evidence (if applicable)

A Classic battle's Items menu offers "Rope: Tangles a foe's legs" and "Poultice ×3: heals 1d4 + 1, range 0", and not the leather coat (captured by e2e/game-ruleset-classic-items.e2e.ts as classic-ruleset-items.png).

Summary by CodeRabbit

  • New Features
    • In Engine-handled Classic and Tactical combat, supported ruleset-defined items apply their specified effects, including healing, attacks, and status effects.
    • Items without a supported use, or requiring charges or a prerequisite, aren’t offered in combat.
    • Ruleset-defined items remain available when a ruleset disables native Game Mode items; native items are offered only when enabled.
  • Bug Fixes
    • Ruleset-defined effects take precedence over model-generated guesses, and ruleset healing strength reflects its specified power.

🔄 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/6908 **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-classic-fights` --- ### 📝 Commits (4) - [`e18e2d4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e18e2d42930113563f55cee8c4320fbc022ea221) feat(rulesets): a ruleset's items fight by their own use in Classic and Tactical battles (#6905) - [`bae5635`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bae56357d4ccf5abbf22c2b6d9e994c384b5c8a0) fix(rulesets): a plain item sharing a ruleset item's name keeps its own guess in either order (#6905) - [`68063a6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/68063a6e275c98de1b4a03b31ba1ed65f9e3bc80) docs: the I8-1 record holds its own break count, and an earlier record keeps its own - [`7b0948f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7b0948f771ae839e9f33148d9c559edfbd8fc51d) docs: the item-gate record keeps its own break count ### 📊 Changes **20 files changed** (+1163 additions, -56 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+31 -0) 📝 `docs/extending/writing-rulesets.md` (+15 -2) 📝 `docs/game/combat.md` (+1 -1) ➕ `e2e/game-ruleset-classic-items.e2e.ts` (+196 -0) 📝 `packages/client/src/components/game/GameSurface.tsx` (+15 -7) 📝 `packages/server/src/routes/combat-director.routes.ts` (+7 -11) 📝 `packages/server/src/routes/encounter.routes.ts` (+30 -12) 📝 `packages/server/src/routes/game.routes.ts` (+36 -11) 📝 `packages/server/src/services/game/combat.service.ts` (+9 -5) 📝 `packages/server/src/services/game/game-inventory.service.ts` (+23 -0) 📝 `packages/shared/src/features/rulesets/combat-bridge.ts` (+2 -2) ➕ `packages/shared/src/features/rulesets/item-fight.ts` (+104 -0) 📝 `packages/shared/src/index.ts` (+1 -0) 📝 `packages/shared/src/types/combat-encounter.ts` (+3 -0) 📝 `scripts/regressions/combat-boss-provider.regression.ts` (+1 -1) 📝 `scripts/regressions/combat-director-route.regression.ts` (+11 -0) ➕ `scripts/regressions/game-ruleset-classic-items.regression.ts` (+669 -0) 📝 `scripts/regressions/hybrid-terrain-route.regression.ts` (+2 -2) 📝 `scripts/regressions/ruleset-combat-director-route.regression.ts` (+5 -2) </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 #6905 ## Why this change - A Game Mode ruleset that does not resolve its own fights leaves them to Classic and Tactical battles, and when one starts a model guesses what every item in the inventory does. That included the ruleset's own items, even though one that can be used already says exactly what it does in its `use` (Capability API 1.59): a poultice could be guessed as a weapon. The ruleset's items with no use (a coat, a spade) were offered too, doing whatever was guessed, and a ruleset with native items off offered nothing at all. This is slice I8-1 of the ruleset items plan. - The screen also sent each item's effect with the round, and the server used it as sent. ## What changed - **An item's `use` is its fight effect** (`rulesetItemFightEffect`, new `features/rulesets/item-fight.ts`): - a `heal` heals and an `attack` harms by a share of the target's maximum health, from the average of its `amount`, on the scale the combat bridge already reads a catalog entry's numbers on (an average of 7 is 0.22 of a maximum, from 0.05 to all of it); - the damage type is the element, and the first applied condition goes on as a status by the ruleset's own name, for its rounds (2 without); a buff or debuff is that status alone; - `targets`, or a friend for a heal or buff and a foe otherwise; - `consumes: true` spends one, and a use without it keeps the item. - **Which items a battle offers** (`gameFightItems`): plain items while native items are on, and the ruleset's own items only when they have an effect. A guess for one of the ruleset's items, or one that claims to be the ruleset's, is dropped. A game without ruleset items is unchanged: every item is guessed at. - **The server works it out everywhere:** - the encounter's start tells the model which items it must leave alone (or asks for none with native off) and replaces what it guessed for them; - the combat director's start no longer trusts the screen's effects for the ruleset's items; - in a game with ruleset items, the Classic round route refuses an item the battle does not offer ("That item does nothing in this fight.") and puts the worked-out effect on one of the ruleset's, whatever the screen sent; - in such a game, the screen-played Tactical route, whose engine heals with any item it is handed and reads no effect, takes only a plain item the battle offers. The screen offers no items there; directed Tactical battles do, through the director; - a game without ruleset items is checked no more than before. - **A ruleset heal heals by its own strength**; a guessed heal still goes by what its name suggests, as before. - **The screen** lists one of the ruleset's items only when the battle's effects include it. - **Left for I8-2:** an item that spends charges, or asks a check first (`gate`), is not offered in these battles yet, as the combat bridge leaves out a skill whose cost it cannot charge. - **Docs:** a new "Items in Classic and Tactical battles" section and the `native: false` and "What reads items" lines in `docs/extending/writing-rulesets.md`, the Items line in `docs/game/combat.md`, the I8-1 record in `docs/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 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, rebased onto staging with the money slice (Fedora): - `pnpm check`, `pnpm localization:check` and prettier: clean. - `pnpm regression`: 480 of 480. After the last fix, 479 of 480: `mari-completion-frames` timed out while the e2e ran beside it, and passes alone. - `pnpm smoke:ui`: 7 passed. - Desktop e2e (every ruleset, inventory, combat and Game Mode dice spec): 52 passed. Mobile e2e (every ruleset spec): 27 passed. Lanes: - New `game-ruleset-classic-items.regression.ts`: the mapping (the poultice, a firepot with fire and Shaken for three rounds, a war horn's buff, a name the fight lists it by, the floor and the ceiling, charges and a gate left out, no use, a heal with no amount, an attack with nothing, a condition alone as a status, `targets`, a debuff and a buff with no strength); which items a battle offers (native on, native off, no book); the heal strength (a ruleset heal by its power, a guessed heal by its name); the server's own reading; the encounter's start through Fastify against a local model fixture (the prompt names the ruleset's items, their guesses are dropped, native off asks for none); the Classic round route (a forged effect replaced, a coat and a missing item refused, a plain rope used, a plain rope marked as the ruleset's still healing by its name, native off); the screen-played Tactical route (the poultice, the coat and a missing item refused, the rope taken); and the director's start (the forged effects replaced, the coat not offered). - `combat-director-route.regression.ts`: the cursed ring that proves a bound cursed item cannot be spent now has a use, since a ruleset item with none is no longer offered. - `combat-boss-provider`, `hybrid-terrain-route` and `ruleset-combat-director-route` follow the new native-off prompt text and refusal. - New `e2e/game-ruleset-classic-items.e2e.ts`: a real encounter start against a local model fixture, then a Classic battle whose Items menu offers the poultice as "heals 1d4 + 1, range 0" and the rope as guessed, leaves the coat out (even with an older guess for it saved in the fight), and whose poultice heals 11 of 100 and leaves two in the bag. 40 deliberate breaks, each caught by these lanes and the e2e. One slipped past on the first run: the screen hid a ruleset item only by the absence of its effect, so dropping the check that the effect is the Engine's own went unseen. The e2e now seeds a fight saved with an older guess for the coat, which must stay hidden. Local CodeRabbit raised three findings over two passes: - Real: the screen-played Tactical route still used the old native-off check, so it could take a ruleset item it cannot apply, or any item with native items on. Fixed: it takes only a plain item the battle offers (pinned in the lane and by two more breaks). - Real: the comment above the refusal message still described the old one. Fixed. - Checked and already covered: it asked to strip a client-sent `ruleset` mark in the Classic round route. The route's schema strips unknown keys, so the mark never reaches the handler; the lane now proves it (a plain rope marked as the ruleset's heals by its name, 30 of 100, not the forged strength). - Declined as restyling: it asked the screen-played Tactical check to compare names through `gameInventoryNameKey`. The Engine names each worked effect with its line's name verbatim, so the exact comparison is already right. The first full gate run caught one more thing: `game-combat-ai.e2e.ts` hands a Classic fight a Potion the chat does not hold, and the new "only what the battle offers" check had started refusing that in games without a ruleset too. That check now applies only in a game whose ruleset has items; a game without them is checked no more than it ever was (pinned in the lane for both routes, and by two more breaks). ## 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/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 is added to it there. ## UI evidence (if applicable) A Classic battle's Items menu offers "Rope: Tangles a foe's legs" and "Poultice ×3: heals 1d4 + 1, range 0", and not the leather coat (captured by `e2e/game-ruleset-classic-items.e2e.ts` as `classic-ruleset-items.png`). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * In Engine-handled Classic and Tactical combat, supported ruleset-defined items apply their specified effects, including healing, attacks, and status effects. * Items without a supported use, or requiring charges or a prerequisite, aren’t offered in combat. * Ruleset-defined items remain available when a ruleset disables native Game Mode items; native items are offered only when enabled. * **Bug Fixes** * Ruleset-defined effects take precedence over model-generated guesses, and ruleset healing strength reflects its specified power. <!-- 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:10 +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#7378
No description provided.