[PR #6856] [MERGED] feat(rulesets): weapons as items in ruleset fights, and damage that gets through a resistance (#6855) #7358

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/6856
Author: @kolacheee
Created: 9/29/2026
Status: ✅ Merged
Merged: 9/29/2026
Merged by: @kolacheee

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


📝 Commits (1)

  • da45f41 feat(rulesets): weapons as items in ruleset fights, and damage that gets through a resistance (#6855)

📊 Changes

31 files changed (+2615 additions, -98 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+44 -0)
📝 docs/examples/rulesets/ember-roads.json (+38 -2)
📝 docs/examples/rulesets/gravewatch.json (+41 -2)
📝 docs/extending/ruleset.schema.json (+707 -6)
📝 docs/extending/writing-rulesets.md (+38 -4)
➕ e2e/game-ruleset-weapons.e2e.ts (+188 -0)
📝 packages/client/src/components/game/RulesetItemPicker.tsx (+33 -0)
📝 packages/client/src/localization/locales/en.json (+8 -0)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+21 -0)
📝 packages/server/src/services/game/gm-prompts.ts (+4 -2)
📝 packages/shared/src/features/ruleset-combat/creatures.ts (+13 -7)
📝 packages/shared/src/features/ruleset-combat/encounter.ts (+137 -3)
📝 packages/shared/src/features/ruleset-combat/options.ts (+1 -0)
📝 packages/shared/src/features/ruleset-combat/pool.ts (+25 -10)
📝 packages/shared/src/features/ruleset-combat/resolve.ts (+24 -8)
📝 packages/shared/src/features/ruleset-combat/types.ts (+15 -4)
📝 packages/shared/src/features/rulesets/invented-items.ts (+7 -0)
📝 packages/shared/src/features/rulesets/item-book.ts (+195 -5)
📝 packages/shared/src/schemas/capability-package.schema.ts (+7 -1)

...and 11 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 #6855

Why this change

  • A ruleset's items could be worn, carried and change checks (#6832, #6846), but a weapon item did nothing in a fight: a ruleset fight offered only sheet-list rows and stat block actions, so a sword the character held had to be copied by hand into a sheet row, and the copy did not follow the item when it was put away, traded or replaced. An item the Game Master invented as a weapon could not fight at all. Damage also could not get through a resistance's exception, so a werewolf that shrugs off all but silver could only be written as always resistant or never. This is slice I5-1 of the ruleset items plan; I5 was split into weapons (this), armor and worn effects in a fight (I5-2), and ammunition and firearms (I5-3).

What changed

  • Weapons as items (Capability API 1.55): an item's attack, the shape a combat block's attack rows have with values in place of columns: budget; to hit from the best of some abilities, a skill (with the attack's ability swapped in, as a row's is), proficiency read off the holder's sheet, a bonus, and in a pool fight a per-weapon target; damage dice, the best of some abilities, a bonus and a type; reach and range (a weapon with both is thrown, as a sheet row already is, so there is no thrown key); versatile dice while each slot the weapon takes has room for as much again; and strikes.
  • Values off the item's own stats. Any of those numbers or words may be { "stat": id }, so an item the Game Master invents like= a weapon fights with its own stats, held to rarityCaps. One invented with no slot and no binding is made without the attack, and says so. One invented in a category of weapons with nothing to start from fights as the ruleset's weapon of that category it is most like by name (a word shared either way, else the first), taking the stats that attack reads which the proposal left out, and says so; the proposal form tells the Game Master a weapon made like one fights like it.
  • In a fight a worn weapon is an attack named as the stack is; one put away or only carried offers nothing. Sheet-list attacks and stat block actions work exactly as before. A pool weapon's target is passed to the attack's throw and to its forecast, held inside the ruleset's range.
  • What gets through a resistance. A creature's resist or immune entry may be { "type": "tearing", "except": ["silver"] }; a weapon's tags are what its blows carry, every part of the blow included. A plain word is what it always was.
  • Checked at import: budgets, abilities, skills, damage types, each stat read by kind (an enum read as abilities, a skill or a type holds only those words), dice in a summed fight, target only where a pool's target moves, distances only with combat.distance, a weapon that can be worn, versatile only on an item that takes a slot, and an exception's tags. A ruleset with no combat block carries a weapon and reads nothing, as a catalog entry's budget is. The install gate asks for 1.55 in the ruleset file and in catalog files.
  • Seen and said. The item's details show "Attack (Action): Brawn to hit, 1d6 + Brawn cut damage" and "Reach 2 paces, Range 10 to 20 paces" in localized words, and the Game Master's inventory line ends with attack (Action): Brawn to hit, 1d6 + Brawn cut, reach 2 paces, range 10 to 20 paces.
  • Examples. Ember Roads: the hand axe (thrown), a new boar spear (reach, thrown, versatile 1d8) and the hunting bow. Gravewatch: the grave spade (target 6) and the silver coffin nail, and a new grave wight whose tearing resistance silver gets through.
  • Docs: a "Weapons in a fight" section, the new item key and the resistance exception in docs/extending/writing-rulesets.md, whose three lines saying items do nothing in a fight are corrected; the 1.55 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 da45f41ae (one commit on staging ed0eed9d3):

  • pnpm check exits 0, pnpm localization:check exits 0, and pnpm regression passes 447/447 on the final code (the last change after that run is one sentence in the author guide).
  • 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 26/26, and the game ruleset specs pass 7/7 on --project=mobile-chromium. These ran before the last change to how an invented weapon is armed, which touches only invention; after it, the lanes that read invention and the whole regression suite passed again.

Lanes:

  • New game-ruleset-weapons.regression.ts: every import refusal and the lenient no-combat case, the 1.55 gate (the weapon and the exception each on its own, and a catalog file), weapons in a summed fight (the options, versatile with a hand free and with both hands full, a stack of two counting twice, a carried bow offering nothing, stat reads and a stat the item does not give, the best of two abilities, a skill with the attack's ability swapped in, proficiency on and off, bonuses, strikes, and a real swing), a pool fight (the spade's own target on the throw and in the forecast, the nail's pool target), silver through a resistance and an immunity and a plain word unchanged, the grave wight built out of the bestiary, item facts and the Game Master's line, and invented weapons.
  • game-ruleset-invented-items.regression.ts: the proposal form says a weapon made like one fights like it only where the ruleset has fights, and a weapon proposed without like= fights as the hand axe.
  • game-inventory-turn.regression.ts: a real Game Master turn's "Mourning Edge", made like the hand axe, keeps the axe's attack.
  • Lanes that pin the 1.54 gate, the item facts and the Game Master's inventory line, the examples' entry counts, or variants without a board, items or slots were brought up to date; the I1 lane's example of an unknown item key is now a key no slice plans.
  • e2e/game-ruleset-weapons.e2e.ts (desktop and phone): in an Ember Roads game, the held hand axe's details show its attack, and a ruleset fight offers "Hand axe" and not the carried bow, and resolves a swing with it.

Sixty-seven deliberate breaks, across the import checks, the gate, the fight, the pool throw and forecast, what gets through a resistance, the facts, invented weapons (and the weapon a proposal with nothing to start from fights as), the proposal form and the item details on screen, were each caught.

Local CodeRabbit (coderabbit review --agent --base staging): two passes, one finding each, both fixed. The first: an enum stat's damage types were lowercased without the trim the written type gets (now trimmed, with a lane case). The second: a sentence in the author guide read as if native: false also took weapons out of a fight (split in two).

Game Master turns on a real local model (Gemma 4 E4B, Q8, through llama.cpp) on an isolated Engine from this branch, where the player holds a weapon and asks for a new one:

  • Ember Roads, "forge me a heavier axe, like my hand axe but dealing 1d8": at first all 3 tellings invented the axe with a category, damage 1d8 and slots but never like=, so none of them had an attack and none would have been offered in a fight. The Engine now gives a weapon invented with nothing to start from the attack of the ruleset's weapon of its category it is most like by name, with the stats that attack reads which the proposal left out, and says so ("It fights as Hand axe does."), and the proposal form says a weapon made like one fights like it. Across two runs after that, every axe the model added (4 of 4) was a weapon; the other two tellings narrated the forging without handing it over yet.
  • Gravewatch, "the silvered knife he brings out, a real blade rather than a nail": 3 of 3 tellings invented it as a weapon tagged silver, fighting as the silver coffin nail, so its blows get through the grave wight's resistance.

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 an Ember Roads game where Juno holds a hand axe, its details read "Attack (Action): Brawn to hit, 1d6 + Brawn cut damage" and "Reach 2 paces, Range 10 to 20 paces", and a ruleset fight against a cinder-moth offers "Hand axe" (her carried hunting bow is not on the menu); the swing's log line reads "Juno attacks Cinder-moth with Hand axe: ... + 3 = ... against Guard 5" (captured by e2e/game-ruleset-weapons.e2e.ts as ruleset-weapon-details.png and ruleset-weapon-fight.png, desktop and phone).

Summary by CodeRabbit

  • New Features

    • Ruleset items can now function as weapons in combat, with attacks based on item stats or fixed values. Worn weapons can provide combat actions, and versatile weapons can use alternate damage.
    • Weapon tags can affect how attacks interact with creature resistances and immunities.
    • Game Masters can create invented items that inherit attacks from similar weapons.
    • Item details now display weapon attack information. These ruleset features require Capability API 1.55.
  • Documentation

    • Added guidance and examples for defining and using weapons in rulesets.

🔄 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/6856 **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-weapons` --- ### 📝 Commits (1) - [`da45f41`](https://github.com/Pasta-Devs/Marinara-Engine/commit/da45f41ae2b2dac9f0c5217e4c63684ecfb0bf92) feat(rulesets): weapons as items in ruleset fights, and damage that gets through a resistance (#6855) ### 📊 Changes **31 files changed** (+2615 additions, -98 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+44 -0) 📝 `docs/examples/rulesets/ember-roads.json` (+38 -2) 📝 `docs/examples/rulesets/gravewatch.json` (+41 -2) 📝 `docs/extending/ruleset.schema.json` (+707 -6) 📝 `docs/extending/writing-rulesets.md` (+38 -4) ➕ `e2e/game-ruleset-weapons.e2e.ts` (+188 -0) 📝 `packages/client/src/components/game/RulesetItemPicker.tsx` (+33 -0) 📝 `packages/client/src/localization/locales/en.json` (+8 -0) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+21 -0) 📝 `packages/server/src/services/game/gm-prompts.ts` (+4 -2) 📝 `packages/shared/src/features/ruleset-combat/creatures.ts` (+13 -7) 📝 `packages/shared/src/features/ruleset-combat/encounter.ts` (+137 -3) 📝 `packages/shared/src/features/ruleset-combat/options.ts` (+1 -0) 📝 `packages/shared/src/features/ruleset-combat/pool.ts` (+25 -10) 📝 `packages/shared/src/features/ruleset-combat/resolve.ts` (+24 -8) 📝 `packages/shared/src/features/ruleset-combat/types.ts` (+15 -4) 📝 `packages/shared/src/features/rulesets/invented-items.ts` (+7 -0) 📝 `packages/shared/src/features/rulesets/item-book.ts` (+195 -5) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+7 -1) _...and 11 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 #6855 ## Why this change - A ruleset's items could be worn, carried and change checks (#6832, #6846), but a weapon item did nothing in a fight: a ruleset fight offered only sheet-list rows and stat block actions, so a sword the character held had to be copied by hand into a sheet row, and the copy did not follow the item when it was put away, traded or replaced. An item the Game Master invented as a weapon could not fight at all. Damage also could not get through a resistance's exception, so a werewolf that shrugs off all but silver could only be written as always resistant or never. This is slice I5-1 of the ruleset items plan; I5 was split into weapons (this), armor and worn effects in a fight (I5-2), and ammunition and firearms (I5-3). ## What changed - **Weapons as items** (Capability API 1.55): an item's `attack`, the shape a combat block's attack rows have with values in place of columns: `budget`; to hit from the best of some `abilities`, a `skill` (with the attack's ability swapped in, as a row's is), `proficiency` read off the holder's sheet, a `bonus`, and in a pool fight a per-weapon `target`; damage `dice`, the best of some `abilities`, a `bonus` and a `type`; `reach` and `range` (a weapon with both is thrown, as a sheet row already is, so there is no `thrown` key); `versatile` dice while each slot the weapon takes has room for as much again; and `strikes`. - **Values off the item's own stats.** Any of those numbers or words may be `{ "stat": id }`, so an item the Game Master invents `like=` a weapon fights with its own stats, held to `rarityCaps`. One invented with no slot and no binding is made without the attack, and says so. One invented in a category of weapons with nothing to start from fights as the ruleset's weapon of that category it is most like by name (a word shared either way, else the first), taking the stats that attack reads which the proposal left out, and says so; the proposal form tells the Game Master a weapon made like one fights like it. - **In a fight** a worn weapon is an attack named as the stack is; one put away or only carried offers nothing. Sheet-list attacks and stat block actions work exactly as before. A pool weapon's `target` is passed to the attack's throw and to its forecast, held inside the ruleset's range. - **What gets through a resistance.** A creature's `resist` or `immune` entry may be `{ "type": "tearing", "except": ["silver"] }`; a weapon's tags are what its blows carry, every part of the blow included. A plain word is what it always was. - **Checked at import:** budgets, abilities, skills, damage types, each stat read by kind (an enum read as abilities, a skill or a type holds only those words), dice in a summed fight, `target` only where a pool's target moves, distances only with `combat.distance`, a weapon that can be worn, `versatile` only on an item that takes a slot, and an exception's tags. A ruleset with no combat block carries a weapon and reads nothing, as a catalog entry's `budget` is. The install gate asks for 1.55 in the ruleset file and in catalog files. - **Seen and said.** The item's details show "Attack (Action): Brawn to hit, 1d6 + Brawn cut damage" and "Reach 2 paces, Range 10 to 20 paces" in localized words, and the Game Master's inventory line ends with `attack (Action): Brawn to hit, 1d6 + Brawn cut, reach 2 paces, range 10 to 20 paces`. - **Examples.** Ember Roads: the hand axe (thrown), a new boar spear (reach, thrown, versatile 1d8) and the hunting bow. Gravewatch: the grave spade (target 6) and the silver coffin nail, and a new grave wight whose tearing resistance silver gets through. - **Docs:** a "Weapons in a fight" section, the new item key and the resistance exception in `docs/extending/writing-rulesets.md`, whose three lines saying items do nothing in a fight are corrected; the 1.55 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 da45f41ae (one commit on staging ed0eed9d3): - `pnpm check` exits 0, `pnpm localization:check` exits 0, and `pnpm regression` passes 447/447 on the final code (the last change after that run is one sentence in the author guide). - `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 26/26, and the game ruleset specs pass 7/7 on `--project=mobile-chromium`. These ran before the last change to how an invented weapon is armed, which touches only invention; after it, the lanes that read invention and the whole regression suite passed again. Lanes: - New `game-ruleset-weapons.regression.ts`: every import refusal and the lenient no-combat case, the 1.55 gate (the weapon and the exception each on its own, and a catalog file), weapons in a summed fight (the options, versatile with a hand free and with both hands full, a stack of two counting twice, a carried bow offering nothing, stat reads and a stat the item does not give, the best of two abilities, a skill with the attack's ability swapped in, proficiency on and off, bonuses, strikes, and a real swing), a pool fight (the spade's own target on the throw and in the forecast, the nail's pool target), silver through a resistance and an immunity and a plain word unchanged, the grave wight built out of the bestiary, item facts and the Game Master's line, and invented weapons. - `game-ruleset-invented-items.regression.ts`: the proposal form says a weapon made like one fights like it only where the ruleset has fights, and a weapon proposed without `like=` fights as the hand axe. - `game-inventory-turn.regression.ts`: a real Game Master turn's "Mourning Edge", made like the hand axe, keeps the axe's attack. - Lanes that pin the 1.54 gate, the item facts and the Game Master's inventory line, the examples' entry counts, or variants without a board, items or slots were brought up to date; the I1 lane's example of an unknown item key is now a key no slice plans. - `e2e/game-ruleset-weapons.e2e.ts` (desktop and phone): in an Ember Roads game, the held hand axe's details show its attack, and a ruleset fight offers "Hand axe" and not the carried bow, and resolves a swing with it. Sixty-seven deliberate breaks, across the import checks, the gate, the fight, the pool throw and forecast, what gets through a resistance, the facts, invented weapons (and the weapon a proposal with nothing to start from fights as), the proposal form and the item details on screen, were each caught. Local CodeRabbit (`coderabbit review --agent --base staging`): two passes, one finding each, both fixed. The first: an enum stat's damage types were lowercased without the trim the written type gets (now trimmed, with a lane case). The second: a sentence in the author guide read as if `native: false` also took weapons out of a fight (split in two). Game Master turns on a real local model (Gemma 4 E4B, Q8, through llama.cpp) on an isolated Engine from this branch, where the player holds a weapon and asks for a new one: - Ember Roads, "forge me a heavier axe, like my hand axe but dealing 1d8": at first all 3 tellings invented the axe with a category, damage 1d8 and slots but never `like=`, so none of them had an attack and none would have been offered in a fight. The Engine now gives a weapon invented with nothing to start from the attack of the ruleset's weapon of its category it is most like by name, with the stats that attack reads which the proposal left out, and says so ("It fights as Hand axe does."), and the proposal form says a weapon made like one fights like it. Across two runs after that, every axe the model added (4 of 4) was a weapon; the other two tellings narrated the forging without handing it over yet. - Gravewatch, "the silvered knife he brings out, a real blade rather than a nail": 3 of 3 tellings invented it as a weapon tagged silver, fighting as the silver coffin nail, so its blows get through the grave wight's resistance. ## 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 an Ember Roads game where Juno holds a hand axe, its details read "Attack (Action): Brawn to hit, 1d6 + Brawn cut damage" and "Reach 2 paces, Range 10 to 20 paces", and a ruleset fight against a cinder-moth offers "Hand axe" (her carried hunting bow is not on the menu); the swing's log line reads "Juno attacks Cinder-moth with Hand axe: ... + 3 = ... against Guard 5" (captured by `e2e/game-ruleset-weapons.e2e.ts` as `ruleset-weapon-details.png` and `ruleset-weapon-fight.png`, desktop and phone). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Ruleset items can now function as weapons in combat, with attacks based on item stats or fixed values. Worn weapons can provide combat actions, and versatile weapons can use alternate damage. * Weapon tags can affect how attacks interact with creature resistances and immunities. * Game Masters can create invented items that inherit attacks from similar weapons. * Item details now display weapon attack information. These ruleset features require Capability API 1.55. * **Documentation** * Added guidance and examples for defining and using weapons in rulesets. <!-- 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#7358
No description provided.