mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6406] [MERGED] feat(game): a ruleset fight is played on the battlefield, drawn from the server's own view (real combat C4b) #7167
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#7167
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/6406
Author: @kolacheee
Created: 9/20/2026
Status: ✅ Merged
Merged: 9/20/2026
Merged by: @kolacheee
Base:
staging← Head:feat/ruleset-combat-board📝 Commits (10+)
5353035refactor(game): the battlefield's look moves into one module both boards read37fa6e1feat(game): a ruleset fight on a board, drawn from the server's own viewc677371fix(game): the board fits its box whole, the tokens keep their own squares, and Escape hands the keyboard back6df17a4test(game): the board's squares, its distances and its four refusals are pinned on both examples68bea4etest(game): the browser lane walks, reads the log in paces and swings on a positioned board1ce5fd7docs(game): the guides, the authoring notes, the plan and the handoff say the board is on screenc3543affix(game): the board keeps its squares square on a wide screen, and opening a walk or an aim takes the keyboard onto the board2ebf3b5fix(game): the board says health and strikes in plainer words, reads a square to a screen reader once, and the menu's turn reset no longer depends on who hands it a function62c07b2fix(game): a shape with nowhere to land opens its aiming step and says so instead of sending a choice the server refuses, and the screen regression reads real health4e5f6e8fix(game): the menu hands its half-made choice to an owner only when the owner passes both halves📊 Changes
22 files changed (+2070 additions, -305 deletions)
View changed files
📝
CHANGELOG.md(+2 -1)📝
docs/development/game-combat-rulesets-implementation.md(+5 -2)📝
docs/development/game-rulesets-and-sheets-implementation.md(+36 -5)📝
docs/extending/writing-rulesets.md(+14 -4)📝
docs/game/combat.md(+3 -1)📝
docs/game/getting-started.md(+1 -1)📝
e2e/game-combat-director.e2e.ts(+286 -0)📝
packages/client/src/components/chat/ChatSettingsDrawer.tsx(+6 -0)📝
packages/client/src/components/game/DirectedCombatUI.tsx(+44 -2)📝
packages/client/src/components/game/GameSurface.tsx(+5 -0)➕
packages/client/src/components/game/RulesetCombatBoard.tsx(+471 -0)📝
packages/client/src/components/game/RulesetCombatMenu.tsx(+91 -19)📝
packages/client/src/components/game/RulesetCombatStatus.tsx(+11 -1)📝
packages/client/src/components/game/TacticalCombatUI.tsx(+14 -229)📝
packages/client/src/features/chat-settings/sections/CombatStyleSection.tsx(+9 -3)📝
packages/client/src/hooks/use-directed-combat.ts(+3 -0)➕
packages/client/src/lib/ruleset-combat-board.ts(+211 -0)📝
packages/client/src/lib/ruleset-combat-log.ts(+18 -4)📝
packages/client/src/lib/ruleset-combat-menu.ts(+41 -3)➕
packages/client/src/lib/tactical-board-look.ts(+241 -0)...and 2 more files
📄 Description
Linked issue
Part of #6361 (real ruleset combat, slice C4b: the board on screen; it does not close the issue) and of #6314. Builds on #6397 (positions, the shared and server half), merged.
Why this change
What changed
positioned: trueto/startexactly when the fight is a ruleset fight, the game's combat preference is Tactical, and the ruleset declarescombat.distance, with the same environment, formation and battlefield brief the Tactical style already sends. The screen then decides from the VIEW (ruleset.gridpresent means the board), never from the preference. Classic preference, or a ruleset withoutdistance, stays theatre of the mind on the existing screen, unchanged.RulesetCombatBoard(new, presentational), mounted by the ruleset branch ofDirectedCombatUIin place of the portrait stage. One focusable button per cell with terrain drawn as the Tactical board draws it; tokens with portrait or initials, side colour, a health bar from the view's own health, the actor on turn marked, the defeated shown faded. Choosing Move lights every reachable cell with its cost, draws the path on hover or focus, marks in amber a cell whose path provokes and names who; click or Enter sends{ to }. An option that takes targets highlights exactly the server'stargetIdsand a token's square can be clicked as well as the list entry (the list stays: it is the keyboard and screen reader path). An area option enters aiming: the cells in the server'saim[]light up, each names who it would catch (friends included, before it is confirmed), and the command carriesat. When living opponents exist but no attack is offered, a line says "Nobody is in reach. Move closer."lib/tactical-board-look.ts, a pure move with no behaviour change.TacticalCombatUIlost 229 lines and gained 14 (the import and one<style>); nothing else in it was touched.RulesetCombatMenulearns themovekind (walking and standing up, told apart by the sharedRULESET_MOVE_OPTIONandRULESET_STAND_OPTIONconstants, never by a literal) and an optional controlled step so the half-made choice can live on the board; passed nothing, it behaves exactly as before.RulesetCombatStatusshows the movement left beside the budgets. The log says walks in the ruleset's unit. The four new refusals get sentences.aria-livestays polite. Every cell has an accessible name: coordinates, terrain, who stands there, and what can be done with it.docs/game/combat.md,docs/game/getting-started.md,docs/extending/writing-rulesets.md(the Positions section says the board exists), the plan, the combat handoff's status header,CHANGELOG.md(and the earlier unreleased entry loses its "the board is next" sentence).lib/and are pinned inruleset-combat-screen-clienton both examples;e2e/game-combat-director.e2e.tsgains a positioned Ember Roads mode (the board is there, Move, click a reachable cell, the token'sdata-cellchanged, the log printed the walk in paces, then an attack when adjacent).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). Six complete local CodeRabbit sweeps were run before opening (8, 2, 1, 2, 0 and 0 findings). What they changed: a shape with nowhere to land was sent to the server, which refuses a shape with no square, instead of opening its aiming step and saying it would catch nobody; three board sentences said health and strikes in plainer words; a square's sentences are worked out once per view rather than once per draw, and a square being read is no longer said twice to a screen reader; the menu's turn reset no longer depends on who hands it a function, and it only gives its half-made choice to an owner that passes both halves of the pair; and the screen regression's fixture reads the fight's real health instead of zeroes, with the Ember Roads walk assertions made unconditional.Driven for real by the agent on a scratch Engine (own port, fresh data directory, stopped afterwards), in the app's browser pane with mouse and keyboard, on both example rulesets: a fight seeded with the Tactical preference shows the board; Move lights the reachable squares with their cost ("2 paces", "15 ft"), the token moves and the log says the walk in the ruleset's unit; a burst is aimed at a square and names who it catches, a friend included, before it is confirmed; an adjacent opponent is attacked by clicking its square; before anyone is adjacent the strip says nobody is in reach; Escape returns the keyboard to the menu. Measured at 1366x850 with a 17 line log: board 578x385, 96 cells, squares square, no horizontal page scroll, no overlapping tokens. At an emulated 375x812: the whole board visible (cells 28x28), no horizontal page scroll. The same game seeded with the Classic preference shows the existing portrait screen with no Movement group, and a plain Tactical fight with no ruleset shows the Tactical style's own screen, unchanged after the visual constants moved. That pass found and fixed two things: on a wide screen the squares were stretched (110x46) because a percentage width with a maximum height does not keep an aspect ratio, and opening Move or an aim with the mouse left the keyboard on the page instead of on the board.
Not verified, plainly: Playwright does not run on this machine, so the new positioned e2e mode is typechecked only and CI is what runs it; a cone or a line on screen (both examples' only shaped ability is a burst; the lookup is shape-blind and pinned); picking several targets by clicking several tokens (the board and the menu share one pinned rule for it); a Game Master controlled boss on a board (the board shows "waiting" while a window is open, and that path's client code is unchanged); real portraits on tokens (the seeded fights had none; the helper is the Tactical board's own, moved unchanged); a real finger on a touch screen; a ruleset that resolves its own fights but declares no distance, on screen (both examples declare one; both setting lines are pinned). One narrowing to know about: the board offers only the aims the server lists, and the server lists only aims that catch somebody, so a player cannot aim a shape at empty ground even though the rules would accept it.
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/game/combat.md,docs/game/getting-started.md,docs/extending/writing-rulesets.md,docs/development/game-combat-rulesets-implementation.mdand the plan. 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. New English strings: 27 keys undergame.combat.ruleset.*; no community locale was touched, and the six terrain words are reused from the Tactical board's own keys so the two boards cannot disagree.UI evidence (if applicable)
Driven on a scratch Engine and looked at in a browser, on both example rulesets and on the REAL 5e data (the package's own
combatblock, weapons and stat blocks, with Fireball, Burning Hands and the Goblin, Ogre and Adult Red Dragon inlined to fit the import limit).On the 5e fight the header reads "Brenna is up" and "Movement 30 ft", and the panel below reads the ruleset's own numbers: Brenna 60/60 Armor Class 18, Goblin 4/4 Armor Class 15, Ogre 68/68 Armor Class 11, Adult Red Dragon 269/269 Armor Class 19, with the death save tracks and the initiative order beside them. Before anybody is adjacent the strip under the board reads "Nobody is in reach. Move closer."
Choosing Move lights every square she can reach with its cost in the ruleset's own distance, in feet: 5 ft, 10 ft, 15 ft, 20 ft, 25 ft, 30 ft, with the wooded squares costing more than the open ones and nothing beyond her 30 feet offered. The strip reads "Plains. Brenna stands here, health 60 of 60. On turn." for the square under the keyboard, and the prompt reads "Choose where Brenna walks to, then press Enter. Escape goes back."
A screenshot cannot be attached from this environment; the measurements and the exact strings are above and in the manual verification notes.
Summary by CodeRabbit
New Features
Compatibility
Documentation
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.