[PR #6715] [MERGED] feat(game): counters in ruleset combat: a reaction that answers an entry being used #7296

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

📋 Pull Request Information

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

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


📝 Commits (1)

  • a63fa18 feat(game): a reaction that answers an entry being used, and what it answers

📊 Changes

30 files changed (+823 additions, -84 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+28 -1)
📝 docs/examples/rulesets/ember-roads.json (+28 -0)
📝 docs/extending/ruleset.schema.json (+26 -2)
📝 docs/extending/writing-rulesets.md (+37 -13)
📝 docs/game/combat.md (+2 -0)
📝 packages/client/src/components/game/RulesetCombatMenu.tsx (+1 -0)
📝 packages/client/src/lib/ruleset-combat-log.ts (+1 -0)
📝 packages/client/src/localization/locales/en.json (+2 -0)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+19 -0)
📝 packages/server/src/services/game/ruleset-combat-director.service.ts (+1 -1)
📝 packages/shared/src/features/combat-director.ts (+1 -1)
📝 packages/shared/src/features/ruleset-combat/encounter.ts (+3 -0)
📝 packages/shared/src/features/ruleset-combat/options.ts (+11 -2)
📝 packages/shared/src/features/ruleset-combat/resolve.ts (+59 -22)
📝 packages/shared/src/features/ruleset-combat/types.ts (+20 -6)
📝 packages/shared/src/schemas/capability-package.schema.ts (+6 -1)
📝 packages/shared/src/schemas/ruleset.schema.ts (+24 -6)
📝 scripts/generate-ruleset-schema.mjs (+3 -2)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+4 -4)

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

Why this change

A ruleset could not write a counter. An entry could wait for two moments: aimed (something is about to be done to its holder) and harmed (something just hurt its holder). Neither fits a counter. It answers somebody using something wherever it reaches, including a blast aimed at a friend, and it answers only some kinds of thing: a spell, not a sword swing. A counter written on aimed would call off an axe aimed at its holder and could never protect a friend. That is why the 5e package ships Counterspell as reaction: true, which does nothing. This is C5e of real ruleset combat (plan doc, § Real ruleset combat).

What changed

Capability API 1.44 (file keys: on: "used" and against in a catalog entry's mechanics.reaction). None of it names one game's words.

  • A used moment. An entry whose reaction says on: "used" answers somebody on the other side using something, whoever it is aimed at.
    • The window opens before the use resolves, for everybody on the other side who holds such an entry and whose entry reaches the user. On a board that is its own range (or reach), with line of sight, even for a counter that points at nobody.
    • cancels is allowed on it, as on aimed. What the stopped action cost stays spent.
    • Only a real action opens it (an attack, an ability, a block). A standard action and a contest do not.
  • What a reaction answers. against: { catalogs: [...] } on any moment: only an action built from an entry of one of those catalogs opens the moment for this entry. A weapon row or a creature's own action has no entry behind it, so it never matches. Catalog ids are checked at import.
  • Order. When one action opens both, the use is asked about first; if nobody calls it off, the ones it is aimed at are asked next, and it resolves once both have answered. One window at a time, as before, so a counter still cannot be countered.
  • Screen and log. "Kindler uses Coldfire Toss, and Pell may answer." in the log, and the same on the window's menu. New strings are localized in en.json.
  • Engine opponents. The picker weighs a used answer that strikes back by what it does to whoever used the thing, the same as for aimed and harmed.
  • Install gate: a catalog entry (inline or in a catalog file) whose reaction says used or against needs 1.44. Published schema: regenerated; the generator's hand patch now allows cancels on used.
  • Example. Ember Roads gains Smother, a free knack that spends a point of Luck to stop a knack used within eight paces. Differs from the issue on purpose: the issue also gave the 5e reference a Counterspell, but that file carries no spells catalog. The SRD spells live in the 5e package in Marinara-Agents, which will adopt { "on": "used", "against": { "catalogs": ["spells"] }, "cancels": true } for Counterspell once 1.44 is on staging.
  • Docs:
    • Author guide (docs/extending/writing-rulesets.md): the Windows section gains the used moment, against, the order and an example. Not yet is updated: it now lists three moments, drops "a spell being cast as such" from the missing ones, and says a counter cannot tell one entry from another or need a check against something bigger. A stale line saying no entry could name the moment it waits for is replaced.
    • Player page (docs/game/combat.md), the plan doc's C5e 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 a63fa1834 (this branch's one commit on staging 77d4b0e57), all exit 0: pnpm check, pnpm localization:check, pnpm version:check, pnpm regression:node (402/402), 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). The browser runs were on the same tree before the squash; the squash changed no file. Mobile projects were not run locally. Local CodeRabbit (CLI 0.8.1) completed one pass with zero findings; earlier attempts on CLI 0.7.6 lost their connection before finishing.

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

    • the import refusals (a harmed reaction that cancels, an unknown catalog);
    • the used window: who is asked (only the other side, whoever the use is aimed at), its event, its menu, a cancel and its price, and letting it go;
    • against: an axe opens nothing for a counter that answers knacks, and opens it once the counter names no catalog;
    • reach on a board: four cells away is answered, five is not;
    • an answer that strikes back without cancelling lands first, then the use goes on, and the picker aims it at the user;
    • used before aimed, nothing aimed after a cancel, and no chain;
    • the log line and the 1.44 gate.

    Twenty deliberate breaks were each caught, among them: dropping the reach check, the catalog filter, the side filter, the used trigger's catalog, the aimed window after an uncancelled use, and each half of the 1.44 gate. Writing the board case found a real bug before the PR: a counter that cancels ignored its own range. It is fixed here.

  • Older lanes are adjusted:

    • Lanes that prove older gates strip entries that name a moment from the examples.
    • The lifecycle lane follows the new version, and the contests lane no longer pins the exact version.
    • Lanes that count Ember's knacks count eight (and Hard winter now offers Smother, which costs no Grit), and the combat-core lane follows the new cancel message.

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

  • In a Game Mode game on Ember Roads with a ruleset fight: give one party member the Smother knack. When an opponent uses a knack, confirm the fight pauses with "uses ..., and ... may answer.", Smother and Pass are offered, and Smother stops it and spends a point of Luck. Confirm an opponent's axe swing opens nothing. Check light and dark mode and mobile width.
  • On a Tactical (board) game, confirm Smother is offered only when the opponent is within eight paces.

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/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 window's menu and log line reuse the existing reaction window; the manual steps above cover what is new on screen.

