[PR #6525] [MERGED] feat(game): hold a ruleset fight open so a strike at somebody walking away is a choice #7212

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

📋 Pull Request Information

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

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


📝 Commits (1)

  • 42ef613 feat(game): a fight can be held open for somebody who is not acting

📊 Changes

18 files changed (+1074 additions, -118 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/development/game-combat-rulesets-implementation.md (+6 -2)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+51 -10)
📝 docs/extending/writing-rulesets.md (+52 -17)
📝 packages/client/src/components/game/RulesetCombatMenu.tsx (+37 -6)
📝 packages/client/src/lib/ruleset-combat-log.ts (+10 -0)
📝 packages/client/src/localization/locales/en.json (+6 -0)
📝 packages/server/src/services/game/ruleset-combat-director.service.ts (+233 -17)
📝 packages/shared/src/features/combat-director.ts (+17 -1)
📝 packages/shared/src/features/ruleset-combat/encounter.ts (+3 -1)
📝 packages/shared/src/features/ruleset-combat/index.ts (+13 -6)
📝 packages/shared/src/features/ruleset-combat/options.ts (+49 -0)
📝 packages/shared/src/features/ruleset-combat/resolve.ts (+212 -32)
📝 packages/shared/src/features/ruleset-combat/types.ts (+63 -0)
📝 scripts/regressions/game-ruleset-combat-creatures.regression.ts (+75 -19)
📝 scripts/regressions/game-ruleset-combat-grid.regression.ts (+203 -7)
📝 scripts/regressions/ruleset-combat-director.regression.ts (+34 -0)
📝 scripts/regressions/ruleset-combat-screen-client.regression.ts (+8 -0)

📄 Description

Linked issue

Closes #6524

Why this change

Two things happened to people in a ruleset fight without asking them.

Walking out of an enemy's reach: the Engine made that enemy's strike for them and moved on. In most tabletop systems taking that strike is a decision, and it spends a resource the holder may want to keep. A player watched their own character spend a reaction they were saving, and an enemy that should have held back swung anyway.

Buying a signature action: a creature holding its own points could buy one at any moment that was not its own turn, but nothing ever offered one, so a creature written with them behaved as though it had none.

Both are the same missing piece. The fight could not be held open, so there was nowhere for somebody who is not the current actor to act.

What changed

  • A walk stops and asks. The step that leaves an enemy's reach holds the fight open instead of striking for them. Taking the strike spends the declared budget and resolves exactly as the same attack would on the striker's own turn; letting it go by costs nothing. Either way the walk picks up where it was held, paying for every cell it really crossed, and a strike that drops the mover still ends the walk where they fell.
  • The turn between two actors stops and asks. When a turn ends, every opponent holding points who can afford one of its own signature actions is asked before the next turn begins. That is now the only moment those are bought in: off its window a signature action is refused.
  • While a window is open nothing else moves, including the end of the turn behind it. Every other choice is refused with window-open, and an answer naming a window that has closed is refused with stale-window rather than taken for a turn's choice.
  • One answer each, struck or passed, however many times a path leaves the same reach. Somebody left with nothing they can take is skipped rather than asked.
  • The window lives in the encounter state (RulesetEncounterState.window), with the rest of the interrupted walk inside it, so a game closed mid-walk comes back with the same people still to ask and the same cells still to walk.
  • One entry point. applyRulesetCombatChoice takes a window answer exactly as it takes a turn's choice, off rulesetWindowOptions or RULESET_PASS_OPTION.
  • The director drives it. Everybody in a window who is not a person's to play answers there and then, out of the window's own menu and through the same scoring that plays their turn; a Game Master's boss is asked through the Game Master's own decision, with letting the moment go by as one of the answers. The window is left standing only for a party member the player plays.
  • On screen. DirectedRulesetView.window says who is being asked and why; the menu becomes theirs, with a Pass beside it, and the log prints the window, the pass and the strike.
  • Docs: the authoring guide gains a Windows section and loses the claims that reactions do not exist and that the opportunity strike is automatic. Both implementation handoffs record what C5b settled.

No new ruleset key and no capability bump. combat.opportunity.budget, signature and signaturePoints were all already declared; what changed is that the Engine asks instead of deciding, so a package built before this plays the same fight one question at a time.

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

What I ran here, for the reviewer's information rather than in place of the boxes above: pnpm check (exit 0) and the full pnpm regression lane (346/346) on this branch rebased onto staging at 0df28742c, plus a local CodeRabbit sweep that came back with no findings after three fixes it caught (a stale window answer falling through to the turn path, a duplicate outcome event, and a round rollover inside a window not handing the Game Master its calls back).

Manual verification notes

Needs a real fight in a browser, on a game using a ruleset that declares combat.opportunity.budget (the ruleset-5e-2014 package does):

  • Manually verify that walking a party member out of an enemy's reach stops the walk and shows the window prompt naming the enemy and the mover, with the strike and Pass on the menu.
  • Manually verify that taking the strike spends the reaction, prints the strike in the log, and finishes the walk on the intended cell with the right movement left.
  • Manually verify that pressing Pass spends nothing and finishes the same walk.
  • Manually verify that walking back through the same enemy's reach on the same turn opens no second window.
  • Manually verify the prompt and the Pass button at a phone width and in both light and dark mode.
  • Manually verify that an enemy walking away from a party member opens the window for the party member, and that an enemy walking away from another enemy does not stop the fight for the player at all.
  • Manually verify that a fight against an opponent with signature points pauses between turns and that the Game Master buys one, with the log line reading as a pause rather than as an interruption.
  • Manually verify that closing the game mid-walk and reopening it comes back with the same question still on screen.

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/extending/writing-rulesets.md changed, so this belongs in the next batched [docs-i18n] follow-up issue rather than one of its own.

UI evidence (if applicable)

None yet. The window prompt and its Pass button are the only new UI, and both want a real fight rather than a screenshot of a fixture.

Summary by CodeRabbit

  • New Features

    • Added combat windows for opportunity attacks when leaving an enemy’s reach.
    • Added between-turn windows for eligible combatants to purchase signature actions.
    • Added Pass options, directed prompts, and combat log messages for open windows.
    • Saved games resume open windows at the same point.
    • Prompts are directed to the appropriate player, AI-controlled combatant, or Game Master.
  • Bug Fixes

    • Movement resumes from the interrupted position and charges only for cells crossed.
    • Each opportunity is offered only once per walk.
    • Other combat actions are blocked until the open window is answered.

🔄 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/6525 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/22/2026 **Status:** ✅ Merged **Merged:** 9/22/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/ruleset-combat-windows` --- ### 📝 Commits (1) - [`42ef613`](https://github.com/Pasta-Devs/Marinara-Engine/commit/42ef6133623693a369632ec78649da0de704ee47) feat(game): a fight can be held open for somebody who is not acting ### 📊 Changes **18 files changed** (+1074 additions, -118 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/development/game-combat-rulesets-implementation.md` (+6 -2) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+51 -10) 📝 `docs/extending/writing-rulesets.md` (+52 -17) 📝 `packages/client/src/components/game/RulesetCombatMenu.tsx` (+37 -6) 📝 `packages/client/src/lib/ruleset-combat-log.ts` (+10 -0) 📝 `packages/client/src/localization/locales/en.json` (+6 -0) 📝 `packages/server/src/services/game/ruleset-combat-director.service.ts` (+233 -17) 📝 `packages/shared/src/features/combat-director.ts` (+17 -1) 📝 `packages/shared/src/features/ruleset-combat/encounter.ts` (+3 -1) 📝 `packages/shared/src/features/ruleset-combat/index.ts` (+13 -6) 📝 `packages/shared/src/features/ruleset-combat/options.ts` (+49 -0) 📝 `packages/shared/src/features/ruleset-combat/resolve.ts` (+212 -32) 📝 `packages/shared/src/features/ruleset-combat/types.ts` (+63 -0) 📝 `scripts/regressions/game-ruleset-combat-creatures.regression.ts` (+75 -19) 📝 `scripts/regressions/game-ruleset-combat-grid.regression.ts` (+203 -7) 📝 `scripts/regressions/ruleset-combat-director.regression.ts` (+34 -0) 📝 `scripts/regressions/ruleset-combat-screen-client.regression.ts` (+8 -0) </details> ### 📄 Description ## Linked issue Closes #6524 ## Why this change Two things happened to people in a ruleset fight without asking them. Walking out of an enemy's reach: the Engine made that enemy's strike for them and moved on. In most tabletop systems taking that strike is a decision, and it spends a resource the holder may want to keep. A player watched their own character spend a reaction they were saving, and an enemy that should have held back swung anyway. Buying a signature action: a creature holding its own points could buy one at any moment that was not its own turn, but nothing ever offered one, so a creature written with them behaved as though it had none. Both are the same missing piece. The fight could not be held open, so there was nowhere for somebody who is not the current actor to act. ## What changed - **A walk stops and asks.** The step that leaves an enemy's reach holds the fight open instead of striking for them. Taking the strike spends the declared budget and resolves exactly as the same attack would on the striker's own turn; letting it go by costs nothing. Either way the walk picks up where it was held, paying for every cell it really crossed, and a strike that drops the mover still ends the walk where they fell. - **The turn between two actors stops and asks.** When a turn ends, every opponent holding points who can afford one of its own `signature` actions is asked before the next turn begins. That is now the only moment those are bought in: off its window a signature action is refused. - **While a window is open nothing else moves**, including the end of the turn behind it. Every other choice is refused with `window-open`, and an answer naming a window that has closed is refused with `stale-window` rather than taken for a turn's choice. - **One answer each**, struck or passed, however many times a path leaves the same reach. Somebody left with nothing they can take is skipped rather than asked. - **The window lives in the encounter state** (`RulesetEncounterState.window`), with the rest of the interrupted walk inside it, so a game closed mid-walk comes back with the same people still to ask and the same cells still to walk. - **One entry point.** `applyRulesetCombatChoice` takes a window answer exactly as it takes a turn's choice, off `rulesetWindowOptions` or `RULESET_PASS_OPTION`. - **The director drives it.** Everybody in a window who is not a person's to play answers there and then, out of the window's own menu and through the same scoring that plays their turn; a Game Master's boss is asked through the Game Master's own decision, with letting the moment go by as one of the answers. The window is left standing only for a party member the player plays. - **On screen.** `DirectedRulesetView.window` says who is being asked and why; the menu becomes theirs, with a Pass beside it, and the log prints the window, the pass and the strike. - Docs: the authoring guide gains a Windows section and loses the claims that reactions do not exist and that the opportunity strike is automatic. Both implementation handoffs record what C5b settled. No new ruleset key and no capability bump. `combat.opportunity.budget`, `signature` and `signaturePoints` were all already declared; what changed is that the Engine asks instead of deciding, so a package built before this plays the same fight one question at a time. ## 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` What I ran here, for the reviewer's information rather than in place of the boxes above: `pnpm check` (exit 0) and the full `pnpm regression` lane (346/346) on this branch rebased onto `staging` at `0df28742c`, plus a local CodeRabbit sweep that came back with no findings after three fixes it caught (a stale window answer falling through to the turn path, a duplicate outcome event, and a round rollover inside a window not handing the Game Master its calls back). ### Manual verification notes Needs a real fight in a browser, on a game using a ruleset that declares `combat.opportunity.budget` (the `ruleset-5e-2014` package does): - Manually verify that walking a party member out of an enemy's reach stops the walk and shows the window prompt naming the enemy and the mover, with the strike and Pass on the menu. - Manually verify that taking the strike spends the reaction, prints the strike in the log, and finishes the walk on the intended cell with the right movement left. - Manually verify that pressing Pass spends nothing and finishes the same walk. - Manually verify that walking back through the same enemy's reach on the same turn opens no second window. - Manually verify the prompt and the Pass button at a phone width and in both light and dark mode. - Manually verify that an enemy walking away from a party member opens the window for the party member, and that an enemy walking away from another enemy does not stop the fight for the player at all. - Manually verify that a fight against an opponent with signature points pauses between turns and that the Game Master buys one, with the log line reading as a pause rather than as an interruption. - Manually verify that closing the game mid-walk and reopening it comes back with the same question still on screen. ## 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/extending/writing-rulesets.md` changed, so this belongs in the next batched `[docs-i18n]` follow-up issue rather than one of its own. ## UI evidence (if applicable) None yet. The window prompt and its Pass button are the only new UI, and both want a real fight rather than a screenshot of a fixture. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added combat windows for opportunity attacks when leaving an enemy’s reach. - Added between-turn windows for eligible combatants to purchase signature actions. - Added Pass options, directed prompts, and combat log messages for open windows. - Saved games resume open windows at the same point. - Prompts are directed to the appropriate player, AI-controlled combatant, or Game Master. - **Bug Fixes** - Movement resumes from the interrupted position and charges only for cells crossed. - Each opportunity is offered only once per walk. - Other combat actions are blocked until the open window is answered. <!-- 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:17:34 +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#7212
No description provided.