[PR #8170] [MERGED] feat(rulesets): let a ruleset name its combat styles (combat.styles, 1.379) #8138

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8170
Author: @kolacheee
Created: 10/23/2026
Status: ✅ Merged
Merged: 10/23/2026
Merged by: @kolacheee

Base: staging ← Head: claude/project-thread-qbf4fp


📝 Commits (6)

  • 888a4d3 feat(rulesets): let a ruleset name its combat styles (combat.styles, 1.379)
  • 2b1389c docs(rulesets): regenerate ruleset.schema.json for combat.styles
  • 42bf201 Merge remote-tracking branch 'origin/staging' into claude/project-thread-qbf4fp
  • d9805d9 fix(rulesets): a combat.styles fallback is always a style the client draws
  • 7fdd777 docs(rulesets): the published schema says combat.styles names each style once, one built in
  • 72b79c9 docs(rulesets): read the schema's built-in combat styles off the shared constant

📊 Changes

20 files changed (+458 additions, -71 deletions)

View changed files

📝 docs/extending/ruleset.schema.json (+16 -0)
📝 docs/extending/writing-rulesets.md (+22 -1)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+16 -5)
📝 packages/client/src/components/game/GameSetupWizard.tsx (+53 -36)
📝 packages/client/src/components/game/GameSurface.tsx (+10 -2)
📝 packages/client/src/features/chat-settings/sections/CombatStyleSection.tsx (+18 -5)
📝 packages/client/src/localization/locales/en.json (+2 -0)
📝 packages/server/src/routes/chats.routes.ts (+17 -0)
📝 packages/server/src/routes/encounter.routes.ts (+18 -14)
📝 packages/server/src/routes/game.routes.ts (+12 -1)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+4 -0)
📝 packages/server/src/services/generation/game-gm-prompt-runtime.ts (+6 -1)
➕ packages/shared/src/features/rulesets/combat-styles.ts (+46 -0)
📝 packages/shared/src/index.ts (+1 -0)
📝 packages/shared/src/schemas/capability-package.schema.ts (+3 -1)
📝 packages/shared/src/schemas/ruleset.schema.ts (+20 -0)
📝 packages/shared/src/types/game.ts (+4 -0)
📝 scripts/generate-ruleset-schema.mjs (+14 -0)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+7 -5)
➕ scripts/regressions/ruleset-combat-styles.regression.ts (+169 -0)

📄 Description

Linked issue

Closes #8169

Why this change

  • If a ruleset's rules need a board (areas, reach, cover), playing its fights in Classic breaks them: there is no board, area spells turn into "pick N targets", and positional rules are lost. Until now a ruleset couldn't prevent that.

What changed

  • Capability API 1.379: the ruleset's combat block can now carry an optional styles list of combat style ids, for example ["tactical"]. It takes up to 8 ids, each listed once. Leaving it out allows every style, as before.
  • The New Game wizard shows only the style buttons the chosen ruleset allows, plus a short note. If the player had picked a style the ruleset leaves out, the wizard shows and sends the first style the ruleset lists. The player's own pick is kept, so it comes back if they switch to another ruleset.
  • The game's Combat Style setting offers only the allowed styles, and shows a note saying the ruleset limits them.
  • The game surface plays a saved style the ruleset leaves out as the first one it lists. A fight that is already pinned keeps its style. A ruleset fight is still positioned only when the ruleset has combat.distance and the style is Tactical.
  • On the server:
    • Creating a game with a style the ruleset leaves out is refused (combat_style_not_allowed).
    • Changing gameCombatStyle in the metadata PATCH to such a style is refused.
    • The encounter route and the Game Master prompt use the same fallback.
  • A ruleset package that uses combat.styles must declare capabilityApi 1.379.
  • New shared helpers: rulesetCombatStyles, rulesetAllowsCombatStyle and rulesetCombatStyle. A shared GAME_COMBAT_STYLE_ID_PATTERN is now used by both the setup schema and the ruleset schema.
  • Docs: writing-rulesets.md explains which styles a game may play.

Validation

  • pnpm check: format, lint and type checks passed locally. The build and full regression run are running locally now.
  • 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

  • New regression scripts/regressions/ruleset-combat-styles.regression.ts covers:
    • parsing the list, including refusing duplicates, an empty list, a bad id, and more than 8 entries
    • the fallback rules, including registered styles a client doesn't have
    • the 1.378/1.379 gate
    • wiring in the wizard, settings, game surface, create route, metadata PATCH, encounter route and GM prompt
  • Passing locally: capability-package-lifecycle, ruleset-sheet-words and combat-style-registry, each with its minor updated.

Docs and release impact

  • No docs changes needed
  • Updated docs: docs/extending/writing-rulesets.md
  • Translated docs follow-up is tracked on #7512
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

  • The UI change only hides buttons and options a ruleset leaves out, and adds one line of muted note text.

