[PR #6710] [MERGED] feat(game): contests in ruleset combat: grab, shove and break free as data #7295

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

📋 Pull Request Information

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

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


📝 Commits (2)

  • ca89052 feat(game): contests in ruleset combat: grab, shove and break free as data
  • e3e00c8 test(game): swing the strike a grapple left in hand; contests stay a part of the plan

📊 Changes

35 files changed (+1945 additions, -43 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+34 -2)
📝 docs/development/ruleset-5e-2014.example.json (+54 -1)
📝 docs/examples/rulesets/ember-roads.json (+50 -0)
📝 docs/extending/ruleset.schema.json (+329 -0)
📝 docs/extending/writing-rulesets.md (+90 -9)
📝 docs/game/combat.md (+3 -1)
📝 e2e/game-combat-director.e2e.ts (+7 -0)
📝 packages/client/src/lib/ruleset-combat-board.ts (+1 -1)
📝 packages/client/src/lib/ruleset-combat-log.ts (+30 -0)
📝 packages/client/src/lib/ruleset-combat-menu.ts (+13 -4)
📝 packages/client/src/localization/locales/en.json (+6 -0)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+23 -0)
📝 packages/server/src/services/game/ruleset-combat-director.service.ts (+30 -0)
📝 packages/shared/src/features/ruleset-combat/creatures.ts (+19 -0)
📝 packages/shared/src/features/ruleset-combat/encounter.ts (+67 -0)
📝 packages/shared/src/features/ruleset-combat/grid.ts (+45 -0)
📝 packages/shared/src/features/ruleset-combat/hold.ts (+10 -3)
📝 packages/shared/src/features/ruleset-combat/index.ts (+4 -0)
📝 packages/shared/src/features/ruleset-combat/options.ts (+79 -2)

...and 15 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 #6707

Why this change

A ruleset's fight can attack, cast, heal, walk, react and buy signature actions, but it could not wrestle. Grabbing somebody, shoving them over or away and breaking free are the same move in most systems: each side rolls, adds its own number, and the winner changes what holds the loser or where the loser stands. None of it could be said, so the 5e package's grapple and shove were narration only, and a system like Ember Roads had no way to pin a foe in a fight at all. The author guide listed "no grapple or shove movement" under Not yet. This is C5d of real ruleset combat (plan doc, § Real ruleset combat).

What changed

