[PR #6741] [MERGED] feat(game): initiative as a number attacks move, for pool fights #7307

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

Base: staging ← Head: feat/ruleset-combat-initiative-resource


📝 Commits (7)

  • ab20230 feat(game): initiative as a number attacks move, for pool fights
  • 7e736ab fix(game): an attack keeps the style and the number it was made with
  • 89b1aba fix(game): every fight end lifts crashes, and a moving number opens as a pool
  • 2f964b8 Merge remote-tracking branch 'origin/staging' into feat/ruleset-combat-initiative-resource
  • 276f68f docs(game): a combatant crashes at the ruleset's crash line, not at zero
  • 13261a7 docs(game): a spending attack resets on a hit and costs the ruleset's loss on a miss
  • 9acda4a Merge remote-tracking branch 'origin/staging' into feat/ruleset-combat-initiative-resource

📊 Changes

30 files changed (+2663 additions, -146 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+55 -2)
📝 docs/extending/ruleset.schema.json (+299 -3)
📝 docs/extending/writing-rulesets.md (+68 -6)
📝 docs/game/combat.md (+1 -1)
📝 e2e/game-combat-director.e2e.ts (+188 -0)
📝 packages/client/src/components/game/DirectedCombatUI.tsx (+2 -0)
📝 packages/client/src/components/game/RulesetCombatBoard.tsx (+4 -3)
📝 packages/client/src/components/game/RulesetCombatMenu.tsx (+55 -10)
📝 packages/client/src/components/game/RulesetCombatStatus.tsx (+7 -0)
📝 packages/client/src/lib/ruleset-combat-log.ts (+76 -32)
📝 packages/client/src/lib/ruleset-combat-menu.ts (+25 -2)
📝 packages/client/src/localization/locales/en.json (+12 -0)
📝 packages/server/src/routes/combat-director.routes.ts (+1 -0)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+15 -0)
📝 packages/server/src/services/game/ruleset-combat-director.service.ts (+120 -38)
📝 packages/shared/src/features/combat-director.ts (+3 -0)
📝 packages/shared/src/features/ruleset-combat/encounter.ts (+88 -13)
📝 packages/shared/src/features/ruleset-combat/index.ts (+1 -0)
📝 packages/shared/src/features/ruleset-combat/options.ts (+39 -0)

...and 10 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 #6740

Why this change

#6739 gave pool rulesets a fight of their own, with initiative as an order. The other half of the ruleset gap report's Storyteller item (W10) is initiative as a number that attacks move: a pool thrown at the start sets it, one way of attacking takes it from the target, another spends it as damage, and whoever runs out crashes. A ruleset could not describe any of that. This is the second and last Storyteller slice.

What changed

