[PR #7563] [MERGED] feat(game): add ruleset combat, starting gear and ruleset package files #7801

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

📋 Pull Request Information

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

Base: staging ← Head: feat/worlds-and-ruleset-combat


📝 Commits (10+)

  • 6938d43 feat(rulesets): import a ruleset package zip, as data
  • 6da4e4c fix(rulesets): ruleset package zip review fixes
  • ca5c660 test(rulesets): a damaged checksum, and a check from an untrusted host
  • 040600d test(rulesets): trailing data, a decompression bomb and the shared parsers' own guard
  • 12935c2 fix(rulesets): count a ruleset's lists before copying them out
  • 9a62669 fix(rulesets): a ruleset's notes as long as shipped ones, each issue where it is
  • f4a5e5e fix(security): read archives from outside through one strict zip reader
  • 0bdfcc0 fix(security): a .charx whose card is not JSON fails its import, said
  • 20fef99 fix(security): zip reader review fixes
  • 3bd8f34 feat(rulesets): the ruleset schema, for editors to build forms from

📊 Changes

144 files changed (+14638 additions, -704 deletions)

View changed files

📝 docs/development/game-combat-ai-design.md (+5 -5)
📝 docs/development/game-combat-roadmap.md (+2 -2)
📝 docs/development/game-combat-rulesets-implementation.md (+2 -2)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+7 -6)
📝 docs/development/ruleset-5e-2014.example.json (+1 -1)
📝 docs/extending/ruleset.schema.json (+966 -100)
➕ docs/extending/writing-creature-packs.md (+121 -0)
📝 docs/extending/writing-rulesets.md (+201 -11)
📝 e2e/core-flows.e2e.ts (+1 -1)
➕ e2e/game-combat-height.e2e.ts (+149 -0)
➕ e2e/game-combat-initiative.e2e.ts (+261 -0)
➕ e2e/game-combat-sight.e2e.ts (+148 -0)
➕ e2e/game-creature-art.e2e.ts (+236 -0)
📝 e2e/game-hybrid-terrain.e2e.ts (+4 -1)
📝 e2e/game-ruleset-fight-fixture.ts (+1 -0)
📝 e2e/game-ruleset-markets.e2e.ts (+2 -0)
➕ e2e/game-ruleset-package-import.e2e.ts (+105 -0)
➕ e2e/game-ruleset-seller-honesty.e2e.ts (+201 -0)
➕ e2e/game-ruleset-starting-gear.e2e.ts (+167 -0)
📝 e2e/game-ruleset-wearing.e2e.ts (+68 -0)

...and 80 more files

📄 Description

Linked issue

Part of #7469

This follows #7568 (merged), the worlds half of what was PR 8, split out so each half stays under CodeRabbit's file limit. This branch is up to date with staging and holds only the work below. Staging's avatar agents took Capability API 1.73, so this PR's versions are 1.74 through 1.79. PRs for the sheet builder, the GM rules, maps and the rest follow it, one at a time.

Why this change

  • Tactical fights had no line of sight, no cover, no height and a single side-by-side turn order, so ruleset authors could not express 5e-style positioning, initiative or conditions like Haste and Slow.
  • A ruleset that changes its sheet layout broke the sheets players had already made on the old one.
  • Ruleset authors had no way to give characters starting gear, or to sell fakes and risky goods through dishonest merchants.
  • A ruleset with catalogs in their own files could only arrive through the official catalog. There was no safe way to share one by hand, and an editor had no published schema to build its forms from.
  • Creatures in fights had no art of their own.