🔄 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/8170 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 10/23/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `claude/project-thread-qbf4fp` --- ### 📝 Commits (6) - [`888a4d3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/888a4d3984de16665da74b651a1be818dea28a99) feat(rulesets): let a ruleset name its combat styles (combat.styles, 1.379) - [`2b1389c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2b1389cb620a280768c24fffe030e537cf2982a1) docs(rulesets): regenerate ruleset.schema.json for combat.styles - [`42bf201`](https://github.com/Pasta-Devs/Marinara-Engine/commit/42bf201f3168a0083f50be73bedf6b24b8e76165) Merge remote-tracking branch 'origin/staging' into claude/project-thread-qbf4fp - [`d9805d9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d9805d9be7e5c5ce7361a3c02bc0a999e9031420) fix(rulesets): a combat.styles fallback is always a style the client draws - [`7fdd777`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7fdd777b07dc30bf8f4e06f7b36fa433d2162b7f) docs(rulesets): the published schema says combat.styles names each style once, one built in - [`72b79c9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/72b79c92c367b97ef9ea902d998e2dcf36b1ac8d) docs(rulesets): read the schema's built-in combat styles off the shared constant ### 📊 Changes **20 files changed** (+458 additions, -71 deletions) <details> <summary>View changed files</summary> 📝 `docs/extending/ruleset.schema.json` (+16 -0) 📝 `docs/extending/writing-rulesets.md` (+22 -1) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+16 -5) 📝 `packages/client/src/components/game/GameSetupWizard.tsx` (+53 -36) 📝 `packages/client/src/components/game/GameSurface.tsx` (+10 -2) 📝 `packages/client/src/features/chat-settings/sections/CombatStyleSection.tsx` (+18 -5) 📝 `packages/client/src/localization/locales/en.json` (+2 -0) 📝 `packages/server/src/routes/chats.routes.ts` (+17 -0) 📝 `packages/server/src/routes/encounter.routes.ts` (+18 -14) 📝 `packages/server/src/routes/game.routes.ts` (+12 -1) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+4 -0) 📝 `packages/server/src/services/generation/game-gm-prompt-runtime.ts` (+6 -1) ➕ `packages/shared/src/features/rulesets/combat-styles.ts` (+46 -0) 📝 `packages/shared/src/index.ts` (+1 -0) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+3 -1) 📝 `packages/shared/src/schemas/ruleset.schema.ts` (+20 -0) 📝 `packages/shared/src/types/game.ts` (+4 -0) 📝 `scripts/generate-ruleset-schema.mjs` (+14 -0) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+7 -5) ➕ `scripts/regressions/ruleset-combat-styles.regression.ts` (+169 -0) </details> ### 📄 Description ## Linked issue Closes #8169 ## Why this change - If a ruleset's rules need a board (areas, reach, cover), playing its fights in Classic breaks them: there is no board, area spells turn into "pick N targets", and positional rules are lost. Until now a ruleset couldn't prevent that. ## What changed - Capability API 1.379: the ruleset's `combat` block can now carry an optional `styles` list of combat style ids, for example `["tactical"]`. It takes up to 8 ids, each listed once. Leaving it out allows every style, as before. - The New Game wizard shows only the style buttons the chosen ruleset allows, plus a short note. If the player had picked a style the ruleset leaves out, the wizard shows and sends the first style the ruleset lists. The player's own pick is kept, so it comes back if they switch to another ruleset. - The game's Combat Style setting offers only the allowed styles, and shows a note saying the ruleset limits them. - The game surface plays a saved style the ruleset leaves out as the first one it lists. A fight that is already pinned keeps its style. A ruleset fight is still positioned only when the ruleset has `combat.distance` and the style is Tactical. - On the server: - Creating a game with a style the ruleset leaves out is refused (`combat_style_not_allowed`). - Changing `gameCombatStyle` in the metadata PATCH to such a style is refused. - The encounter route and the Game Master prompt use the same fallback. - A ruleset package that uses `combat.styles` must declare capabilityApi 1.379. - New shared helpers: `rulesetCombatStyles`, `rulesetAllowsCombatStyle` and `rulesetCombatStyle`. A shared `GAME_COMBAT_STYLE_ID_PATTERN` is now used by both the setup schema and the ruleset schema. - Docs: `writing-rulesets.md` explains which styles a game may play. ## Validation - [x] `pnpm check`: format, lint and type checks passed locally. The build and full regression run are running locally now. - [ ] 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) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - New regression `scripts/regressions/ruleset-combat-styles.regression.ts` covers: - parsing the list, including refusing duplicates, an empty list, a bad id, and more than 8 entries - the fallback rules, including registered styles a client doesn't have - the 1.378/1.379 gate - wiring in the wizard, settings, game surface, create route, metadata PATCH, encounter route and GM prompt - Passing locally: `capability-package-lifecycle`, `ruleset-sheet-words` and `combat-style-registry`, each with its minor updated. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs: `docs/extending/writing-rulesets.md` - [x] Translated docs follow-up is tracked on #7512 - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) - The UI change only hides buttons and options a ruleset leaves out, and adds one line of muted note text. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:10:42 +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#8138
No description provided.