[PR #6689] [MERGED] feat(game): wound tracks of boxes, filled by box, refusing when full, healed by kind, lengthened by a list #7288

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

📋 Pull Request Information

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

Base: staging ← Head: feat/ruleset-wound-boxes


📝 Commits (3)

  • d997659 feat(game): wound tracks of boxes, filled by box, refusing when full, healed by kind, lengthened by a list
  • cae8394 fix(game): a heal may leave its kind out; the schema says an indexed track refuses when full
  • aaeab89 Merge remote-tracking branch 'origin/staging' into feat/ruleset-wound-boxes

📊 Changes

34 files changed (+1668 additions, -207 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+38 -0)
📝 docs/examples/rulesets/ember-roads.json (+26 -0)
📝 docs/examples/rulesets/gravewatch.json (+21 -1)
📝 docs/extending/ruleset.schema.json (+159 -3)
📝 docs/extending/writing-rulesets.md (+50 -8)
📝 docs/game/party-and-npcs.md (+1 -1)
📝 e2e/ruleset-wound-sheet.e2e.ts (+108 -0)
📝 packages/client/src/components/game/GameRulesetSheet.tsx (+55 -21)
📝 packages/client/src/localization/locales/en.json (+4 -0)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+26 -0)
📝 packages/server/src/services/game/gm-prompts.ts (+10 -4)
📝 packages/server/src/services/game/skill-check-resolution.service.ts (+1 -1)
📝 packages/shared/src/features/ruleset-combat/encounter.ts (+1 -1)
📝 packages/shared/src/features/ruleset-combat/resolve.ts (+55 -25)
📝 packages/shared/src/features/rulesets/combat-bridge.ts (+6 -3)
📝 packages/shared/src/features/rulesets/live-state.ts (+252 -82)
📝 packages/shared/src/features/rulesets/sheet-prompt.ts (+2 -1)
📝 packages/shared/src/schemas/capability-package.schema.ts (+7 -1)
📝 packages/shared/src/schemas/ruleset.schema.ts (+103 -22)

...and 14 more files

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

Why this change

The author of Marinara-RPG-Extension wrote two of their shipped tabletop systems as ruleset.json files. A wound track could only be a fixed list of named levels that fills from the top, upgrades its lightest mark when full and heals lightest first, which left four common rules unsayable:

  • A track's length per character. Many systems give a character as many boxes as a rating (size plus stamina, a base plus half of body), with a penalty that is a table over boxes filled or remaining.
  • Boxes that are aimed at. Some systems mark the box a hit's strength names, or the next free one above, and a hit with no such box free is not absorbed at all.
  • Healing one kind of harm. Bashing heals quickly, lethal slowly and aggravated only with rest; "clear the bashing, leave the lethal" could not be said by a rest or by a command.
  • Extra levels a character earns. A power that adds health levels at a penalty the player picks.

This is slice 4 of the series in the plan doc (§ Gaps a ruleset author found). Slices 1 to 3 were #6663, #6669 and #6682.

What changed

