[PR #6739] [MERGED] feat(game): a dice-pool combat kind, soak by kind, initiative every round and spend limits #7308

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

📋 Pull Request Information

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

Base: staging ← Head: feat/ruleset-combat-storyteller


📝 Commits (2)

  • 490f49f feat(game): a dice-pool combat kind, soak by kind, initiative every round and spend limits
  • 67e3fd1 fix(game): a window before a rethrown round names nobody, rider dice are the pool's die, and soak off the dice leaves automatic successes

📊 Changes

27 files changed (+3082 additions, -167 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+42 -0)
📝 docs/examples/rulesets/gravewatch.json (+190 -3)
📝 docs/extending/ruleset.schema.json (+454 -3)
📝 docs/extending/writing-rulesets.md (+98 -6)
📝 docs/game/combat.md (+2 -0)
📝 packages/client/src/lib/ruleset-combat-log.ts (+107 -14)
📝 packages/client/src/localization/locales/en.json (+21 -0)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+25 -0)
📝 packages/shared/src/features/ruleset-combat/creatures.ts (+15 -0)
📝 packages/shared/src/features/ruleset-combat/encounter.ts (+113 -25)
📝 packages/shared/src/features/ruleset-combat/index.ts (+18 -0)
📝 packages/shared/src/features/ruleset-combat/options.ts (+95 -13)
➕ packages/shared/src/features/ruleset-combat/pool.ts (+241 -0)
📝 packages/shared/src/features/ruleset-combat/resolve.ts (+365 -85)
📝 packages/shared/src/features/ruleset-combat/types.ts (+41 -0)
📝 packages/shared/src/schemas/capability-package.schema.ts (+8 -1)
📝 packages/shared/src/schemas/ruleset.schema.ts (+194 -7)
📝 scripts/generate-ruleset-schema.mjs (+33 -0)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+4 -4)

...and 7 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 #6736

Why this change

A ruleset can already describe pool checks (resolution.kind: "dice-pool": the sheet's number is how many dice are thrown, and each die that reaches a target is a success), but a fight had one kind, attack-vs-defense, which adds dice up and compares them with a number. So the pool systems the ruleset gap report names (W10, and W9's per-turn spending) could not fight by their own rules at all, and Gravewatch, the Engine's own pool example, had no fight. This is the Storyteller kind the maintainer ordered last, after the other combat slices and the 5e package release.

What changed