Summary by CodeRabbit

  • New Features
    • Added pre-action reactions, allowing eligible opponents to respond before an action resolves. Reactions can cancel qualifying actions, be limited to specific catalogs, and are offered only when the responder is within range.
    • Added the Smother counter ability to the Ember Roads ruleset.
  • Documentation
    • Updated combat and ruleset guides with reaction timing, eligibility, range, and cancellation details.
  • Compatibility
    • Updated support to Capability API 1.44 for rulesets using these reaction features.

🔄 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/6715 **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-moments` --- ### 📝 Commits (1) - [`a63fa18`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a63fa1834cd53e966b3867801219e4e30a8972de) feat(game): a reaction that answers an entry being used, and what it answers ### 📊 Changes **30 files changed** (+823 additions, -84 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+28 -1) 📝 `docs/examples/rulesets/ember-roads.json` (+28 -0) 📝 `docs/extending/ruleset.schema.json` (+26 -2) 📝 `docs/extending/writing-rulesets.md` (+37 -13) 📝 `docs/game/combat.md` (+2 -0) 📝 `packages/client/src/components/game/RulesetCombatMenu.tsx` (+1 -0) 📝 `packages/client/src/lib/ruleset-combat-log.ts` (+1 -0) 📝 `packages/client/src/localization/locales/en.json` (+2 -0) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+19 -0) 📝 `packages/server/src/services/game/ruleset-combat-director.service.ts` (+1 -1) 📝 `packages/shared/src/features/combat-director.ts` (+1 -1) 📝 `packages/shared/src/features/ruleset-combat/encounter.ts` (+3 -0) 📝 `packages/shared/src/features/ruleset-combat/options.ts` (+11 -2) 📝 `packages/shared/src/features/ruleset-combat/resolve.ts` (+59 -22) 📝 `packages/shared/src/features/ruleset-combat/types.ts` (+20 -6) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+6 -1) 📝 `packages/shared/src/schemas/ruleset.schema.ts` (+24 -6) 📝 `scripts/generate-ruleset-schema.mjs` (+3 -2) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+4 -4) _...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 #6712 ## Why this change A ruleset could not write a counter. An entry could wait for two moments: `aimed` (something is about to be done to its holder) and `harmed` (something just hurt its holder). Neither fits a counter. It answers somebody using something wherever it reaches, including a blast aimed at a friend, and it answers only some kinds of thing: a spell, not a sword swing. A counter written on `aimed` would call off an axe aimed at its holder and could never protect a friend. That is why the 5e package ships Counterspell as `reaction: true`, which does nothing. This is C5e of real ruleset combat (plan doc, § Real ruleset combat). ## What changed Capability API **1.44** (file keys: `on: "used"` and `against` in a catalog entry's `mechanics.reaction`). None of it names one game's words. - **A `used` moment.** An entry whose reaction says `on: "used"` answers somebody on the other side using something, whoever it is aimed at. - The window opens before the use resolves, for everybody on the other side who holds such an entry and whose entry reaches the user. On a board that is its own `range` (or reach), with line of sight, even for a counter that points at nobody. - `cancels` is allowed on it, as on `aimed`. What the stopped action cost stays spent. - Only a real action opens it (an attack, an ability, a block). A standard action and a contest do not. - **What a reaction answers.** `against: { catalogs: [...] }` on any moment: only an action built from an entry of one of those catalogs opens the moment for this entry. A weapon row or a creature's own action has no entry behind it, so it never matches. Catalog ids are checked at import. - **Order.** When one action opens both, the use is asked about first; if nobody calls it off, the ones it is aimed at are asked next, and it resolves once both have answered. One window at a time, as before, so a counter still cannot be countered. - **Screen and log.** "Kindler uses Coldfire Toss, and Pell may answer." in the log, and the same on the window's menu. New strings are localized in `en.json`. - **Engine opponents.** The picker weighs a `used` answer that strikes back by what it does to whoever used the thing, the same as for `aimed` and `harmed`. - **Install gate:** a catalog entry (inline or in a catalog file) whose reaction says `used` or `against` needs 1.44. **Published schema:** regenerated; the generator's hand patch now allows `cancels` on `used`. - **Example.** Ember Roads gains Smother, a free knack that spends a point of Luck to stop a knack used within eight paces. **Differs from the issue on purpose:** the issue also gave the 5e reference a Counterspell, but that file carries no spells catalog. The SRD spells live in the 5e package in Marinara-Agents, which will adopt `{ "on": "used", "against": { "catalogs": ["spells"] }, "cancels": true }` for Counterspell once 1.44 is on staging. - **Docs:** - Author guide (`docs/extending/writing-rulesets.md`): the Windows section gains the `used` moment, `against`, the order and an example. Not yet is updated: it now lists three moments, drops "a spell being cast as such" from the missing ones, and says a counter cannot tell one entry from another or need a check against something bigger. A stale line saying no entry could name the moment it waits for is replaced. - Player page (`docs/game/combat.md`), the plan doc's C5e 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 a63fa1834 (this branch's one commit on staging 77d4b0e57), all exit 0: `pnpm check`, `pnpm localization:check`, `pnpm version:check`, `pnpm regression:node` (402/402), `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). The browser runs were on the same tree before the squash; the squash changed no file. Mobile projects were not run locally. Local CodeRabbit (CLI 0.8.1) completed one pass with zero findings; earlier attempts on CLI 0.7.6 lost their connection before finishing. - New lane `scripts/regressions/game-ruleset-combat-moments.regression.ts` covers: - the import refusals (a `harmed` reaction that cancels, an unknown catalog); - the `used` window: who is asked (only the other side, whoever the use is aimed at), its event, its menu, a cancel and its price, and letting it go; - `against`: an axe opens nothing for a counter that answers knacks, and opens it once the counter names no catalog; - reach on a board: four cells away is answered, five is not; - an answer that strikes back without cancelling lands first, then the use goes on, and the picker aims it at the user; - `used` before `aimed`, nothing aimed after a cancel, and no chain; - the log line and the 1.44 gate. Twenty deliberate breaks were each caught, among them: dropping the reach check, the catalog filter, the side filter, the used trigger's catalog, the `aimed` window after an uncancelled use, and each half of the 1.44 gate. Writing the board case found a real bug before the PR: a counter that cancels ignored its own range. It is fixed here. - Older lanes are adjusted: - Lanes that prove older gates strip entries that name a moment from the examples. - The lifecycle lane follows the new version, and the contests lane no longer pins the exact version. - Lanes that count Ember's knacks count eight (and Hard winter now offers Smother, which costs no Grit), and the combat-core lane follows the new cancel message. Still to verify by hand (not done by the agent): - In a Game Mode game on Ember Roads with a ruleset fight: give one party member the Smother knack. When an opponent uses a knack, confirm the fight pauses with "uses ..., and ... may answer.", Smother and Pass are offered, and Smother stops it and spends a point of Luck. Confirm an opponent's axe swing opens nothing. Check light and dark mode and mobile width. - On a Tactical (board) game, confirm Smother is offered only when the opponent is within eight paces. ## 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/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 window's menu and log line reuse the existing reaction window; the manual steps above cover what is new on screen. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added pre-action reactions, allowing eligible opponents to respond before an action resolves. Reactions can cancel qualifying actions, be limited to specific catalogs, and are offered only when the responder is within range. * Added the Smother counter ability to the Ember Roads ruleset. * **Documentation** * Updated combat and ruleset guides with reaction timing, eligibility, range, and cancellation details. * **Compatibility** * Updated support to Capability API 1.44 for rulesets using these reaction features. <!-- 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:23 +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#7296
No description provided.