Capability API 1.48 (file keys: initiative.pool, initiative.plus and initiative.resource, all for dice-pool fights). None of it names one game's words.

  • An opening pool. Initiative is dice with modifier, or pool with plus: exactly one. A pool is thrown through the check roller, and its successes plus plus are the number. A creature's initiativeModifier is its pool. each: "round" with a pool throws the pool again.
  • A number attacks move (initiative.resource). The number is kept, never thrown again, and the order is sorted by it as each round begins.
    • styles (one to four, at least one that takes) are the ways any attack may be made. Each attack is offered once per style, and a player picks the style before the target. The style is chosen beside the option (choice.style), so nothing that finds an action by its id changes.
    • Takes. On a hit, the damage is thrown as usual, soak included, and comes off the target's number instead of their health. The attacker gains it plus gain.
    • Spends. Offered only above the crash line, and never for an action made of several. The damage is the attacker's number, as they made the attack, in dice: no weapon dice, no extra dice from the hit, no soak. The number then resets to base, or a miss costs what onMiss (a step table) says.
    • crash: the line, a condition of the ruleset's own, a bonus for whoever crashed somebody, and how many of their own turns before they recover to base. A crash lifts when the number rises above the line, when the count runs out, and when the fight ends however it ends. Somebody who opens at the line starts crashed.
    • An attack keeps its style and its number until it is over, even when an answer moves its maker's number before it lands. Anything made out of a turn (an opportunity strike, a signature move, a reaction) is made in the first style, so a window menu offers no style step.
  • Menu, picker and log.
    • Each style carries its own forecast. The option itself then shows only its chance, and the style step says what each would take or deal.
    • The status panel shows everybody's number.
    • The Engine's picker weighs every style: a taking blow one turn ahead, against spending now and again from the base.
    • The Game Master's decision options and the route's ruleset command carry style. An unknown one is refused as unknown-style.
    • New log lines, such as "Ada gains 5 initiative for crashing Grave-rat swarm, and is on 14." and "Ada spends their initiative, and it goes back to 3." New strings are in en.json only.
  • Around it.
    • The install gate, and the regenerated published schema (with editor patches for dice or pool, and takes or spends).
    • The author guide (a new "Initiative that attacks move" section, the key reference and Not yet), the player page, the plan doc and the CHANGELOG.
    • Gravewatch keeps its rethrown sum. The guide's example and the lanes use a variant of it.
  • Not built, and said so: anything that changes what a spending blow throws (a weapon's own dice, a floor of dice), anything that shrinks a taking blow against a sturdy target, and a crash that lasts longer the deeper it went.
  • Older lanes adjusted. The lifecycle lane follows the version, and the pool lane no longer pins it. The screen lane gains a line for the new event.

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 7e736ab11 (this branch's two commits on staging c481ce37d), all exit 0: pnpm check (localization included), pnpm regression:node (408/408, 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 (10/10). The client build's warning that GameSurface is over 512 kB is staging's: that chunk is 514.66 kB on staging too.

  • New lane scripts/regressions/game-ruleset-combat-moving-initiative.regression.ts, on a Gravewatch variant with scripted dice, covers:
    • the opening pool, a creature's pool, and a pool thrown every round;
    • the menu's styles, forecasts and words, and a crashed maker offered only a taking style;
    • taking (soak included) and crashing, with the log;
    • spending with no soak or extra dice, and the miss table;
    • a miss that crashes its own maker, rising above the line, recovery by count, an opening crash, and the fight ending;
    • a held spending blow keeping its style and its number when an answer crashes its maker;
    • a reaction's attack in the first style, and an action made of several only taking;
    • the window at a round's end, every import refusal and the 1.48 gate.
  • Thirty-four deliberate breaks of these rules, in the shared rules, the server and the client's log and menu, were each caught.
  • scripts/regressions/ruleset-combat-director.regression.ts gains:
    • twenty seeded fights played by the Engine on both sides, where every fight ends, both styles are used, somebody crashes and nothing is refused;
    • a Game Master's boss offered each style as its own choice;
    • a player's command with a style, and one refused;
    • fleeing, which leaves nobody crashed.
  • A new browser test in e2e/game-combat-director.e2e.ts imports the variant, clicks Spade, picks Press in the style step, picks the target, and checks that the command carries the style and that the log line names it.

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

Fixed one: the resolver read an attack's style again from its maker's number as the blow landed. So a held spending blow whose maker was crashed by an answer became a taking one, and the number it threw was read late. The style is now fixed when the attack is made and carried on the resume with that number. An action made of several only takes, and a ruleset needs at least one taking style.

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

  • Import a copy of docs/examples/rulesets/gravewatch.json with the "Initiative that attacks move" block from the author guide in its combat.initiative (and a reeling live condition).
  • Start a Game Mode fight against a Grave-rat swarm.
  • Confirm the status panel shows everybody's initiative.
  • Click an Arm and confirm the style step offers Press and Telling blow, each with its own forecast.
  • Make a Press and confirm the rats' number falls and yours rises, with their health unchanged.
  • Make a Telling blow and confirm it throws your number as damage, and your number goes back to 3.
  • Get somebody to 0 and confirm they show Reeling, are offered only Press, and recover after three of their turns.
  • Check light and dark mode and mobile width on the style step.

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

Translations for the ruleset arc are batched in #6742, which lists this PR's three translated pages with the earlier slices'.

UI evidence (if applicable)

The browser test saves a screenshot of the fight after a Press: the status panel with each combatant's initiative, and the log lines for the blow, the damage dice and both numbers.

Summary by CodeRabbit

  • New Features

    • Rulesets can roll initiative with dice pools and an optional success bonus, or track initiative as a changing resource throughout combat.
    • Attacks can take initiative from a target or spend the attacker’s initiative to deal damage. Configurable crash effects, missed-spend losses, and recovery shape how initiative changes.
    • Combat displays initiative values, orders turns by current initiative, and offers attack styles with forecasts. The combat log records initiative shifts, crashes, and recovery.
    • Game Masters can choose attack styles when directing combat.
  • Compatibility

    • Rulesets using these initiative options require Capability API 1.48 or later.

🔄 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/6741 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/27/2026 **Status:** ✅ Merged **Merged:** 9/27/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/ruleset-combat-initiative-resource` --- ### 📝 Commits (7) - [`ab20230`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ab2023006009245ba75f84fa4449b880462e38fe) feat(game): initiative as a number attacks move, for pool fights - [`7e736ab`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7e736ab112cbf9f8d30c7baad865dae3c140840d) fix(game): an attack keeps the style and the number it was made with - [`89b1aba`](https://github.com/Pasta-Devs/Marinara-Engine/commit/89b1aba47d36915b3677440f51f272712d275084) fix(game): every fight end lifts crashes, and a moving number opens as a pool - [`2f964b8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2f964b8aa6c71da0c6a5c4f6940a512d0053588b) Merge remote-tracking branch 'origin/staging' into feat/ruleset-combat-initiative-resource - [`276f68f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/276f68f8520436616cb1a5a4bbfd9a3f6dead9bb) docs(game): a combatant crashes at the ruleset's crash line, not at zero - [`13261a7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/13261a7e135cfa4ae30474541822d395f4ab5a70) docs(game): a spending attack resets on a hit and costs the ruleset's loss on a miss - [`9acda4a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9acda4aa72e07c8f796b919f80ed4951f1a552c3) Merge remote-tracking branch 'origin/staging' into feat/ruleset-combat-initiative-resource ### 📊 Changes **30 files changed** (+2663 additions, -146 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+55 -2) 📝 `docs/extending/ruleset.schema.json` (+299 -3) 📝 `docs/extending/writing-rulesets.md` (+68 -6) 📝 `docs/game/combat.md` (+1 -1) 📝 `e2e/game-combat-director.e2e.ts` (+188 -0) 📝 `packages/client/src/components/game/DirectedCombatUI.tsx` (+2 -0) 📝 `packages/client/src/components/game/RulesetCombatBoard.tsx` (+4 -3) 📝 `packages/client/src/components/game/RulesetCombatMenu.tsx` (+55 -10) 📝 `packages/client/src/components/game/RulesetCombatStatus.tsx` (+7 -0) 📝 `packages/client/src/lib/ruleset-combat-log.ts` (+76 -32) 📝 `packages/client/src/lib/ruleset-combat-menu.ts` (+25 -2) 📝 `packages/client/src/localization/locales/en.json` (+12 -0) 📝 `packages/server/src/routes/combat-director.routes.ts` (+1 -0) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+15 -0) 📝 `packages/server/src/services/game/ruleset-combat-director.service.ts` (+120 -38) 📝 `packages/shared/src/features/combat-director.ts` (+3 -0) 📝 `packages/shared/src/features/ruleset-combat/encounter.ts` (+88 -13) 📝 `packages/shared/src/features/ruleset-combat/index.ts` (+1 -0) 📝 `packages/shared/src/features/ruleset-combat/options.ts` (+39 -0) _...and 10 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 #6740 ## Why this change #6739 gave pool rulesets a fight of their own, with initiative as an order. The other half of the ruleset gap report's Storyteller item (W10) is initiative as a number that attacks move: a pool thrown at the start sets it, one way of attacking takes it from the target, another spends it as damage, and whoever runs out crashes. A ruleset could not describe any of that. This is the second and last Storyteller slice. ## What changed Capability API **1.48** (file keys: `initiative.pool`, `initiative.plus` and `initiative.resource`, all for `dice-pool` fights). None of it names one game's words. - **An opening pool.** Initiative is `dice` with `modifier`, or `pool` with `plus`: exactly one. A pool is thrown through the check roller, and its successes plus `plus` are the number. A creature's `initiativeModifier` is its pool. `each: "round"` with a pool throws the pool again. - **A number attacks move** (`initiative.resource`). The number is kept, never thrown again, and the order is sorted by it as each round begins. - `styles` (one to four, at least one that takes) are the ways any attack may be made. Each attack is offered once per style, and a player picks the style before the target. The style is chosen beside the option (`choice.style`), so nothing that finds an action by its id changes. - **Takes.** On a hit, the damage is thrown as usual, soak included, and comes off the target's number instead of their health. The attacker gains it plus `gain`. - **Spends.** Offered only above the crash line, and never for an action made of several. The damage is the attacker's number, as they made the attack, in dice: no weapon dice, no extra dice from the hit, no soak. The number then resets to `base`, or a miss costs what `onMiss` (a step table) says. - `crash`: the line, a condition of the ruleset's own, a bonus for whoever crashed somebody, and how many of their own turns before they recover to `base`. A crash lifts when the number rises above the line, when the count runs out, and when the fight ends however it ends. Somebody who opens at the line starts crashed. - An attack keeps its style and its number until it is over, even when an answer moves its maker's number before it lands. Anything made out of a turn (an opportunity strike, a signature move, a reaction) is made in the first style, so a window menu offers no style step. - **Menu, picker and log.** - Each style carries its own forecast. The option itself then shows only its chance, and the style step says what each would take or deal. - The status panel shows everybody's number. - The Engine's picker weighs every style: a taking blow one turn ahead, against spending now and again from the base. - The Game Master's decision options and the route's `ruleset` command carry `style`. An unknown one is refused as `unknown-style`. - New log lines, such as "Ada gains 5 initiative for crashing Grave-rat swarm, and is on 14." and "Ada spends their initiative, and it goes back to 3." New strings are in `en.json` only. - **Around it.** - The install gate, and the regenerated published schema (with editor patches for dice or pool, and takes or spends). - The author guide (a new "Initiative that attacks move" section, the key reference and Not yet), the player page, the plan doc and the CHANGELOG. - Gravewatch keeps its rethrown sum. The guide's example and the lanes use a variant of it. - **Not built, and said so:** anything that changes what a spending blow throws (a weapon's own dice, a floor of dice), anything that shrinks a taking blow against a sturdy target, and a crash that lasts longer the deeper it went. - **Older lanes adjusted.** The lifecycle lane follows the version, and the pool lane no longer pins it. The screen lane gains a line for the new event. ## 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 7e736ab11 (this branch's two commits on staging c481ce37d), all exit 0: `pnpm check` (localization included), `pnpm regression:node` (408/408, 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` (10/10). The client build's warning that GameSurface is over 512 kB is staging's: that chunk is 514.66 kB on staging too. - New lane `scripts/regressions/game-ruleset-combat-moving-initiative.regression.ts`, on a Gravewatch variant with scripted dice, covers: - the opening pool, a creature's pool, and a pool thrown every round; - the menu's styles, forecasts and words, and a crashed maker offered only a taking style; - taking (soak included) and crashing, with the log; - spending with no soak or extra dice, and the miss table; - a miss that crashes its own maker, rising above the line, recovery by count, an opening crash, and the fight ending; - a held spending blow keeping its style and its number when an answer crashes its maker; - a reaction's attack in the first style, and an action made of several only taking; - the window at a round's end, every import refusal and the 1.48 gate. - Thirty-four deliberate breaks of these rules, in the shared rules, the server and the client's log and menu, were each caught. - `scripts/regressions/ruleset-combat-director.regression.ts` gains: - twenty seeded fights played by the Engine on both sides, where every fight ends, both styles are used, somebody crashes and nothing is refused; - a Game Master's boss offered each style as its own choice; - a player's command with a style, and one refused; - fleeing, which leaves nobody crashed. - A new browser test in `e2e/game-combat-director.e2e.ts` imports the variant, clicks Spade, picks Press in the style step, picks the target, and checks that the command carries the style and that the log line names it. Local CodeRabbit (`coderabbit review --agent --committed`), two passes: 1 and 0 findings. Fixed one: the resolver read an attack's style again from its maker's number as the blow landed. So a held spending blow whose maker was crashed by an answer became a taking one, and the number it threw was read late. The style is now fixed when the attack is made and carried on the resume with that number. An action made of several only takes, and a ruleset needs at least one taking style. Still to verify by hand (not done by the agent): - Import a copy of `docs/examples/rulesets/gravewatch.json` with the "Initiative that attacks move" block from the author guide in its `combat.initiative` (and a `reeling` live condition). - Start a Game Mode fight against a Grave-rat swarm. - Confirm the status panel shows everybody's initiative. - Click an Arm and confirm the style step offers Press and Telling blow, each with its own forecast. - Make a Press and confirm the rats' number falls and yours rises, with their health unchanged. - Make a Telling blow and confirm it throws your number as damage, and your number goes back to 3. - Get somebody to 0 and confirm they show Reeling, are offered only Press, and recover after three of their turns. - Check light and dark mode and mobile width on the style step. ## 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` (carried by `docs-i18n`) - `docs/game/combat.md` (carried by `docs-i18n`) - `docs/extending/ruleset.schema.json`, regenerated - `docs/development/game-rulesets-and-sheets-implementation.md` (carried by `docs-i18n`) - `CHANGELOG.md` Translations for the ruleset arc are batched in #6742, which lists this PR's three translated pages with the earlier slices'. ## UI evidence (if applicable) The browser test saves a screenshot of the fight after a Press: the status panel with each combatant's initiative, and the log lines for the blow, the damage dice and both numbers. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Rulesets can roll initiative with dice pools and an optional success bonus, or track initiative as a changing resource throughout combat. * Attacks can take initiative from a target or spend the attacker’s initiative to deal damage. Configurable crash effects, missed-spend losses, and recovery shape how initiative changes. * Combat displays initiative values, orders turns by current initiative, and offers attack styles with forecasts. The combat log records initiative shifts, crashes, and recovery. * Game Masters can choose attack styles when directing combat. * **Compatibility** * Rulesets using these initiative options require Capability API 1.48 or later. <!-- 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#7307
No description provided.