mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6397] [MERGED] feat(game): a ruleset fight can be fought on a board: positions, reach and range, areas, cover and opportunity strikes (real combat C4a) #7165
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#7165
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/6397
Author: @kolacheee
Created: 9/20/2026
Status: ✅ Merged
Merged: 9/20/2026
Merged by: @kolacheee
Base:
staging← Head:feat/ruleset-combat-grid📝 Commits (10+)
d62170ffeat(rulesets): a combat block may say what a cell is worth, and the menu measures itb54af61feat(rulesets): a ruleset fight resolves movement, reach, ranges, areas, cover and opportunity strikes97da4d3feat(game): a ruleset fight may be fought on the tactical engine's own board0daece6feat(rulesets): Capability API 1.28, and both examples say what a cell is worth1255ea1test(rulesets): the install gate pins Capability API 1.282a4a979test(rulesets): hand-drawn boards pin movement, reach, ranges, shapes, cover and opportunity strikes61935b2test(game): the director and its routes drive a positioned ruleset fight4533f32docs(rulesets): the Positions section, what a ruleset fight on a board does, and Capability API 1.28579eb42fix(game): a positioned fight's four new log lines, and the API pins move to 1.2819c8401fix(game): the picker judges walking against standing still over one list, and wastes no search on a cell it will not walk twice from📊 Changes
38 files changed (+5282 additions, -117 deletions)
View changed files
📝
CHANGELOG.md(+4 -0)📝
docs/development/game-combat-rulesets-implementation.md(+6 -2)📝
docs/development/game-rulesets-and-sheets-implementation.md(+49 -2)📝
docs/development/optional-agent-packages.md(+30 -0)📝
docs/development/ruleset-5e-2014.example.json(+45 -3)📝
docs/examples/rulesets/ember-roads.json(+13 -2)📝
docs/extending/ruleset.schema.json(+284 -4)📝
docs/extending/writing-rulesets.md(+152 -15)📝
docs/game/combat.md(+10 -0)📝
packages/client/src/lib/ruleset-combat-log.ts(+27 -0)📝
packages/client/src/localization/locales/en.json(+6 -0)📝
packages/server/src/routes/combat-director.routes.ts(+68 -0)📝
packages/server/src/services/capability-packages/package-manager.service.ts(+41 -0)📝
packages/server/src/services/game/combat-boss.service.ts(+39 -0)📝
packages/server/src/services/game/ruleset-combat-director.service.ts(+464 -18)📝
packages/shared/src/features/combat-director.ts(+28 -3)📝
packages/shared/src/features/ruleset-combat/creatures.ts(+1 -0)📝
packages/shared/src/features/ruleset-combat/encounter.ts(+180 -4)➕
packages/shared/src/features/ruleset-combat/grid.ts(+400 -0)📝
packages/shared/src/features/ruleset-combat/index.ts(+37 -4)...and 18 more files
📄 Description
Linked issue
Part of #6361 (real ruleset combat, slice C4a: positions, the shared and server half; it does not close the issue) and of #6314. Builds on #6386 (the fight on screen, merged).
Why this change
combat.distance { label, perCell }(5 ft in the 5e example, 2 paces in Ember Roads) is what makes a fight positionable, and every other distance in the block is in that unit.What changed
combat.distance,combat.ranged { long, adjacentFoe }(what shooting past normal range, or with a foe beside you, does),combat.cover { bonus },combat.opportunity { budget }, weaponreachandrange { normal, long? }oncombat.attacks[](a column of the list or a constant; a column reading 0 on a row means that row has no such distance, which is how a sword sits beside a thrown axe), a creature action'srangeas a number or{ normal, long? }, and a creature action'sarea { shape, size, friendlyFire? }, so a breath weapon is a real cone on a board and still catchestargetCountof them without one. Cross-checks: a cell is worth more than 0; the opportunity budget is declared; reach and range columns exist and are numbers;longis at leastnormal; and anything measured in cells is refused in a block that declares nodistance.ruleset-combat/grid.ts, pure, with hand-drawn boards in the regression): eight neighbours at one cell each and distance as the larger axis difference; entering a cell costs its terrain's move cost; nothing solid is entered, no corner is cut between two solid cells, a friend may be walked past, nobody may be stopped on, an enemy is a wall. Movement is a budget in cells, refilled each turn fromeconomy.movementor a creature'sspeed, spendable before, between and after actions.dashadds it again,speed-zeroremoves it, standing up costs half. Targets are filtered by reach, range and line of sight FROM WHERE THE ACTOR STANDS, by the one rule the menu and the resolution share. Areas are real shapes (burst, cone, line) that stop at anything solid and catch everybody in their cells unless the entry says its own side is spared;targetCountsays nothing for an area on a board. Cover is the ground under the target (the terrain table's own defense bonus above 0) and adds the ruleset'scover.bonusto the defense an attack is rolled against, with an event saying so. The three distance condition effects are finally read: adjacent is one cell, far is anything beyond.opportunitygets one when somebody leaves the reach of a standing enemy who can act, holds that budget and has a melee attack; it is resolved on the path, before the mover leaves the cell, and a strike that drops the mover ends the walk there.disengageprevents it. It is automatic for everybody in this slice; choosing is a reaction window, which is a later slice. Ember Roads declares none, and has none.distanceAND/startasks for it (positioned: true, which the client will send for the Tactical preference). The board comes from the path the Tactical style already uses. The view gains the grid, each combatant's cell and movement left, the walk option with every reachable cell, its cost, its path and whom it provokes, and for an area the cells it may be aimed at with who each aim would catch (capped). The command gainstoandat. The picker walks: it gets up first if it is on the ground, reads the cells it may walk to off its own menu, scores what it could do from the 48 of them nearest an opponent, takes a penalty for each strike the walk would provoke, stays put when it can already do its best, and otherwise closes the distance. The Game Master's boss window lists positioned candidates too, bounded, with positions and distances in the prompt and never the seed or future dice.docs/game/combat.md,docs/development/optional-agent-packages.md(1.28), the plan, the combat handoff's status header, the generated schema,CHANGELOG.md.game-ruleset-combat-grid(new, pure) and positioned cases inruleset-combat-directorandruleset-combat-director-route. The client gains only the log lines for the four new events, because its drift guard asks for a line per event.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Commands run locally by the agent:
pnpm check(exit 0), which includespnpm localization:check, lint with the client regression lane's typecheck, and the e2e typecheck; the full node regression lane (pnpm regression:node, 333 of 333 on three complete runs; on the last one, 332 of 333, the odd one out beingimage-dimension-limit.regression.ts, which prints that it passed and then sometimes does not exit on this machine (the pino-pretty worker lifetime that #6359 worked around for the storage shutdown regression; this PR does not touch it, it passed on its own straight afterwards, and CI's node lane has passed it on every ruleset PR)); and the new regression. Eleven complete local CodeRabbit sweeps were run before opening (4, 4, 1, 3, 1, 3, 2, 2, 1, 2 and 0 findings). What the sweeps changed, none of it cosmetic: the burst, cone and aim loops ran over the DECLARED size and range (a ruleset may declare ten thousand units, which would have let one catalog entry stall a server), and are now scanned over the board only, with a hard ceiling; the walk and stand-up options carry ids no action can hold (move:walk,move:stand), because a creature may really have an action called "move"; one walk draws one strike from anybody, matching the preview; a strike made in passing spends its own use and recharge, and a creature with nothing left to strike with threatens nobody (the case fails against the old code); an area that MENDS lands only on the side it was written for; the preview and the resolution ask one shared question about who a step provokes instead of two copies of it; a terrain word the Engine does not know costs an ordinary step instead of throwing; and the published JSON Schema asks fordistancebeside anything measured in cells. The last of them were about how opponents PLAY, and each came with a regression that fails against the old code: the picker worked out for itself where it could walk instead of reading its own menu, so a creature knocked down chose a walk the rules refuse and lost its turn to the refusal; it scored only the cells nearest ITSELF, so a fast creature far from its target never found the cell it could strike from; and it never stood up at all, so one knocked down out of reach would have lain there for the rest of the fight. It now reads its walk off the menu, looks at the cells nearest an opponent first, and gets up before anything else. Since opening, CodeRabbit's first review found three things, all fixed with regressions that fail against the old code: an ability whose range is 0 became a one cell SHOT, so a touch spell took the penalty for a foe standing beside the caster (it is now a reach, and the same hole on a creature is fixed too); the loader accepted a saved fight with two standing combatants on one cell or somebody inside a wall, which would have made every distance on that board wrong; and each 1.28 key in the install-gate case set a distance first, so onlydistancewas actually being proven. Chasing those turned up three more of my own: an opponent with nobody in reach spent its action on a dodge nobody was swinging at instead of sprinting closer; a thrown weapon was read as a shot in its owner's hand; and a creature could not say the shape its breath lands in at all, which flattened every printed cone and line to a number of targets. Declined, with the reason: requiringdistancewhenever a CREATURE action carriesreachorrange. Those have been legal, carried data since Capability API 1.27, and the shipped 5e package has them with nodistance, so requiring it would refuse an installed package; only what 1.28 adds needs a cell size.There is no new screen in this slice, so there is nothing to click: the client menu drops option kinds it does not know, which is why the walk never appears until the board PR. Not verified: the boss prompt on a positioned fight against a live provider (its candidates and positions are checked structurally); a very large board with a long-range area (the scans are bounded to the board and the picker to 48 cells, and the eight-fight director lane runs in about 2.5 seconds).
Still to verify by hand:
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/extending/writing-rulesets.md,docs/game/combat.md,docs/development/optional-agent-packages.md,docs/development/game-combat-rulesets-implementation.md, the plan, both example rulesets and the generated schema. The[docs-i18n]follow-up for the combat slices is batched into one issue for the whole arc, #6401, which this slice's pages are listed in.UI evidence (if applicable)
None: this slice has no new UI.
Summary by CodeRabbit
New Features
Documentation
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.