Capability API 1.40 (file keys: boxes, fill, onFull and extra on a live track, and kind on a rest's restore step). None of it names one game's words.

  • Numbered boxes. A wound track is kinds plus exactly one of levels or boxes. A box track has as many boxes as its own max, which may be a value the sheet works out for each character (never a live one), up to 64. Its penalty is boxes.penalty.table read at boxes filled or remaining, always, so a table can cost something with nothing marked. Differs from the issue on purpose: the issue put the count in boxes.count, but a track already says how long it is in max, which has read the sheet per character since 1.37; a second count would have had to agree with it.
  • Filling by box. fill: "indexed" puts a mark on the box the command names or the next free one above, and never moves a mark once it is down; marks are stored by position. onFull: "refuse" refuses a mark with no box free instead of upgrading the lightest one, and refuses the whole command, so three marks with two boxes free land none. An indexed track always refuses. The new refusal reason is no-box. The damage command gained an optional box rather than giving amount a second meaning, so every existing caller still means "this many marks".
  • Healing by kind. A heal that names one of the track's kinds clears only that kind, overflow first; one that names none (or a kind the track does not have) keeps clearing the lightest first. A rest's restore step may name a kind. This changes one existing behaviour on purpose: until now a heal's kind was ignored, and every heal carried one (a fight's mending carried the default kind, the combat bridge the lightest). Fights and the bridge now heal with no kind, so their healing still clears any harm; a Game Master's heal that names a kind now clears that kind, which is what it said.
  • Extra levels. extra: { list, countColumn, penaltyColumn } on a track with named levels: each row (at most 16 levels) goes after the last level at least as good, named after it when the penalties match. A hidden list adds nothing. Marks past a track that shrank (a row deleted) are kept as overflow, so harm is not undone by editing the sheet.
  • Per-character readers. Every reader that took a wound track's length off the definition now reads this character's resolved track: combat health, the Marinara combat bridge, the Game Master's sheet line, the sheet screen and the roll penalty (readRulesetWoundPenalty now takes the build).
  • A fight. On a track that fills by box, per-point damage names the box it lands on and per-blow aims at the first. A blow that no box can take puts a standing combatant down, which is what being taken out means in the systems that keep such a track; without it such a fight could never end. Such a combatant is down with boxes still clear, so being down is now read off the combatant rather than off their health: a later blow does not put them down twice, and a heal that clears a mark brings them back.
  • Sheet screen. A box track shows "Box N" (localized), any clear box of a track that fills by box can be clicked, only the box a heal would clear is offered for clearing, Mark is off when a refusing track is full, and the penalty is said in boxes. New strings are localized in en.json.
  • Reminder. A box track is listed as numbered boxes with how it fills, box="N" is taught only where a track fills by box, and the damage line says a heal clears marks of the kind it names.
  • Install gate: each new key needs 1.40; a track with levels and a rest with no kind need nothing new.
  • Docs: author guide (docs/extending/writing-rulesets.md, including the healing rule, which said a heal always clears the lightest), player page (docs/game/party-and-npcs.md), the regenerated JSON Schema (kinds beside levels or boxes, never both), the plan doc's slice 4 notes, CHANGELOG. Gravewatch gains a Scars list that adds levels to Harm and a "Catch your breath" rest that clears only knocks; Ember Roads gains a Strain track of boxes that fills by box and refuses when full.

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 d997659b9 (this branch's one commit on staging 1cacd68ed), all exit 0: pnpm check, pnpm localization:check, pnpm regression:node (380/380), pnpm ruleset:schema (no diff after regeneration), pnpm smoke:ui (7/7), and pnpm regression:ui e2e/ruleset-wound-sheet.e2e.ts e2e/game-combat-director.e2e.ts --project=desktop-chromium --workers=1 (7/7: the wound sheet in light and dark, the new box-track case, and the ruleset fights). Mobile projects were not run locally; the sheet screen's layout did not change beyond the box labels. Local CodeRabbit, six completed passes (three more lost their connection and were re-run): eleven findings, all fixed, the last pass clean. The substantive ones: a box penalty table now runs strictly up like every step table; a combatant taken out with boxes still clear is not put down twice and is revived by a heal; no box is offered for clearing while marks have spilled over; a two-part blow names its box by its whole damage (2 + 2 marks box 4, not boxes 2 and 3); a box track's status always says its count; extra levels stop at the cap.

  • New lane scripts/regressions/game-ruleset-wound-boxes.regression.ts covers every import refusal, box tracks and their table, filling by box (whole or not at all), refusing when full, healing by kind (and overflow first), rests that name a kind, extra levels (position, name, cap, hidden list, a shrunk track's overflow), the penalty reader, the sheet line, the reminder, the box= attribute, a fight (a box per point, and a hit no box can take) and the 1.40 gate. Thirty-four deliberate breaks were each caught, and each fix CodeRabbit prompted adds a case that fails without it (a blow while down and a mending, a two-part blow, the ascending table).
  • e2e/ruleset-wound-sheet.e2e.ts gains a case for Ember Roads' Strain on the sheet screen: the box clicked is the box marked, Clear one takes the highest, and a full track turns Mark off.
  • Existing lanes that test an older gate strip the 1.40 keys, the heal expectations follow the new kind rule (a fight's and the bridge's heals carry no kind), and the penalty reader is called with the build.

Still to verify by hand (not done by the agent):

  • In a Game Mode game on Ember Roads, open the ruleset sheet for a traveller with Heart 2: confirm Strain shows four boxes, clicking Box 3 marks box 3, and Clear one then clears it; fill all four and confirm Mark turns off and the line says "Strain has 4 of 4 boxes marked, so -1 applies to your rolls", in light and dark mode and at mobile width.
  • Have the Game Master write [sheet: op="damage" track="Strain" kind="strain" amount="1" box="4"] twice: confirm the second is refused and the notice says every box that could take it is marked.
  • On Gravewatch, add a Scars row with 2 levels at -1 in the sheet editor: confirm Harm shows six boxes with the two new ones named Winded, then delete the row with all six marked and confirm the two extra marks show as "had nowhere to go".
  • On Gravewatch, mark a tear and two knocks, then use Catch your breath: confirm only the tear remains.

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 (not carried by docs-i18n), docs/game/party-and-npcs.md (carried by docs-i18n), docs/extending/ruleset.schema.json, docs/examples/rulesets/gravewatch.json, docs/examples/rulesets/ember-roads.json, docs/development/game-rulesets-and-sheets-implementation.md (internal plan), CHANGELOG.md. Translations are batched into one later pass by the maintainer's standing decision, so no per-PR [docs-i18n] issue is opened here.

UI evidence (if applicable)

None attached. The new browser case saves a screenshot of the full box track (four marked boxes, Mark turned off, the penalty said in boxes); the manual steps above cover it in both themes and at mobile width.

Summary by CodeRabbit

  • New Features

    • Wound tracks can use numbered boxes, with configurable lengths and penalties based on boxes filled or remaining.
    • Indexed tracks let players mark specific boxes and refuse marks when full; an unmarkable combat hit can take a character out.
    • Healing and rests can target a specific kind of harm, and sheet lists can add wound levels.
    • Rulesets can use these features with Capability API 1.40.
  • Bug Fixes

    • Improved wound-track marking, clearing, overflow handling, and health reporting for numbered-box tracks.

🔄 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/6689 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/25/2026 **Status:** ✅ Merged **Merged:** 9/25/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/ruleset-wound-boxes` --- ### 📝 Commits (3) - [`d997659`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d997659b9d66fff3bcd7913c5fbc2e72b19089d9) feat(game): wound tracks of boxes, filled by box, refusing when full, healed by kind, lengthened by a list - [`cae8394`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cae83946562c9836456010974368a917fd252c79) fix(game): a heal may leave its kind out; the schema says an indexed track refuses when full - [`aaeab89`](https://github.com/Pasta-Devs/Marinara-Engine/commit/aaeab89a82ebd37d187cd860abef74d0269a62bd) Merge remote-tracking branch 'origin/staging' into feat/ruleset-wound-boxes ### 📊 Changes **34 files changed** (+1668 additions, -207 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+38 -0) 📝 `docs/examples/rulesets/ember-roads.json` (+26 -0) 📝 `docs/examples/rulesets/gravewatch.json` (+21 -1) 📝 `docs/extending/ruleset.schema.json` (+159 -3) 📝 `docs/extending/writing-rulesets.md` (+50 -8) 📝 `docs/game/party-and-npcs.md` (+1 -1) 📝 `e2e/ruleset-wound-sheet.e2e.ts` (+108 -0) 📝 `packages/client/src/components/game/GameRulesetSheet.tsx` (+55 -21) 📝 `packages/client/src/localization/locales/en.json` (+4 -0) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+26 -0) 📝 `packages/server/src/services/game/gm-prompts.ts` (+10 -4) 📝 `packages/server/src/services/game/skill-check-resolution.service.ts` (+1 -1) 📝 `packages/shared/src/features/ruleset-combat/encounter.ts` (+1 -1) 📝 `packages/shared/src/features/ruleset-combat/resolve.ts` (+55 -25) 📝 `packages/shared/src/features/rulesets/combat-bridge.ts` (+6 -3) 📝 `packages/shared/src/features/rulesets/live-state.ts` (+252 -82) 📝 `packages/shared/src/features/rulesets/sheet-prompt.ts` (+2 -1) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+7 -1) 📝 `packages/shared/src/schemas/ruleset.schema.ts` (+103 -22) _...and 14 more files_ </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 #6654 ## Why this change The author of [Marinara-RPG-Extension](https://github.com/Kenhito/Marinara-RPG-Extension) wrote two of their shipped tabletop systems as `ruleset.json` files. A wound track could only be a fixed list of named levels that fills from the top, upgrades its lightest mark when full and heals lightest first, which left four common rules unsayable: - **A track's length per character.** Many systems give a character as many boxes as a rating (size plus stamina, a base plus half of body), with a penalty that is a table over boxes filled or remaining. - **Boxes that are aimed at.** Some systems mark the box a hit's strength names, or the next free one above, and a hit with no such box free is not absorbed at all. - **Healing one kind of harm.** Bashing heals quickly, lethal slowly and aggravated only with rest; "clear the bashing, leave the lethal" could not be said by a rest or by a command. - **Extra levels a character earns.** A power that adds health levels at a penalty the player picks. This is slice 4 of the series in the plan doc (§ Gaps a ruleset author found). Slices 1 to 3 were #6663, #6669 and #6682. ## What changed Capability API **1.40** (file keys: `boxes`, `fill`, `onFull` and `extra` on a live track, and `kind` on a rest's restore step). None of it names one game's words. - **Numbered boxes.** A wound track is `kinds` plus exactly one of `levels` or `boxes`. A box track has as many boxes as its own `max`, which may be a value the sheet works out for each character (never a live one), up to 64. Its penalty is `boxes.penalty.table` read at boxes filled or remaining, always, so a table can cost something with nothing marked. **Differs from the issue on purpose:** the issue put the count in `boxes.count`, but a track already says how long it is in `max`, which has read the sheet per character since 1.37; a second count would have had to agree with it. - **Filling by box.** `fill: "indexed"` puts a mark on the box the command names or the next free one above, and never moves a mark once it is down; marks are stored by position. `onFull: "refuse"` refuses a mark with no box free instead of upgrading the lightest one, and refuses the whole command, so three marks with two boxes free land none. An indexed track always refuses. The new refusal reason is `no-box`. The damage command gained an optional `box` rather than giving `amount` a second meaning, so every existing caller still means "this many marks". - **Healing by kind.** A heal that names one of the track's kinds clears only that kind, overflow first; one that names none (or a kind the track does not have) keeps clearing the lightest first. A rest's restore step may name a `kind`. **This changes one existing behaviour on purpose:** until now a heal's kind was ignored, and every heal carried one (a fight's mending carried the default kind, the combat bridge the lightest). Fights and the bridge now heal with no kind, so their healing still clears any harm; a Game Master's heal that names a kind now clears that kind, which is what it said. - **Extra levels.** `extra: { list, countColumn, penaltyColumn }` on a track with named levels: each row (at most 16 levels) goes after the last level at least as good, named after it when the penalties match. A hidden list adds nothing. Marks past a track that shrank (a row deleted) are kept as overflow, so harm is not undone by editing the sheet. - **Per-character readers.** Every reader that took a wound track's length off the definition now reads this character's resolved track: combat health, the Marinara combat bridge, the Game Master's sheet line, the sheet screen and the roll penalty (`readRulesetWoundPenalty` now takes the build). - **A fight.** On a track that fills by box, `per-point` damage names the box it lands on and `per-blow` aims at the first. A blow that no box can take puts a standing combatant down, which is what being taken out means in the systems that keep such a track; without it such a fight could never end. Such a combatant is down with boxes still clear, so being down is now read off the combatant rather than off their health: a later blow does not put them down twice, and a heal that clears a mark brings them back. - **Sheet screen.** A box track shows "Box N" (localized), any clear box of a track that fills by box can be clicked, only the box a heal would clear is offered for clearing, Mark is off when a refusing track is full, and the penalty is said in boxes. New strings are localized in `en.json`. - **Reminder.** A box track is listed as numbered boxes with how it fills, `box="N"` is taught only where a track fills by box, and the damage line says a heal clears marks of the kind it names. - **Install gate:** each new key needs 1.40; a track with levels and a rest with no kind need nothing new. - **Docs:** author guide (`docs/extending/writing-rulesets.md`, including the healing rule, which said a heal always clears the lightest), player page (`docs/game/party-and-npcs.md`), the regenerated JSON Schema (`kinds` beside `levels` or `boxes`, never both), the plan doc's slice 4 notes, CHANGELOG. **Gravewatch** gains a Scars list that adds levels to Harm and a "Catch your breath" rest that clears only knocks; **Ember Roads** gains a Strain track of boxes that fills by box and refuses when full. ## 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 d997659b9 (this branch's one commit on staging 1cacd68ed), all exit 0: `pnpm check`, `pnpm localization:check`, `pnpm regression:node` (380/380), `pnpm ruleset:schema` (no diff after regeneration), `pnpm smoke:ui` (7/7), and `pnpm regression:ui e2e/ruleset-wound-sheet.e2e.ts e2e/game-combat-director.e2e.ts --project=desktop-chromium --workers=1` (7/7: the wound sheet in light and dark, the new box-track case, and the ruleset fights). Mobile projects were not run locally; the sheet screen's layout did not change beyond the box labels. Local CodeRabbit, six completed passes (three more lost their connection and were re-run): eleven findings, all fixed, the last pass clean. The substantive ones: a box penalty table now runs strictly up like every step table; a combatant taken out with boxes still clear is not put down twice and is revived by a heal; no box is offered for clearing while marks have spilled over; a two-part blow names its box by its whole damage (2 + 2 marks box 4, not boxes 2 and 3); a box track's status always says its count; extra levels stop at the cap. - New lane `scripts/regressions/game-ruleset-wound-boxes.regression.ts` covers every import refusal, box tracks and their table, filling by box (whole or not at all), refusing when full, healing by kind (and overflow first), rests that name a kind, extra levels (position, name, cap, hidden list, a shrunk track's overflow), the penalty reader, the sheet line, the reminder, the `box=` attribute, a fight (a box per point, and a hit no box can take) and the 1.40 gate. Thirty-four deliberate breaks were each caught, and each fix CodeRabbit prompted adds a case that fails without it (a blow while down and a mending, a two-part blow, the ascending table). - `e2e/ruleset-wound-sheet.e2e.ts` gains a case for Ember Roads' Strain on the sheet screen: the box clicked is the box marked, Clear one takes the highest, and a full track turns Mark off. - Existing lanes that test an older gate strip the 1.40 keys, the heal expectations follow the new kind rule (a fight's and the bridge's heals carry no kind), and the penalty reader is called with the build. Still to verify by hand (not done by the agent): - In a Game Mode game on Ember Roads, open the ruleset sheet for a traveller with Heart 2: confirm Strain shows four boxes, clicking Box 3 marks box 3, and Clear one then clears it; fill all four and confirm Mark turns off and the line says "Strain has 4 of 4 boxes marked, so -1 applies to your rolls", in light and dark mode and at mobile width. - Have the Game Master write `[sheet: op="damage" track="Strain" kind="strain" amount="1" box="4"]` twice: confirm the second is refused and the notice says every box that could take it is marked. - On Gravewatch, add a Scars row with 2 levels at -1 in the sheet editor: confirm Harm shows six boxes with the two new ones named Winded, then delete the row with all six marked and confirm the two extra marks show as "had nowhere to go". - On Gravewatch, mark a tear and two knocks, then use Catch your breath: confirm only the tear remains. ## 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` (not carried by `docs-i18n`), `docs/game/party-and-npcs.md` (carried by `docs-i18n`), `docs/extending/ruleset.schema.json`, `docs/examples/rulesets/gravewatch.json`, `docs/examples/rulesets/ember-roads.json`, `docs/development/game-rulesets-and-sheets-implementation.md` (internal plan), `CHANGELOG.md`. Translations are batched into one later pass by the maintainer's standing decision, so no per-PR `[docs-i18n]` issue is opened here. ## UI evidence (if applicable) None attached. The new browser case saves a screenshot of the full box track (four marked boxes, Mark turned off, the penalty said in boxes); the manual steps above cover it in both themes and at mobile width. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Wound tracks can use numbered boxes, with configurable lengths and penalties based on boxes filled or remaining. * Indexed tracks let players mark specific boxes and refuse marks when full; an unmarkable combat hit can take a character out. * Healing and rests can target a specific kind of harm, and sheet lists can add wound levels. * Rulesets can use these features with Capability API 1.40. * **Bug Fixes** * Improved wound-track marking, clearing, overflow handling, and health reporting for numbered-box tracks. <!-- 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:17 +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#7288
No description provided.