What changed

  • Line of sight and cover: one line of sight for every fight, so items and reactions need sight of their target. Cover comes in degrees, read from the attacker's position, and can count creatures in the way and help saves (Capability API 1.74).
  • Height: boards may have height, and a ruleset's combat.elevation says what higher ground gives an attack or a shot and what a fall does (1.75).
  • Initiative: tactical battles can use individual initiative, and the board shows the turn order and lets only the current unit act.
  • Action economy: conditions can change it, as Haste and Slow do, with extra budgets, what they may be spent on, and attack caps (1.76).
  • Sheet migrations: a ruleset's sheet.migrations say how a sheet stored on an older layout reads on the new one, so a renamed or split value keeps its number. A rest may also share a pool group's restore across its pools (1.77).
  • Starting gear: a ruleset can offer gear a character takes into their bag at the start, with choices, through a Starting gear dialog in the inventory (1.78).
  • Seller honesty: catalog items can be risky or fakes that pass for another item, and a merchant can be dishonest. A fake shows as what it passes for until something reveals it on the sheet, in a fight or in a sale (1.79).
  • Ruleset package files: a ruleset with its catalog files can be shared and imported as one plain <name>.ruleset.json file. It holds the package manifest and the ruleset and catalog documents as base64 bytes, each listed by size and sha256. Nothing in it is compressed, and it carries no code. Import agents → Game Mode ruleset shows the same review as for a ruleset file, with each catalog's entry count, and keeps it as data under local/<id>. An editor can check a ruleset or a package file without saving it (POST /api/game-rulesets/check), open an installed ruleset's files (GET /api/game-rulesets/source), and read the ruleset JSON Schema the Engine publishes (GET /api/game-rulesets/schema, docs/extending/ruleset.schema.json).
  • Creature art: a creature pack can give fight creatures art by bestiary entry or name, with looks, facing and size, on both boards. A new guide, docs/extending/writing-creature-packs.md, covers the format.
  • Fixes: a refused buy or sale is told to the player, and the turn order is never covered by the map, party bar or menu. The new ruleset and creature pack routes have their own rate limit.

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
  • On this branch merged with staging f8d34df3f: pnpm check green, and the capability (19), game-ruleset (59), package (7), creature (4), import (13), world (28), rate-limit (2), avatar (10), professor-mari (18), open-issues and zip-reader regression lanes pass. In the combat lane 25 of 26 pass within the runner's 30-second cap; ruleset-combat-director takes about 31 seconds in this container and passes with a longer cap.
  • E2E specs for the new screens and fights: game-combat-sight, game-combat-height, game-combat-initiative, game-ruleset-starting-gear, game-ruleset-seller-honesty, game-ruleset-package-import, ruleset-sheet-migrations and game-creature-art. The ruleset and creature specs were rerun after the renumber.
  • After the review fixes, on the branch up to date with staging dad362f7a: pnpm check, the game-ruleset-packages, game-ruleset-starting-gear, world-save-state, creature, capability, avatar and professor-mari lanes, and the game-creature-art, game-combat-initiative, game-combat-sight, game-combat-height, game-terrain-restore, game-hybrid-terrain and game-world-journal e2e specs.

Manual verification notes

  • The ruleset package file import was run in the browser through the e2e spec: a package holding an extra file is refused with the reason, and a good one is reviewed with its catalog's entry count and imported.
  • Not checked by a person yet: the combat features on a real ruleset in a live game, and creature art with a real pack.

Changed test expectations

No maintainer asked for these; each follows a behaviour change this PR makes, and the check it replaces is kept or tightened:

  • generatorVersion 1 to 2 (e2e/game-terrain-restore.e2e.ts, hybrid-terrain and hybrid-terrain-route regressions): height changes what the battlefield generator makes, so boards saved by the old generator are rebuilt. The tests still check that the version is stored and that a restore keeps it.
  • Capability API 1.73 to 1.79, and the unsupported fixture 1.74 to 1.80 (capability-package-lifecycle): staging's avatar agents took 1.73, so this PR's versions are 1.74-1.79 and the supported version is 1.79. The same features are checked at their new numbers.
  • combat-director regression: bare test boards clear generated height so the distance checks still measure flat ground. The Counterspell-through-a-wall assertion is replaced because a wall now blocks sight: Fireball can no longer be cast through it, and the test checks that the cast is refused and nothing is spent.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) 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-creature-packs.md is new. docs/extending/writing-rulesets.md and several docs/development pages changed, and docs/extending/ruleset.schema.json is regenerated. The translations are tracked on #7512.

UI evidence (if applicable)

No screenshots attached. The e2e specs above drive these screens.

Summary by CodeRabbit

  • New Features
    • Tactical combat supports initiative-based or side-based turns, elevated terrain, climbing, line of sight, and graded cover.
    • Creature packs add artwork to combat boards.
    • Ruleset packages can include catalogs; rulesets can provide starting gear, migrate character sheets, and define expanded combat conditions.
    • Rulesets support counterfeit items and dishonest sellers.
  • Improvements
    • Inventory messages clarify refused purchases and sales, and reveal counterfeit items when discovered.
    • Character sheets display ruleset-defined levels and clearer pool-group names.
  • Documentation
    • Guides cover creature packs, ruleset packages, starting gear, combat, and sheet migrations.