Capability API 1.47 (file keys: combat.kind: "dice-pool", combat.pool, combat.spendLimits, initiative.each, an attack row's toHit.skill, and a creature's soak). None of it names one game's words.

  • One principle, no renamed keys. In a dice-pool fight every number a roll adds is dice, and every number it meets is successes, exactly as the ruleset's own pool checks read the sheet.
    • toHit is the pool an attack throws, and defense is the successes it needs, never fewer than one.
    • A save's number is its pool and its difficulty the successes it needs; a contest throws each side's check as a pool.
    • A condition's flat modifier is dice added or taken away; a rolled dice modifier is refused.
    • Every pool goes through the check roller (rollDicePoolCheck), so the die, target, doubling, exploding, cancelling and botch are the ruleset's. The wound penalty (resolution.penaltyFrom) takes dice off, as on a check.
    • A botch misses, and there are no criticals.
  • Damage and soak.
    • Each success past the ones needed adds a damage die. An amount's dice are dice of the ruleset's own die (refused otherwise, on entries and creatures), and its flat part is automatic successes.
    • Damage is thrown per target against pool.damageTarget (the resolution's default target when absent), with nothing doubling, exploding, cancelling or botching.
    • pool.soak is value references by kind of the health track, either thrown against the damage target (each success takes one off) or taken off the damage dice first.
    • A creature gives its own soak, a sheet creature reads it off its sheet, and an opponent the Game Master invents has none (the clamp drops it, since no tier bounds it).
    • Heal and temporary amounts, initiative and dying keep their sums.
  • For either kind.
    • initiative.each: "round" throws initiative again as each round begins, with the modifier read off the sheet as it stands then, and re-sorts the order.
    • combat.spendLimits caps what one combatant spends of a live pool per turn or round: a cost past what is left is priced as unaffordable, and every payment counts, answers in a window included.
    • toHit.skill lets an attack row throw a skill, with the row's ability swapped in as a check's with= does.
  • Menu and log. Exact pool forecasts (the chance to reach the successes needed, and the damage dice's worth after the first target's soak) feed the menu and the Engine's picker. New log lines such as "Ada attacks Hollow with Spade: 2 successes from 4 dice at 7 or more (7, 8, 2, 3), needing 2 successes, a hit." and "Hollow soaks 1: 1 success from 1 die at 6 or more (6)." New strings are in en.json only.
  • Not built, and said so: declaring actions in reverse order, which changes nothing any rule reads in a fight where each combatant picks one action on their turn. Initiative as a number attacks move (the Exalted-style half of W10) is the next slice.
  • Example. Gravewatch fights:
    • a harm track with knocks and tears, and an Arms list;
    • two fight charms, one on a quick budget so its one-Resolve-a-turn limit binds;
    • soak by kind, and initiative every round;
    • a two-creature bestiary.
  • Around it. The install gate, the regenerated published schema (with editor patches for the per-kind blocks and for soak), the author guide (a new "A fight thrown in pools" section, the key reference and Not yet), the player page, the plan doc and the CHANGELOG.
  • Older lanes adjusted. The check lanes' Gravewatch variants leave the fight out, since none of them reads combat. The combat-core pin follows the new enum message, and the lifecycle lane follows the version.

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 490f49f71 (this branch's one commit on staging 399dea52b), all exit 0: pnpm check (localization included), pnpm regression:node (407/407, the published schema's staleness check included), pnpm smoke:ui (7/7) and pnpm regression:ui e2e/game-combat-director.e2e.ts e2e/ruleset-wound-sheet.e2e.ts e2e/ruleset-live-states.e2e.ts --project=desktop-chromium --workers=1 (9/9).

  • New lane scripts/regressions/game-ruleset-combat-pool.regression.ts, on Gravewatch with scripted dice, covers:
    • pools with a skill and a swapped ability;
    • cancelling, botches and explosions;
    • extra damage dice and automatic successes;
    • defense, and a defense of 0 still needing one success;
    • soak thrown and taken off the dice, and no soak for a blow that counted nothing;
    • the wound penalty and condition dice off a pool, and a leaning throw keeping the better;
    • saves and contests as pools, and a held hit rechecked in successes;
    • initiative every round, with the modifier read as it stands;
    • spend limits, answers included;
    • the exact forecast against a hand count, and a bestiary creature's soak;
    • the clamp dropping invented soak, every import refusal, the log lines and the 1.47 gate.
  • Twenty-eight deliberate breaks of those rules were each caught.
  • scripts/regressions/ruleset-combat-director.regression.ts gains twenty seeded Gravewatch fights played by the Engine on both sides. Every one ends, pools are thrown and soaked, initiative is thrown again, and nobody spends past the limit.

Local CodeRabbit (coderabbit review --agent --committed), five passes: 2, 1, 1, 4 and 0 findings.

Fixed seven:

  • the author guide said a spend limit never binds an opponent, though one written as a sheet pays and is held to it;
  • a creature's soak on a ruleset whose pool says nothing about soak was ignored in the fight but counted in the forecast; it is now refused at import, and the forecast counts no soak without the rule;
  • the automatic-damage log line now says automatic successes;
  • the published schema's per-kind conditional now requires kind;
  • the forecast clamps a negative automatic part as the fight does;
  • the chance now reads the one distribution instead of folding it twice;
  • a spend limit on a list of pools gets the shared refusal message.

Declined one: grouping three refusal checks on one edited document into one assertion. Each separate check gives its own failure message.

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

  • Import docs/examples/rulesets/gravewatch.json as a community ruleset, start a Game Mode game on it with a warden who has an Arm (for example Spade: Sinew, Dig, 2d10, tearing) and the Lantern Flare and Stern Word charms, and have the Game Master start a fight against a Grave-rat swarm or a Hollow warden.
  • Confirm the menu shows a chance to hit, and the log reads each attack as successes from dice at a target, needing a number of successes.
  • Hit the Hollow warden and confirm the log shows it soaking. Take a blunt blow and confirm your Sinew soaks it.
  • Confirm initiative is thrown again as each round begins.
  • Cast Lantern Flare and confirm Stern Word is off the menu for the rest of that turn and back on your next.
  • Check light and dark mode and mobile width on the log.

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/combat.md (carried by docs-i18n)
  • docs/extending/ruleset.schema.json, regenerated
  • docs/examples/rulesets/gravewatch.json
  • docs/development/game-rulesets-and-sheets-implementation.md (internal)
  • CHANGELOG.md

Translations are batched into one [docs-i18n] issue after the last ruleset slice, by the maintainer's standing decision, so no per-PR issue is opened here.

UI evidence (if applicable)

None attached. The screen is the existing ruleset battle screen; what is new on it is the log lines, pinned in the lane, and the manual steps above.

Summary by CodeRabbit

  • New Features
    • Added dice-pool combat rules, with success-based attacks, damage, saves, and contests. Extra attack successes add damage dice; soak can reduce damage before wounds are marked.
    • Wound penalties and conditions affect dice pools, and combat logs show roll details, successes, botches, and soak results.
    • Rulesets can reroll initiative each round and limit resource spending per turn or round.
    • Attack rows can use a skill for attack rolls, and creatures can define soak values.
  • Documentation
    • Updated combat guidance and added a dice-pool combat example.

🔄 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/6739 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/26/2026 **Status:** ✅ Merged **Merged:** 9/27/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/ruleset-combat-storyteller` --- ### 📝 Commits (2) - [`490f49f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/490f49f719df07a83409d78b16064f7e36d85624) feat(game): a dice-pool combat kind, soak by kind, initiative every round and spend limits - [`67e3fd1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/67e3fd11ce577e779590e649831a035be8d406a8) fix(game): a window before a rethrown round names nobody, rider dice are the pool's die, and soak off the dice leaves automatic successes ### 📊 Changes **27 files changed** (+3082 additions, -167 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+42 -0) 📝 `docs/examples/rulesets/gravewatch.json` (+190 -3) 📝 `docs/extending/ruleset.schema.json` (+454 -3) 📝 `docs/extending/writing-rulesets.md` (+98 -6) 📝 `docs/game/combat.md` (+2 -0) 📝 `packages/client/src/lib/ruleset-combat-log.ts` (+107 -14) 📝 `packages/client/src/localization/locales/en.json` (+21 -0) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+25 -0) 📝 `packages/shared/src/features/ruleset-combat/creatures.ts` (+15 -0) 📝 `packages/shared/src/features/ruleset-combat/encounter.ts` (+113 -25) 📝 `packages/shared/src/features/ruleset-combat/index.ts` (+18 -0) 📝 `packages/shared/src/features/ruleset-combat/options.ts` (+95 -13) ➕ `packages/shared/src/features/ruleset-combat/pool.ts` (+241 -0) 📝 `packages/shared/src/features/ruleset-combat/resolve.ts` (+365 -85) 📝 `packages/shared/src/features/ruleset-combat/types.ts` (+41 -0) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+8 -1) 📝 `packages/shared/src/schemas/ruleset.schema.ts` (+194 -7) 📝 `scripts/generate-ruleset-schema.mjs` (+33 -0) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+4 -4) _...and 7 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 #6736 ## Why this change A ruleset can already describe pool checks (`resolution.kind: "dice-pool"`: the sheet's number is how many dice are thrown, and each die that reaches a target is a success), but a fight had one kind, `attack-vs-defense`, which adds dice up and compares them with a number. So the pool systems the ruleset gap report names (W10, and W9's per-turn spending) could not fight by their own rules at all, and Gravewatch, the Engine's own pool example, had no fight. This is the Storyteller kind the maintainer ordered last, after the other combat slices and the 5e package release. ## What changed Capability API **1.47** (file keys: `combat.kind: "dice-pool"`, `combat.pool`, `combat.spendLimits`, `initiative.each`, an attack row's `toHit.skill`, and a creature's `soak`). None of it names one game's words. - **One principle, no renamed keys.** In a `dice-pool` fight every number a roll adds is dice, and every number it meets is successes, exactly as the ruleset's own pool checks read the sheet. - `toHit` is the pool an attack throws, and `defense` is the successes it needs, never fewer than one. - A save's number is its pool and its difficulty the successes it needs; a contest throws each side's check as a pool. - A condition's `flat` modifier is dice added or taken away; a rolled `dice` modifier is refused. - Every pool goes through the check roller (`rollDicePoolCheck`), so the die, target, doubling, exploding, cancelling and botch are the ruleset's. The wound penalty (`resolution.penaltyFrom`) takes dice off, as on a check. - A botch misses, and there are no criticals. - **Damage and soak.** - Each success past the ones needed adds a damage die. An amount's `dice` are dice of the ruleset's own die (refused otherwise, on entries and creatures), and its `flat` part is automatic successes. - Damage is thrown per target against `pool.damageTarget` (the resolution's default target when absent), with nothing doubling, exploding, cancelling or botching. - `pool.soak` is value references by kind of the health track, either thrown against the damage target (each success takes one off) or taken off the damage dice first. - A creature gives its own `soak`, a sheet creature reads it off its sheet, and an opponent the Game Master invents has none (the clamp drops it, since no tier bounds it). - Heal and temporary amounts, initiative and dying keep their sums. - **For either kind.** - `initiative.each: "round"` throws initiative again as each round begins, with the modifier read off the sheet as it stands then, and re-sorts the order. - `combat.spendLimits` caps what one combatant spends of a live pool per turn or round: a cost past what is left is priced as unaffordable, and every payment counts, answers in a window included. - `toHit.skill` lets an attack row throw a skill, with the row's ability swapped in as a check's `with=` does. - **Menu and log.** Exact pool forecasts (the chance to reach the successes needed, and the damage dice's worth after the first target's soak) feed the menu and the Engine's picker. New log lines such as "Ada attacks Hollow with Spade: 2 successes from 4 dice at 7 or more (7, 8, 2, 3), needing 2 successes, a hit." and "Hollow soaks 1: 1 success from 1 die at 6 or more (6)." New strings are in `en.json` only. - **Not built, and said so:** declaring actions in reverse order, which changes nothing any rule reads in a fight where each combatant picks one action on their turn. Initiative as a number attacks move (the Exalted-style half of W10) is the next slice. - **Example.** Gravewatch fights: - a harm track with knocks and tears, and an Arms list; - two fight charms, one on a quick budget so its one-Resolve-a-turn limit binds; - soak by kind, and initiative every round; - a two-creature bestiary. - **Around it.** The install gate, the regenerated published schema (with editor patches for the per-kind blocks and for soak), the author guide (a new "A fight thrown in pools" section, the key reference and Not yet), the player page, the plan doc and the CHANGELOG. - **Older lanes adjusted.** The check lanes' Gravewatch variants leave the fight out, since none of them reads combat. The combat-core pin follows the new enum message, and the lifecycle lane follows the version. ## 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 490f49f71 (this branch's one commit on staging 399dea52b), all exit 0: `pnpm check` (localization included), `pnpm regression:node` (407/407, the published schema's staleness check included), `pnpm smoke:ui` (7/7) and `pnpm regression:ui e2e/game-combat-director.e2e.ts e2e/ruleset-wound-sheet.e2e.ts e2e/ruleset-live-states.e2e.ts --project=desktop-chromium --workers=1` (9/9). - New lane `scripts/regressions/game-ruleset-combat-pool.regression.ts`, on Gravewatch with scripted dice, covers: - pools with a skill and a swapped ability; - cancelling, botches and explosions; - extra damage dice and automatic successes; - defense, and a defense of 0 still needing one success; - soak thrown and taken off the dice, and no soak for a blow that counted nothing; - the wound penalty and condition dice off a pool, and a leaning throw keeping the better; - saves and contests as pools, and a held hit rechecked in successes; - initiative every round, with the modifier read as it stands; - spend limits, answers included; - the exact forecast against a hand count, and a bestiary creature's soak; - the clamp dropping invented soak, every import refusal, the log lines and the 1.47 gate. - Twenty-eight deliberate breaks of those rules were each caught. - `scripts/regressions/ruleset-combat-director.regression.ts` gains twenty seeded Gravewatch fights played by the Engine on both sides. Every one ends, pools are thrown and soaked, initiative is thrown again, and nobody spends past the limit. Local CodeRabbit (`coderabbit review --agent --committed`), five passes: 2, 1, 1, 4 and 0 findings. Fixed seven: - the author guide said a spend limit never binds an opponent, though one written as a sheet pays and is held to it; - a creature's `soak` on a ruleset whose `pool` says nothing about soak was ignored in the fight but counted in the forecast; it is now refused at import, and the forecast counts no soak without the rule; - the automatic-damage log line now says automatic successes; - the published schema's per-kind conditional now requires `kind`; - the forecast clamps a negative automatic part as the fight does; - the chance now reads the one distribution instead of folding it twice; - a spend limit on a list of pools gets the shared refusal message. Declined one: grouping three refusal checks on one edited document into one assertion. Each separate check gives its own failure message. Still to verify by hand (not done by the agent): - Import `docs/examples/rulesets/gravewatch.json` as a community ruleset, start a Game Mode game on it with a warden who has an Arm (for example Spade: Sinew, Dig, 2d10, tearing) and the Lantern Flare and Stern Word charms, and have the Game Master start a fight against a Grave-rat swarm or a Hollow warden. - Confirm the menu shows a chance to hit, and the log reads each attack as successes from dice at a target, needing a number of successes. - Hit the Hollow warden and confirm the log shows it soaking. Take a blunt blow and confirm your Sinew soaks it. - Confirm initiative is thrown again as each round begins. - Cast Lantern Flare and confirm Stern Word is off the menu for the rest of that turn and back on your next. - Check light and dark mode and mobile width on the log. ## 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/combat.md` (carried by `docs-i18n`) - `docs/extending/ruleset.schema.json`, regenerated - `docs/examples/rulesets/gravewatch.json` - `docs/development/game-rulesets-and-sheets-implementation.md` (internal) - `CHANGELOG.md` Translations are batched into one `[docs-i18n]` issue after the last ruleset slice, by the maintainer's standing decision, so no per-PR issue is opened here. ## UI evidence (if applicable) None attached. The screen is the existing ruleset battle screen; what is new on it is the log lines, pinned in the lane, and the manual steps above. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added dice-pool combat rules, with success-based attacks, damage, saves, and contests. Extra attack successes add damage dice; soak can reduce damage before wounds are marked. - Wound penalties and conditions affect dice pools, and combat logs show roll details, successes, botches, and soak results. - Rulesets can reroll initiative each round and limit resource spending per turn or round. - Attack rows can use a skill for attack rolls, and creatures can define soak values. - **Documentation** - Updated combat guidance and added a dice-pool combat example. <!-- 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:29 +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#7308
No description provided.