mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6348] [MERGED] feat(game): lend the ruleset sheet to battles and write the outcome back (rulesets combat bridge) #7146
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#7146
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6348
Author: @kolacheee
Created: 9/19/2026
Status: ✅ Merged
Merged: 9/19/2026
Merged by: @SpicyMarinara
Base:
staging← Head:feat/rulesets-combat-bridge📝 Commits (10+)
6e6a575feat(game): the ruleset battle block and the combat bridge helpers (Capability API 1.22)f725560feat(game): lend the ruleset sheet to battles and write the outcome backdce6a4efix(game): say in the catalog picker when battles do use an entry's numbers088acabfix(game): carry health into a bridged battle as a share of the maximume9a003ffix(game): seed a bridged battle in the same tick, and hold alwaysWhen to the column's typefc76d4afix(game): refuse a health pool that starts empty, and say which mechanics fields a battle reads063671afix(game): hold the combat-starting gate while a bridged battle waits for its catalogs342d470fix(game): an area heal from the sheet never targets all enemies, and only the owning battle lowers the start gateee01f36refactor(game): one equals check for hideWhen and alwaysWhen, and memoize the picker's battle catalogsa74b31dfix(game): address the first CodeRabbit review of the combat bridge📊 Changes
25 files changed (+2219 additions, -53 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
docs/development/game-rulesets-and-sheets-implementation.md(+21 -5)📝
docs/development/optional-agent-packages.md(+26 -0)📝
docs/development/ruleset-5e-2014.example.json(+24 -0)📝
docs/examples/rulesets/ember-roads.json(+15 -3)📝
docs/extending/ruleset.schema.json(+119 -0)📝
docs/extending/writing-rulesets.md(+85 -2)📝
docs/game/combat.md(+4 -0)📝
packages/client/src/components/game/GameCombatUI.tsx(+5 -0)📝
packages/client/src/components/game/GameSurface.tsx(+192 -5)📝
packages/client/src/components/rulesets/RulesetCatalogPicker.tsx(+11 -1)📝
packages/client/src/hooks/use-capability-packages.ts(+16 -8)➕
packages/client/src/lib/ruleset-combat-bridge.ts(+180 -0)📝
packages/client/src/localization/locales/en.json(+3 -0)📝
packages/server/src/services/capability-packages/package-manager.service.ts(+12 -4)➕
packages/shared/src/features/rulesets/combat-bridge.ts(+391 -0)📝
packages/shared/src/features/tactical-combat/engine.ts(+5 -0)📝
packages/shared/src/index.ts(+1 -0)📝
packages/shared/src/schemas/capability-package.schema.ts(+6 -1)📝
packages/shared/src/schemas/ruleset.schema.ts(+130 -14)...and 5 more files
📄 Description
Linked issue
Part of #6314 (the combat bridge; it does not close the issue). Builds on #6345 (catalogs, merged).
Why this change
docs/development/game-combat-rulesets-implementation.mdreserves a real 5e combat adapter as its own later slice. This PR stays off that ground on purpose (no attack rolls, saves or concentration), the plan doc now says the bridge is superseded for a ruleset the day a real adapter for it exists, and I would like the maintainer's yes or no on that arrangement before or at merge.What changed
battleblock inruleset.json: the live pool that is health, an optional energy pool, the spell slot pools with their levels, and the sheet lists that supply skills (onlyWhena boolean column,alwaysWhena column equals a value, which is how 5e says "prepared spells, and cantrips always"). Cross-checked like the rest of the file. A ruleset without the block changes nothing, andcoverage.combatkeeps meaning "this ruleset brings its own combat rules".CombatSkills through the entry'smechanics: kind to type, range and burst area from the catalog's distance unit to grid cells, the amount's average topoweron the Engine's existing scale (divisor 7, clamped 0.5 to 3, so nothing hits harder than a skill the Engine could generate itself), a slot cost toslotLevel, an energy cost tompCost. Utility and reaction entries, hand-typed rows, and costs the Engine cannot spend are left out. An area attack or debuff targets all enemies in Classic; an area heal or buff stays single-target, because the Engine has no "all allies" scope. Attack rolls, saves, concentration and upcasting are not used.applyRulesetSheetOpthe Game Master's sheet commands use, in one game-state patch. A member whose health did not change gets no health change, so rounding can never move a sheet; a living member is never written below 1. The recap tells the Game Master the sheets were already updated. An abandoned battle writes nothing back.battleblock for packages, with a readable install refusal on an older declaration.docs/game/combat.md,docs/development/optional-agent-packages.md, the plan (what the bridge settled, the relationship to the combat handoff). The Ember Roads example gains abattleblock (Grit as health, Luck as energy) to prove the non-5e case; the 5e example gains one too, with Pact slots left out because a fixed level list cannot express them.game-ruleset-combat-bridge(schema refusals, seeding on both examples, skills, the share in both directions, write-back),ruleset-combat-bridge-client(the pure client composition: lookup by normalized name with the persona tie-break, merge of several members, the reload path).Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Commands run locally by the agent:
pnpm check(exit 0),pnpm localization:check, the full node regression lane (pnpm regression:node, 317 of 317), and the two new regressions. Six complete local CodeRabbit sweeps were run before opening. Their findings were fixed (the party is seeded in the same tick from preloaded catalogs, with the combat-starting gate held on the slow path; an area heal or buff from the sheet no longer borrows the "all enemies" scope; a health pool that starts empty is refused;alwaysWhen.equalsis typed likehideWhen; wording), and the last complete one returned no findings. One suggestion was declined: falling back to the reload path when the game state was not ready at battle start. Those fighters started at full, so measuring the end of the fight against the sheet's share would write health changes that never happened; the bridge stands aside for that fight instead. The e2e suite was checked by reading it: no spec sets a game ruleset or mocks the ruleset routes, so every combat spec takes the unchanged synchronous path; thecombatSkillsFromSheetandgeneratedPartyMemberToCombatantexportscore-flowsimports are untouched. Playwright was not run locally.The agent drove a scratch server on port 7820 with a fresh data folder and no model connected, using a scripted game on the Ember Roads example and the legacy
[combat:]tag to start a battle: a party member whose sheet read 5 of 9 Grit and 2 of 3 Luck started at 33 of 60 health and 2 of 3 energy, the toast appeared, the player without a sheet was untouched at 60 of 60, the auto-controlled member used a catalog skill ("Tessa Vane uses Coldfire Toss on Rust Hound for 11 damage"), she was hit down to 16 of 60, Flee ended the battle, and the sheet's live state then read 2 Grit and 2 Luck. The recap carried the line saying the sheets were already updated. The first pass, with raw numbers, is what showed the scale problem described above.Still to verify by hand:
battleblock (a follow-up release in Marinara-Agents): slots spent in the fight are gone on the sheet afterwards, and a prepared catalog spell appears as a skill.battleblock, fight exactly as before.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Docs touched:
CHANGELOG.md,docs/game/combat.md,docs/extending/writing-rulesets.md,docs/development/optional-agent-packages.md, the plan, both example rulesets and the generated schema. The[docs-i18n]follow-up is batched for the ruleset slices.UI evidence (if applicable)
To be added by a human: the toast at the start of a bridged battle and the combat HUD of a seeded member.
Summary by CodeRabbit
New Features
Documentation
Compatibility
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.