🔄 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/7563 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/worlds-and-ruleset-combat` --- ### 📝 Commits (10+) - [`6938d43`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6938d43fc21fbff3e8f39312baad7091dab12f05) feat(rulesets): import a ruleset package zip, as data - [`6da4e4c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6da4e4c5effd76a4953568522460743e6b67b9c6) fix(rulesets): ruleset package zip review fixes - [`ca5c660`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ca5c660d7c727a394fc690da202e0837872cb2e4) test(rulesets): a damaged checksum, and a check from an untrusted host - [`040600d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/040600de55cc0acab5cbed81ef7dec8cae44d517) test(rulesets): trailing data, a decompression bomb and the shared parsers' own guard - [`12935c2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/12935c25d9e9bff3a813a10f237b7265adf8a0da) fix(rulesets): count a ruleset's lists before copying them out - [`9a62669`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9a6266929333342bb758dd424c297b2884752d68) fix(rulesets): a ruleset's notes as long as shipped ones, each issue where it is - [`f4a5e5e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f4a5e5e943291d2e9333af2f33fab901bbe5b267) fix(security): read archives from outside through one strict zip reader - [`0bdfcc0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0bdfcc0a7a7628a3de0fbb799c9ab7ad77c1d3fa) fix(security): a .charx whose card is not JSON fails its import, said - [`20fef99`](https://github.com/Pasta-Devs/Marinara-Engine/commit/20fef9947ff3f8b2c3e97c7767dd7b05e0adca2e) fix(security): zip reader review fixes - [`3bd8f34`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3bd8f34c87e023115beb323b5213ac419bacdd61) feat(rulesets): the ruleset schema, for editors to build forms from ### 📊 Changes **144 files changed** (+14638 additions, -704 deletions) <details> <summary>View changed files</summary> 📝 `docs/development/game-combat-ai-design.md` (+5 -5) 📝 `docs/development/game-combat-roadmap.md` (+2 -2) 📝 `docs/development/game-combat-rulesets-implementation.md` (+2 -2) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+7 -6) 📝 `docs/development/ruleset-5e-2014.example.json` (+1 -1) 📝 `docs/extending/ruleset.schema.json` (+966 -100) ➕ `docs/extending/writing-creature-packs.md` (+121 -0) 📝 `docs/extending/writing-rulesets.md` (+201 -11) 📝 `e2e/core-flows.e2e.ts` (+1 -1) ➕ `e2e/game-combat-height.e2e.ts` (+149 -0) ➕ `e2e/game-combat-initiative.e2e.ts` (+261 -0) ➕ `e2e/game-combat-sight.e2e.ts` (+148 -0) ➕ `e2e/game-creature-art.e2e.ts` (+236 -0) 📝 `e2e/game-hybrid-terrain.e2e.ts` (+4 -1) 📝 `e2e/game-ruleset-fight-fixture.ts` (+1 -0) 📝 `e2e/game-ruleset-markets.e2e.ts` (+2 -0) ➕ `e2e/game-ruleset-package-import.e2e.ts` (+105 -0) ➕ `e2e/game-ruleset-seller-honesty.e2e.ts` (+201 -0) ➕ `e2e/game-ruleset-starting-gear.e2e.ts` (+167 -0) 📝 `e2e/game-ruleset-wearing.e2e.ts` (+68 -0) _...and 80 more files_ </details> ### 📄 Description ## Linked issue Part of #7469 This follows #7568 (merged), the worlds half of what was PR 8, split out so each half stays under CodeRabbit's file limit. This branch is up to date with staging and holds only the work below. Staging's avatar agents took Capability API 1.73, so this PR's versions are 1.74 through 1.79. PRs for the sheet builder, the GM rules, maps and the rest follow it, one at a time. ## Why this change - Tactical fights had no line of sight, no cover, no height and a single side-by-side turn order, so ruleset authors could not express 5e-style positioning, initiative or conditions like Haste and Slow. - A ruleset that changes its sheet layout broke the sheets players had already made on the old one. - Ruleset authors had no way to give characters starting gear, or to sell fakes and risky goods through dishonest merchants. - A ruleset with catalogs in their own files could only arrive through the official catalog. There was no safe way to share one by hand, and an editor had no published schema to build its forms from. - Creatures in fights had no art of their own. ## What changed - **Line of sight and cover:** one line of sight for every fight, so items and reactions need sight of their target. Cover comes in degrees, read from the attacker's position, and can count creatures in the way and help saves (Capability API 1.74). - **Height:** boards may have height, and a ruleset's `combat.elevation` says what higher ground gives an attack or a shot and what a fall does (1.75). - **Initiative:** tactical battles can use individual initiative, and the board shows the turn order and lets only the current unit act. - **Action economy:** conditions can change it, as Haste and Slow do, with extra budgets, what they may be spent on, and attack caps (1.76). - **Sheet migrations:** a ruleset's `sheet.migrations` say how a sheet stored on an older layout reads on the new one, so a renamed or split value keeps its number. A rest may also share a pool group's restore across its pools (1.77). - **Starting gear:** a ruleset can offer gear a character takes into their bag at the start, with choices, through a Starting gear dialog in the inventory (1.78). - **Seller honesty:** catalog items can be `risky` or fakes that pass for another item, and a merchant can be dishonest. A fake shows as what it passes for until something reveals it on the sheet, in a fight or in a sale (1.79). - **Ruleset package files:** a ruleset with its catalog files can be shared and imported as one plain `<name>.ruleset.json` file. It holds the package manifest and the ruleset and catalog documents as base64 bytes, each listed by size and sha256. Nothing in it is compressed, and it carries no code. **Import agents** → **Game Mode ruleset** shows the same review as for a ruleset file, with each catalog's entry count, and keeps it as data under `local/<id>`. An editor can check a ruleset or a package file without saving it (`POST /api/game-rulesets/check`), open an installed ruleset's files (`GET /api/game-rulesets/source`), and read the ruleset JSON Schema the Engine publishes (`GET /api/game-rulesets/schema`, `docs/extending/ruleset.schema.json`). - **Creature art:** a creature pack can give fight creatures art by bestiary entry or name, with looks, facing and size, on both boards. A new guide, `docs/extending/writing-creature-packs.md`, covers the format. - **Fixes:** a refused buy or sale is told to the player, and the turn order is never covered by the map, party bar or menu. The new ruleset and creature pack routes have their own rate limit. ## Validation - [x] `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` - On this branch merged with staging f8d34df3f: `pnpm check` green, and the `capability` (19), `game-ruleset` (59), `package` (7), `creature` (4), `import` (13), `world` (28), `rate-limit` (2), `avatar` (10), `professor-mari` (18), `open-issues` and `zip-reader` regression lanes pass. In the `combat` lane 25 of 26 pass within the runner's 30-second cap; `ruleset-combat-director` takes about 31 seconds in this container and passes with a longer cap. - E2E specs for the new screens and fights: `game-combat-sight`, `game-combat-height`, `game-combat-initiative`, `game-ruleset-starting-gear`, `game-ruleset-seller-honesty`, `game-ruleset-package-import`, `ruleset-sheet-migrations` and `game-creature-art`. The ruleset and creature specs were rerun after the renumber. - After the review fixes, on the branch up to date with staging dad362f7a: `pnpm check`, the `game-ruleset-packages`, `game-ruleset-starting-gear`, `world-save-state`, `creature`, `capability`, `avatar` and `professor-mari` lanes, and the `game-creature-art`, `game-combat-initiative`, `game-combat-sight`, `game-combat-height`, `game-terrain-restore`, `game-hybrid-terrain` and `game-world-journal` e2e specs. ### Manual verification notes - The ruleset package file import was run in the browser through the e2e spec: a package holding an extra file is refused with the reason, and a good one is reviewed with its catalog's entry count and imported. - Not checked by a person yet: the combat features on a real ruleset in a live game, and creature art with a real pack. ### Changed test expectations No maintainer asked for these; each follows a behaviour change this PR makes, and the check it replaces is kept or tightened: - `generatorVersion` 1 to 2 (`e2e/game-terrain-restore.e2e.ts`, `hybrid-terrain` and `hybrid-terrain-route` regressions): height changes what the battlefield generator makes, so boards saved by the old generator are rebuilt. The tests still check that the version is stored and that a restore keeps it. - Capability API 1.73 to 1.79, and the unsupported fixture 1.74 to 1.80 (`capability-package-lifecycle`): staging's avatar agents took 1.73, so this PR's versions are 1.74-1.79 and the supported version is 1.79. The same features are checked at their new numbers. - `combat-director` regression: bare test boards clear generated height so the distance checks still measure flat ground. The Counterspell-through-a-wall assertion is replaced because a wall now blocks sight: Fireball can no longer be cast through it, and the test checks that the cast is refused and nothing is spent. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README) as needed - [x] 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-creature-packs.md` is new. `docs/extending/writing-rulesets.md` and several `docs/development` pages changed, and `docs/extending/ruleset.schema.json` is regenerated. The translations are tracked on #7512. ## UI evidence (if applicable) No screenshots attached. The e2e specs above drive these screens. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Tactical combat supports initiative-based or side-based turns, elevated terrain, climbing, line of sight, and graded cover. * Creature packs add artwork to combat boards. * Ruleset packages can include catalogs; rulesets can provide starting gear, migrate character sheets, and define expanded combat conditions. * Rulesets support counterfeit items and dishonest sellers. * **Improvements** * Inventory messages clarify refused purchases and sales, and reveal counterfeit items when discovered. * Character sheets display ruleset-defined levels and clearer pool-group names. * **Documentation** * Guides cover creature packs, ruleset packages, starting gear, combat, and sheet migrations. <!-- 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-24 04:07:38 +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#7801
No description provided.