[PR #6866] [MERGED] feat(rulesets): armor and worn effects in ruleset fights, resolution.adjust in fights, and hardness (#6857) #7360

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

📋 Pull Request Information

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

Base: staging ← Head: feat/ruleset-items-armor


📝 Commits (4)

  • 3cb58aa feat(rulesets): armor and worn effects in ruleset fights, resolution.adjust in fights, and hardness (#6857)
  • 1635c86 fix(rulesets): hardness forecast for areas, no hardness on invented opponents, clearer adjacent-critical text (#6857)
  • 1a89947 Merge remote-tracking branch 'origin/staging' into feat/ruleset-items-armor
  • fd655ee docs(changelog): say a blow below hardness lands but does no damage (#6857)

📊 Changes

34 files changed (+2907 additions, -659 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+57 -0)
📝 docs/examples/rulesets/ember-roads.json (+5 -1)
📝 docs/examples/rulesets/gravewatch.json (+15 -2)
📝 docs/extending/ruleset.schema.json (+863 -536)
📝 docs/extending/writing-rulesets.md (+43 -11)
➕ e2e/game-ruleset-armor.e2e.ts (+101 -0)
📝 packages/client/src/components/game/RulesetItemPicker.tsx (+41 -0)
📝 packages/client/src/lib/ruleset-combat-log.ts (+11 -1)
📝 packages/client/src/localization/locales/en.json (+20 -0)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+47 -0)
📝 packages/server/src/services/game/gm-prompts.ts (+19 -4)
📝 packages/shared/src/features/ruleset-combat/creatures.ts (+6 -0)
📝 packages/shared/src/features/ruleset-combat/encounter.ts (+148 -23)
📝 packages/shared/src/features/ruleset-combat/index.ts (+2 -0)
📝 packages/shared/src/features/ruleset-combat/options.ts (+8 -2)
📝 packages/shared/src/features/ruleset-combat/resolve.ts (+23 -7)
📝 packages/shared/src/features/ruleset-combat/types.ts (+9 -0)
📝 packages/shared/src/features/rulesets/check-effects.ts (+22 -0)
📝 packages/shared/src/features/rulesets/invented-items.ts (+95 -4)

...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 #6857

Why this change

  • A ruleset's items could be weapons in a fight (#6855) and change checks while worn or carried (#6832, #6846), but they could not say what they do in a fight: a ring of protection, boots that slow nobody, a cloak that makes attacks against its wearer harder, a ring of fire resistance, or armor too heavy to move quickly in were refused at import, so the Game Master had to remember them in every fight. Two gaps sat in the same place: resolution.adjust (Ember Roads' stance on every Brawn roll, Gravewatch's light on every Nerve roll) reached checks but not a fight's attack rolls, saves, contest checks or initiative; and where initiative is spent as damage, a blow met no armor at all. This is slice I5-2 of the ruleset items plan.

What changed

  • Items in a fight (Capability API 1.56): an item's worn and carried take every condition effect but the four a level cannot have (nobody put an item on its holder, and it never ends by itself), modifiers to defense, attacks and speed, and new resist, vulnerable, immune and conditionImmunities. A fight reads them for the holder alongside their conditions and levels, each item once and named for the stack, and so does an unmet requirement's otherwise: attacks, defense, speed, effects, failed saves, the harm a blow does, and conditions a blow or a crash would put on. A check outside a fight still reads only the check and save parts.
  • resolution.adjust in a fight. Every roll a fight builds from a sheet adds it as a check does: attack rows and weapons, ability entries that roll to hit, saves, contest checks and initiative, as the fight opens and when it is thrown again. A roll read off an ability, a skill or a save takes that ability's entries; anything else takes only the entries for every roll.
  • Hardness. combat.pool.hardness reads a fighter's hardness off their sheet (their armor's, through itemStat), and a creature may give its own hardness. A spending blow whose dice are below it lands and does nothing: the number goes back to the base, the log says so, and the menu forecasts no harm for it. Only where a style spends initiative; a creature written as a sheet takes it from the sheet.
  • Seen and said. Item facts, the item's details and the Game Master's line say all of it ("While worn: -1 on attacks", "resists burn", "immune to Rattled", "+1 Guard", "half speed", the fight effects in words), and the fight log names the item beside a roll.
  • Invented items read +N, -N, advantage or disadvantage on attacks and +N or -N on defense (or the ruleset's word for it, "Guard"), held to the rarity's bonus; the proposal form says so, and names the item stat the defense already counts. An invented item that gives such a stat drops a worn change to defense beside it, since a small model writes both for one +1. A copied speed change is not capped, since it is a distance rather than a bonus.
  • Checked at import: the effects an item may have, damage types against combat.damageTypes, conditions, hardness only with a spending style, and a sheet creature's hardness refused. The install gate asks for 1.56 in the ruleset file and in catalog files.
  • Examples. Ember Roads' waystone, carried, resists burn. Gravewatch's cursed widow's ring costs a die on attacks, and its Dawn bell, bound, keeps the bearer from being rattled.
  • Docs: an "Armor and worn effects in a fight" section, the new keys, adjust in fights, hardness in the pool block and on creatures in docs/extending/writing-rulesets.md (whose line saying fight parts were refused, and the "Not yet" line about sturdy targets, are corrected); the 1.56 record in docs/development/game-rulesets-and-sheets-implementation.md; the regenerated JSON schema; and a CHANGELOG entry.

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 this branch at 3cb58aafd (one commit on staging ff59af37e):

  • pnpm check exits 0, pnpm localization:check exits 0 and pnpm regression passes 464/464 on the final code, rebased onto current staging; Prettier passes on the changed files.
  • pnpm smoke:ui passes 7/7. On --project=desktop-chromium, the ruleset, inventory, game dice and combat director specs (e2e/game-ruleset-*.e2e.ts, e2e/ruleset-*.e2e.ts, e2e/game-inventory-*.e2e.ts, e2e/game-native-dice.e2e.ts, e2e/game-one-request-dice.e2e.ts, e2e/game-combat-director.e2e.ts) pass 27/27, and the game ruleset specs pass 8/8 on --project=mobile-chromium. These ran before the review fixes below and the last rebase; after both, the two item specs (e2e/game-ruleset-armor.e2e.ts and e2e/game-ruleset-weapons.e2e.ts) passed again on desktop.

Lanes:

  • New game-ruleset-armor.regression.ts: every part at import and at the gate (each alone, a requirement's cost, a creature's hardness, a catalog file); items in a fight on attacks (also where no condition of the ruleset changes a number), defense on top of the coat's own guard, speed and cannot-move, attacks against the holder, failed saves, the waystone halving a cinder-moth's burn, the bell keeping Rattled off against the hollow warden's grip and an opening crash, an unmet requirement costing a die, one item once and a carried one doing nothing; the log naming the ring (even when a stack is named like a condition); resolution.adjust on attack rows, weapons, a weapon's skill, ability entries, contest checks off an ability, a save and a skill, saves, and initiative as a sum, as a pool and thrown again; hardness on the blow, at the line, in the forecast, off the sheet and out of the bestiary; item facts and the Game Master's line; invented items.
  • Lanes that pin older gates, the examples, the item facts, the published schema or the proposal form were brought up to date; the check-effects lane's refusals of fight parts, which this slice lifts, now refuse only an effect that ends by itself.
  • e2e/game-ruleset-armor.e2e.ts (desktop and phone): the ring's and the bell's details in a Gravewatch game.

Fifty-nine deliberate breaks, across the import checks, the gate, the fight's reading of items, the hide and condition immunities, adjust on each kind of roll, hardness, the facts, invented items, the proposal form and the item details on screen, were each caught.

Local CodeRabbit (coderabbit review --agent --base staging), three passes:

  • First: two findings, both fixed. A defense written as a number was named by that number in an item's facts ("+1 1"); it now reads "defense". And a dice change to attacks in a pool ruleset is now refused, as a condition's is, and left out of an invented item.
  • Second: three findings. Two fixed: "half of every harm" now reads "takes half of every harm", and a fight's modifier lookup no longer reads a fighter's items twice. One declined: moving the lanes' strip helper into a shared module, since each lane keeps its own (withoutItemReads, withoutWeapons and the rest).
  • Third: two trivial findings, declined: the same shared-helper request, and a pool check before reading combat.pool.hardness, which is redundant because combat.pool is refused outside a pool fight.

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:

  • "a studded bracer; wearing it adds +1 to my Guard": all 3 tellings wrote +1 Guard, but 2 of them also gave the bracer guard=1 (or guard=2), a stat Guard already adds up, so those bracers would have given +2 or +3. A line in the form asking for one or the other did not change that (4 of 6 in the next two runs), so the Engine now drops the worn change beside such a stat and says so. After that, 3 of 3 bracers came out +1 Guard: two by the stat, one by the worn change.
  • "a lucky amulet that gives +1 to attack rolls while worn": 2 of 3 invented it with +1 on attacks; the third wrote "+1 Attack Roll Bonus", which the Engine now reads too. Rerun after that, 3 of 3.

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 and docs/development/game-rulesets-and-sheets-implementation.md (both carried by docs-i18n), CHANGELOG.md, the generated docs/extending/ruleset.schema.json and the two example rulesets. Translations: #6813 is the items arc's follow-up; this PR is added to it there.

UI evidence (if applicable)

In a Gravewatch game where Ada wears the widow's ring and the Dawn bell, both bound, the ring's details read "While worn: -1 on attacks" and the bell's "While worn: +1 on checks (Ward); immune to Rattled" (captured by e2e/game-ruleset-armor.e2e.ts as ruleset-armor-details.png, desktop and phone).

Summary by CodeRabbit

  • New Features
    • Worn and carried items can affect combat, including attacks, defense, speed, damage resistance, vulnerabilities, immunities, and conditions.
    • Sheet-based combat rolls apply ruleset adjustments. Spending attacks below a target’s hardness land but deal no damage.
    • Inventory descriptions and combat logs show item effects and hardness outcomes.
  • Compatibility
    • Rulesets using these combat features require Capability API 1.56 or later.
  • Documentation
    • Updated ruleset guides, examples, and schema documentation to cover the new combat options.

🔄 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/6866 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/29/2026 **Status:** ✅ Merged **Merged:** 9/29/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/ruleset-items-armor` --- ### 📝 Commits (4) - [`3cb58aa`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3cb58aafd50add0c2fc002ab8679e77e9ed15904) feat(rulesets): armor and worn effects in ruleset fights, resolution.adjust in fights, and hardness (#6857) - [`1635c86`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1635c8654f84c120c92855b4db96a77cc2fd7003) fix(rulesets): hardness forecast for areas, no hardness on invented opponents, clearer adjacent-critical text (#6857) - [`1a89947`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1a8994787c7372905c6a60d2c4a023d2ac3f6e36) Merge remote-tracking branch 'origin/staging' into feat/ruleset-items-armor - [`fd655ee`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fd655ee9389db48807bbb84f327a05cab4584c3e) docs(changelog): say a blow below hardness lands but does no damage (#6857) ### 📊 Changes **34 files changed** (+2907 additions, -659 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+57 -0) 📝 `docs/examples/rulesets/ember-roads.json` (+5 -1) 📝 `docs/examples/rulesets/gravewatch.json` (+15 -2) 📝 `docs/extending/ruleset.schema.json` (+863 -536) 📝 `docs/extending/writing-rulesets.md` (+43 -11) ➕ `e2e/game-ruleset-armor.e2e.ts` (+101 -0) 📝 `packages/client/src/components/game/RulesetItemPicker.tsx` (+41 -0) 📝 `packages/client/src/lib/ruleset-combat-log.ts` (+11 -1) 📝 `packages/client/src/localization/locales/en.json` (+20 -0) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+47 -0) 📝 `packages/server/src/services/game/gm-prompts.ts` (+19 -4) 📝 `packages/shared/src/features/ruleset-combat/creatures.ts` (+6 -0) 📝 `packages/shared/src/features/ruleset-combat/encounter.ts` (+148 -23) 📝 `packages/shared/src/features/ruleset-combat/index.ts` (+2 -0) 📝 `packages/shared/src/features/ruleset-combat/options.ts` (+8 -2) 📝 `packages/shared/src/features/ruleset-combat/resolve.ts` (+23 -7) 📝 `packages/shared/src/features/ruleset-combat/types.ts` (+9 -0) 📝 `packages/shared/src/features/rulesets/check-effects.ts` (+22 -0) 📝 `packages/shared/src/features/rulesets/invented-items.ts` (+95 -4) _...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 #6857 ## Why this change - A ruleset's items could be weapons in a fight (#6855) and change checks while worn or carried (#6832, #6846), but they could not say what they do in a fight: a ring of protection, boots that slow nobody, a cloak that makes attacks against its wearer harder, a ring of fire resistance, or armor too heavy to move quickly in were refused at import, so the Game Master had to remember them in every fight. Two gaps sat in the same place: `resolution.adjust` (Ember Roads' stance on every Brawn roll, Gravewatch's light on every Nerve roll) reached checks but not a fight's attack rolls, saves, contest checks or initiative; and where initiative is spent as damage, a blow met no armor at all. This is slice I5-2 of the ruleset items plan. ## What changed - **Items in a fight** (Capability API 1.56): an item's `worn` and `carried` take every condition effect but the four a level cannot have (nobody put an item on its holder, and it never ends by itself), modifiers to defense, attacks and speed, and new `resist`, `vulnerable`, `immune` and `conditionImmunities`. A fight reads them for the holder alongside their conditions and levels, each item once and named for the stack, and so does an unmet requirement's `otherwise`: attacks, defense, speed, effects, failed saves, the harm a blow does, and conditions a blow or a crash would put on. A check outside a fight still reads only the check and save parts. - **`resolution.adjust` in a fight.** Every roll a fight builds from a sheet adds it as a check does: attack rows and weapons, ability entries that roll to hit, saves, contest checks and initiative, as the fight opens and when it is thrown again. A roll read off an ability, a skill or a save takes that ability's entries; anything else takes only the entries for every roll. - **Hardness.** `combat.pool.hardness` reads a fighter's hardness off their sheet (their armor's, through `itemStat`), and a creature may give its own `hardness`. A spending blow whose dice are below it lands and does nothing: the number goes back to the base, the log says so, and the menu forecasts no harm for it. Only where a style spends initiative; a creature written as a sheet takes it from the sheet. - **Seen and said.** Item facts, the item's details and the Game Master's line say all of it ("While worn: -1 on attacks", "resists burn", "immune to Rattled", "+1 Guard", "half speed", the fight effects in words), and the fight log names the item beside a roll. - **Invented items** read `+N`, `-N`, advantage or disadvantage on attacks and `+N` or `-N` on defense (or the ruleset's word for it, "Guard"), held to the rarity's bonus; the proposal form says so, and names the item stat the defense already counts. An invented item that gives such a stat drops a worn change to defense beside it, since a small model writes both for one +1. A copied speed change is not capped, since it is a distance rather than a bonus. - **Checked at import:** the effects an item may have, damage types against `combat.damageTypes`, conditions, hardness only with a spending style, and a sheet creature's hardness refused. The install gate asks for 1.56 in the ruleset file and in catalog files. - **Examples.** Ember Roads' waystone, carried, resists burn. Gravewatch's cursed widow's ring costs a die on attacks, and its Dawn bell, bound, keeps the bearer from being rattled. - **Docs:** an "Armor and worn effects in a fight" section, the new keys, `adjust` in fights, hardness in the pool block and on creatures in `docs/extending/writing-rulesets.md` (whose line saying fight parts were refused, and the "Not yet" line about sturdy targets, are corrected); the 1.56 record in `docs/development/game-rulesets-and-sheets-implementation.md`; the regenerated JSON schema; and a CHANGELOG entry. ## 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 this branch at 3cb58aafd (one commit on staging ff59af37e): - `pnpm check` exits 0, `pnpm localization:check` exits 0 and `pnpm regression` passes 464/464 on the final code, rebased onto current staging; Prettier passes on the changed files. - `pnpm smoke:ui` passes 7/7. On `--project=desktop-chromium`, the ruleset, inventory, game dice and combat director specs (`e2e/game-ruleset-*.e2e.ts`, `e2e/ruleset-*.e2e.ts`, `e2e/game-inventory-*.e2e.ts`, `e2e/game-native-dice.e2e.ts`, `e2e/game-one-request-dice.e2e.ts`, `e2e/game-combat-director.e2e.ts`) pass 27/27, and the game ruleset specs pass 8/8 on `--project=mobile-chromium`. These ran before the review fixes below and the last rebase; after both, the two item specs (`e2e/game-ruleset-armor.e2e.ts` and `e2e/game-ruleset-weapons.e2e.ts`) passed again on desktop. Lanes: - New `game-ruleset-armor.regression.ts`: every part at import and at the gate (each alone, a requirement's cost, a creature's hardness, a catalog file); items in a fight on attacks (also where no condition of the ruleset changes a number), defense on top of the coat's own guard, speed and cannot-move, attacks against the holder, failed saves, the waystone halving a cinder-moth's burn, the bell keeping Rattled off against the hollow warden's grip and an opening crash, an unmet requirement costing a die, one item once and a carried one doing nothing; the log naming the ring (even when a stack is named like a condition); `resolution.adjust` on attack rows, weapons, a weapon's skill, ability entries, contest checks off an ability, a save and a skill, saves, and initiative as a sum, as a pool and thrown again; hardness on the blow, at the line, in the forecast, off the sheet and out of the bestiary; item facts and the Game Master's line; invented items. - Lanes that pin older gates, the examples, the item facts, the published schema or the proposal form were brought up to date; the check-effects lane's refusals of fight parts, which this slice lifts, now refuse only an effect that ends by itself. - `e2e/game-ruleset-armor.e2e.ts` (desktop and phone): the ring's and the bell's details in a Gravewatch game. Fifty-nine deliberate breaks, across the import checks, the gate, the fight's reading of items, the hide and condition immunities, `adjust` on each kind of roll, hardness, the facts, invented items, the proposal form and the item details on screen, were each caught. Local CodeRabbit (`coderabbit review --agent --base staging`), three passes: - First: two findings, both fixed. A defense written as a number was named by that number in an item's facts ("+1 1"); it now reads "defense". And a dice change to attacks in a pool ruleset is now refused, as a condition's is, and left out of an invented item. - Second: three findings. Two fixed: "half of every harm" now reads "takes half of every harm", and a fight's modifier lookup no longer reads a fighter's items twice. One declined: moving the lanes' strip helper into a shared module, since each lane keeps its own (`withoutItemReads`, `withoutWeapons` and the rest). - Third: two trivial findings, declined: the same shared-helper request, and a pool check before reading `combat.pool.hardness`, which is redundant because `combat.pool` is refused outside a pool fight. 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: - "a studded bracer; wearing it adds +1 to my Guard": all 3 tellings wrote `+1 Guard`, but 2 of them also gave the bracer `guard=1` (or `guard=2`), a stat Guard already adds up, so those bracers would have given +2 or +3. A line in the form asking for one or the other did not change that (4 of 6 in the next two runs), so the Engine now drops the worn change beside such a stat and says so. After that, 3 of 3 bracers came out +1 Guard: two by the stat, one by the worn change. - "a lucky amulet that gives +1 to attack rolls while worn": 2 of 3 invented it with +1 on attacks; the third wrote "+1 Attack Roll Bonus", which the Engine now reads too. Rerun after that, 3 of 3. ## 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` and `docs/development/game-rulesets-and-sheets-implementation.md` (both carried by `docs-i18n`), `CHANGELOG.md`, the generated `docs/extending/ruleset.schema.json` and the two example rulesets. Translations: #6813 is the items arc's follow-up; this PR is added to it there. ## UI evidence (if applicable) In a Gravewatch game where Ada wears the widow's ring and the Dawn bell, both bound, the ring's details read "While worn: -1 on attacks" and the bell's "While worn: +1 on checks (Ward); immune to Rattled" (captured by `e2e/game-ruleset-armor.e2e.ts` as `ruleset-armor-details.png`, desktop and phone). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Worn and carried items can affect combat, including attacks, defense, speed, damage resistance, vulnerabilities, immunities, and conditions. * Sheet-based combat rolls apply ruleset adjustments. Spending attacks below a target’s hardness land but deal no damage. * Inventory descriptions and combat logs show item effects and hardness outcomes. * **Compatibility** * Rulesets using these combat features require Capability API 1.56 or later. * **Documentation** * Updated ruleset guides, examples, and schema documentation to cover the new combat options. <!-- 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:59 +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#7360
No description provided.