Capability API 1.43 (file keys: checks and contests in the combat block, and checks on a creature). None of it names one game's words.

  • Checks. combat.checks are the numbers a contest reads, each a value off the sheet, read once when the fight begins, the way a defense or a save is. A creature written in plain numbers gives its own checks; one with a sheet reads them off it, and checks joins the keys a sheet replaces, so it may not give both.

  • Contests. Each entry in combat.contests names:

    • its budget, the checks each side may use (the best is rolled), and who takes a tie;
    • an optional reach, and strike (it may take the place of one strike when an action buys several);
    • an optional from: { holding };
    • onWin: the conditions it applies to the loser (with the winner as their source and an optional rounds), the conditions it ends on either side, and a push.

    reach and push need combat.distance. Differs from the issue on purpose: the issue gave the attacker a single check; both sides take a list, because breaking free rolls the better of two.

  • The fight.

    • Every combatant gets one action per contest, but only when the ruleset has contests, so a ruleset without them fights byte for byte as before.
    • A contest spends its budget, or a strike in hand, and is settled on the spot: both sides throw the attack dice and add their best check, the higher total wins, and one contest event carries both sides and the winner. It opens no window.
    • Winning ends and applies conditions and pushes, in that order. A push moves the loser straight away, stopping short of anything solid, anybody standing, the board's edge or a corner too tight to squeeze through. It spends nothing and draws no strike.
  • The menu.

    • A contest is its own group, with its exact chance to win shown as "to win".
    • Breaking free is offered only while held, and aimed only at whoever holds on.
    • The Engine's opponent picker scores a contest as a modest setup: breaking free 1, a grab 0.3, a shove 0.15, times the chance, so opponents wrestle now and then rather than instead of fighting. A Game Master's opponent picks it off the same menu.
    • An opponent a Game Master invents has its checks held to its tier's to-hit, in the plain clamp and on a built sheet.
  • Log. "Juno tries Grab on Ash-hound: 12 (6 + 6) + 3 = 15 with Brawn against 2 (1 + 1) + 2 = 4 with Brawn, and wins.", a line for a push, and a line for a condition a contest ended. New strings are localized in en.json.

  • Install gate: the ruleset keys, and a creature's checks inline or in a catalog file, each need 1.43. Published schema: the generator also says a win does at least one thing.

  • Examples.

    • The 5e reference grapples, shoves prone, shoves away 5 feet and escapes. Its Grappled condition now ends when its source goes down, which is the SRD rule and what a hold needs.
    • One 5e creature, the Thorn Lurker, gives its own checks.
    • Ember Roads grabs (a new Held condition), breaks free, and shoves back 4 paces.
  • Docs:

    • Author guide (docs/extending/writing-rulesets.md): a new Contests section; the combat key list, the creature keys and On screen updated; and Not yet updated, where the stale "no grapple or shove movement" is replaced by what is still not done (dragging, size limits, a contest opening a window, conditions changing one).
    • Player page (docs/game/combat.md), the regenerated JSON Schema, the plan doc's C5d notes and the CHANGELOG.

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 ca89052cf (this branch's one commit on staging 613721b22), all exit 0: pnpm check, pnpm localization:check, pnpm version:check, pnpm regression:node (401/401), pnpm ruleset:schema (no diff after regeneration), 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, including both ruleset fights). Mobile projects were not run locally. Local CodeRabbit, three completed passes: six findings, all fixed, the third pass clean. They were: reuse one dice distribution for both forecasts, settling a certain hit or miss before building it; a log example the Markdown would have turned into a list; refuse the same check twice on one side, and a breaking-free contest that applies the hold it breaks; and the player page still calling a push future work.

  • New lane scripts/regressions/game-ruleset-combat-contests.regression.ts covers:

    • every import refusal, including the same check twice on one side and a breaking-free contest that applies the hold it breaks;
    • the menu and its exact win chance;
    • winning, losing and both tie rules, and the defender's best check;
    • breaking free (offered only while held, aimed only at the holder, and ending the hold);
    • pushes on a board (straight, corner-wise, short of a wall, not into one, not through a squeezed corner, not onto somebody);
    • reach, and a contest taking the place of a strike on the 5e reference;
    • the tier hold on invented opponents, a ruleset with no contests unchanged, the log lines, the "to win" forecast, and the 1.43 gate.

    Thirty-six deliberate breaks were each caught. Two of them first slipped through, because their tests could pass for the wrong reason; both tests were tightened until they caught them.

  • scripts/regressions/ruleset-combat-director.regression.ts plays sixty seeded positioned Ember Roads fights with everybody under the Engine. Contests are taken, sometimes won and never refused, and a picker that never takes one is caught.

  • e2e/game-combat-director.e2e.ts checks the Contests group, its "to win" forecast, and that Break free is absent while nothing holds on.

  • Older lanes are adjusted:

    • Lanes that prove older gates strip the 1.43 keys from the examples.
    • The lifecycle lane follows the new version, and the slice 6 lane no longer pins the exact version.
    • A tier assertion counts only the tier's own actions.
    • The screen lane pins the new log lines and the menu order.

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

  • In a Game Mode game on Ember Roads with a ruleset fight: confirm the menu shows a Contests group with Grab and Shove back and their chance to win. Grab an opponent and confirm the log line and that the opponent is Held. On its turn, confirm it may Break free. Check light and dark mode and mobile width.
  • On a Tactical (board) game, Shove back an opponent and confirm it moves two squares straight away, stops at a wall or a body, and nobody strikes at it on the way.
  • On the 5e reference with a character whose attack buys two strikes, Grapple first and confirm the second strike is still offered free.

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
  • docs/examples/rulesets/ember-roads.json
  • docs/development/ruleset-5e-2014.example.json and 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 browser case saves the full-page screenshot of the ruleset fight with the Contests group on the menu. The manual steps above cover the rest.

Summary by CodeRabbit

  • New Features
    • Rulesets can define combat contests for actions such as grabbing, shoving, pushing, and breaking free. Both sides roll and add a check modifier; configured rules determine the outcome.
    • Contest options show the chance to win, and Engine-controlled opponents may use them.
    • Pushes move targets across the battlefield until blocked by terrain, another combatant, or the board edge.
  • Compatibility
    • Contest rules require Capability API 1.43.

🔄 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/6710 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/26/2026 **Status:** ✅ Merged **Merged:** 9/26/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/ruleset-combat-contests` --- ### 📝 Commits (2) - [`ca89052`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ca89052cf76c27e2bb33b5e22441295e9aa431e7) feat(game): contests in ruleset combat: grab, shove and break free as data - [`e3e00c8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e3e00c8be05dd8dada463af2d4879efd3b0ad30b) test(game): swing the strike a grapple left in hand; contests stay a part of the plan ### 📊 Changes **35 files changed** (+1945 additions, -43 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+34 -2) 📝 `docs/development/ruleset-5e-2014.example.json` (+54 -1) 📝 `docs/examples/rulesets/ember-roads.json` (+50 -0) 📝 `docs/extending/ruleset.schema.json` (+329 -0) 📝 `docs/extending/writing-rulesets.md` (+90 -9) 📝 `docs/game/combat.md` (+3 -1) 📝 `e2e/game-combat-director.e2e.ts` (+7 -0) 📝 `packages/client/src/lib/ruleset-combat-board.ts` (+1 -1) 📝 `packages/client/src/lib/ruleset-combat-log.ts` (+30 -0) 📝 `packages/client/src/lib/ruleset-combat-menu.ts` (+13 -4) 📝 `packages/client/src/localization/locales/en.json` (+6 -0) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+23 -0) 📝 `packages/server/src/services/game/ruleset-combat-director.service.ts` (+30 -0) 📝 `packages/shared/src/features/ruleset-combat/creatures.ts` (+19 -0) 📝 `packages/shared/src/features/ruleset-combat/encounter.ts` (+67 -0) 📝 `packages/shared/src/features/ruleset-combat/grid.ts` (+45 -0) 📝 `packages/shared/src/features/ruleset-combat/hold.ts` (+10 -3) 📝 `packages/shared/src/features/ruleset-combat/index.ts` (+4 -0) 📝 `packages/shared/src/features/ruleset-combat/options.ts` (+79 -2) _...and 15 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 #6707 ## Why this change A ruleset's fight can attack, cast, heal, walk, react and buy signature actions, but it could not wrestle. Grabbing somebody, shoving them over or away and breaking free are the same move in most systems: each side rolls, adds its own number, and the winner changes what holds the loser or where the loser stands. None of it could be said, so the 5e package's grapple and shove were narration only, and a system like Ember Roads had no way to pin a foe in a fight at all. The author guide listed "no grapple or shove movement" under Not yet. This is C5d of real ruleset combat (plan doc, § Real ruleset combat). ## What changed Capability API **1.43** (file keys: `checks` and `contests` in the combat block, and `checks` on a creature). None of it names one game's words. - **Checks.** `combat.checks` are the numbers a contest reads, each a value off the sheet, read once when the fight begins, the way a defense or a save is. A creature written in plain numbers gives its own `checks`; one with a sheet reads them off it, and `checks` joins the keys a sheet replaces, so it may not give both. - **Contests.** Each entry in `combat.contests` names: - its budget, the checks each side may use (the best is rolled), and who takes a tie; - an optional `reach`, and `strike` (it may take the place of one strike when an action buys several); - an optional `from: { holding }`; - `onWin`: the conditions it `applies` to the loser (with the winner as their source and an optional `rounds`), the conditions it `ends` on either side, and a `push`. `reach` and `push` need `combat.distance`. **Differs from the issue on purpose:** the issue gave the attacker a single check; both sides take a list, because breaking free rolls the better of two. - **The fight.** - Every combatant gets one action per contest, but only when the ruleset has contests, so a ruleset without them fights byte for byte as before. - A contest spends its budget, or a strike in hand, and is settled on the spot: both sides throw the attack dice and add their best check, the higher total wins, and one `contest` event carries both sides and the winner. It opens no window. - Winning ends and applies conditions and pushes, in that order. A push moves the loser straight away, stopping short of anything solid, anybody standing, the board's edge or a corner too tight to squeeze through. It spends nothing and draws no strike. - **The menu.** - A contest is its own group, with its exact chance to win shown as "to win". - Breaking free is offered only while held, and aimed only at whoever holds on. - The Engine's opponent picker scores a contest as a modest setup: breaking free 1, a grab 0.3, a shove 0.15, times the chance, so opponents wrestle now and then rather than instead of fighting. A Game Master's opponent picks it off the same menu. - An opponent a Game Master invents has its checks held to its tier's to-hit, in the plain clamp and on a built sheet. - **Log.** "Juno tries Grab on Ash-hound: 12 (6 + 6) + 3 = 15 with Brawn against 2 (1 + 1) + 2 = 4 with Brawn, and wins.", a line for a push, and a line for a condition a contest ended. New strings are localized in `en.json`. - **Install gate:** the ruleset keys, and a creature's `checks` inline or in a catalog file, each need 1.43. **Published schema:** the generator also says a win does at least one thing. - **Examples.** - The 5e reference grapples, shoves prone, shoves away 5 feet and escapes. Its Grappled condition now ends when its source goes down, which is the SRD rule and what a hold needs. - One 5e creature, the Thorn Lurker, gives its own checks. - Ember Roads grabs (a new Held condition), breaks free, and shoves back 4 paces. - **Docs:** - Author guide (`docs/extending/writing-rulesets.md`): a new Contests section; the combat key list, the creature keys and On screen updated; and Not yet updated, where the stale "no grapple or shove movement" is replaced by what is still not done (dragging, size limits, a contest opening a window, conditions changing one). - Player page (`docs/game/combat.md`), the regenerated JSON Schema, the plan doc's C5d notes and the CHANGELOG. ## 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 ca89052cf (this branch's one commit on staging 613721b22), all exit 0: `pnpm check`, `pnpm localization:check`, `pnpm version:check`, `pnpm regression:node` (401/401), `pnpm ruleset:schema` (no diff after regeneration), `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, including both ruleset fights). Mobile projects were not run locally. Local CodeRabbit, three completed passes: six findings, all fixed, the third pass clean. They were: reuse one dice distribution for both forecasts, settling a certain hit or miss before building it; a log example the Markdown would have turned into a list; refuse the same check twice on one side, and a breaking-free contest that applies the hold it breaks; and the player page still calling a push future work. - New lane `scripts/regressions/game-ruleset-combat-contests.regression.ts` covers: - every import refusal, including the same check twice on one side and a breaking-free contest that applies the hold it breaks; - the menu and its exact win chance; - winning, losing and both tie rules, and the defender's best check; - breaking free (offered only while held, aimed only at the holder, and ending the hold); - pushes on a board (straight, corner-wise, short of a wall, not into one, not through a squeezed corner, not onto somebody); - reach, and a contest taking the place of a strike on the 5e reference; - the tier hold on invented opponents, a ruleset with no contests unchanged, the log lines, the "to win" forecast, and the 1.43 gate. Thirty-six deliberate breaks were each caught. Two of them first slipped through, because their tests could pass for the wrong reason; both tests were tightened until they caught them. - `scripts/regressions/ruleset-combat-director.regression.ts` plays sixty seeded positioned Ember Roads fights with everybody under the Engine. Contests are taken, sometimes won and never refused, and a picker that never takes one is caught. - `e2e/game-combat-director.e2e.ts` checks the Contests group, its "to win" forecast, and that Break free is absent while nothing holds on. - Older lanes are adjusted: - Lanes that prove older gates strip the 1.43 keys from the examples. - The lifecycle lane follows the new version, and the slice 6 lane no longer pins the exact version. - A tier assertion counts only the tier's own actions. - The screen lane pins the new log lines and the menu order. Still to verify by hand (not done by the agent): - In a Game Mode game on Ember Roads with a ruleset fight: confirm the menu shows a Contests group with Grab and Shove back and their chance to win. Grab an opponent and confirm the log line and that the opponent is Held. On its turn, confirm it may Break free. Check light and dark mode and mobile width. - On a Tactical (board) game, Shove back an opponent and confirm it moves two squares straight away, stops at a wall or a body, and nobody strikes at it on the way. - On the 5e reference with a character whose attack buys two strikes, Grapple first and confirm the second strike is still offered free. ## 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` - `docs/examples/rulesets/ember-roads.json` - `docs/development/ruleset-5e-2014.example.json` and `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 browser case saves the full-page screenshot of the ruleset fight with the Contests group on the menu. The manual steps above cover the rest. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Rulesets can define combat contests for actions such as grabbing, shoving, pushing, and breaking free. Both sides roll and add a check modifier; configured rules determine the outcome. * Contest options show the chance to win, and Engine-controlled opponents may use them. * Pushes move targets across the battlefield until blocked by terrain, another combatant, or the board edge. * **Compatibility** * Contest rules require Capability API 1.43. <!-- 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:22 +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#7295
No description provided.