[PR #8220] [MERGED] feat(rulesets): fights for symbol-pool rulesets (combat.kind symbol-pool, Capability API 1.382) #8192

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

📋 Pull Request Information

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

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


📝 Commits (10+)

  • de1e495 feat(rulesets): fights for symbol-pool rulesets (combat.kind symbol-pool, 1.382)
  • 7aacdf3 test(rulesets): moving-initiative pool message covers symbol-pool fights
  • 135d690 Merge remote-tracking branch 'origin/staging' into claude/project-thread-o9hpq2
  • 8b571ed fix(rulesets): price and deliver symbol spends as the fight does
  • da2b1ab Merge remote-tracking branch 'origin/staging' into claude/project-thread-o9hpq2
  • 740a105 fix(rulesets): never charge symbols for a condition that would not land
  • 7f2b5a1 fix(rulesets): a symbol spend is bought only as often as it lands
  • a1873b8 Merge remote-tracking branch 'origin/staging' into claude/project-thread-o9hpq2
  • b0a7926 fix(rulesets): one spend budget per throw for the fight and its forecast
  • d65b993 fix(rulesets): settle two spends contending for one holder by worth

📊 Changes

22 files changed (+2748 additions, -62 deletions)

View changed files

📝 docs/extending/ruleset.schema.json (+598 -1)
📝 docs/extending/writing-rulesets.md (+90 -8)
📝 packages/client/src/lib/ruleset-combat-log.ts (+87 -1)
📝 packages/client/src/localization/locales/en.json (+17 -0)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+23 -0)
📝 packages/server/src/services/game/ruleset-combat-director.service.ts (+12 -3)
📝 packages/shared/src/features/ruleset-combat/creatures.ts (+5 -0)
📝 packages/shared/src/features/ruleset-combat/encounter.ts (+136 -2)
📝 packages/shared/src/features/ruleset-combat/index.ts (+3 -0)
📝 packages/shared/src/features/ruleset-combat/options.ts (+69 -9)
📝 packages/shared/src/features/ruleset-combat/pool.ts (+6 -0)
📝 packages/shared/src/features/ruleset-combat/resolve.ts (+288 -10)
➕ packages/shared/src/features/ruleset-combat/symbols.ts (+430 -0)
📝 packages/shared/src/features/ruleset-combat/types.ts (+37 -1)
📝 packages/shared/src/schemas/capability-package.schema.ts (+7 -1)
📝 packages/shared/src/schemas/ruleset.schema.ts (+221 -18)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+6 -5)
📝 scripts/regressions/game-ruleset-combat-moving-initiative.regression.ts (+1 -1)
📝 scripts/regressions/game-ruleset-combat-pool.regression.ts (+1 -1)
➕ scripts/regressions/game-ruleset-combat-symbol-pool.regression.ts (+689 -0)

...and 2 more files

📄 Description

Linked issue

Closes #8219

Why this change

A ruleset whose checks throw symbol dice could not have an Engine fight: the validator refused its combat block, so every attack in such a game cost an LLM call. Letting the Engine take over those fights keeps Game Mode cheaper and gives ruleset creators the same option dice-pool and d20 rulesets already have.

What changed

  • New opt-in combat.kind: "symbol-pool" (Capability API 1.382). It needs a symbol-pool resolution and a new combat.symbols block; it refuses attackRoll and pool.
  • Attacks throw the attacker's toHit dice (with upgrades of them upgraded) against defense difficulty dice. Condition bonuses and the wound penalty become boost or setback dice; advantage adds a boost die, disadvantage a setback die. A hit needs the ruleset's needed net successes.
  • Damage is the rolled damage plus symbols.damage.perSuccess for each success (counts: "all" or "beyond" the needed ones), plus whatever spends buy, minus flat soak from symbols.soak (all and byKind).
  • symbols.spends declares what leftover symbols buy: extra damage, a critical, a condition, a track move, or boost/setback dice on a combatant's next throw. Each spend names its symbol, cost, side (by attacker or target), when it applies (hit, miss, any), how many times it can be bought (max), and who it lands on (attacker, target, or an ally of either). The Engine picks the best set of spends for each side with a small knapsack and logs each one as a symbol-spend event.
  • Saves, gate checks, contests and initiative throw the symbol dice too. A creature action can carry upgrades; a sheet pool larger than its upgraded part is split into dice plus upgrades.
  • Forecasts are exact over the symbol outcome distribution, and the combat AI scores an attack by forecast.worth, which counts what the spends buy, so it prefers attacks whose leftover symbols are worth more.
  • Combat log lines, a schema regeneration, and a new docs section in docs/extending/writing-rulesets.md.

Defaults chosen (easy to change in review):

  • The Engine picks spends for players as well as for the AI. There is no spend picker in the UI yet.
  • Spends apply to attack rolls only, not to saves, checks or contests.
  • Spend costs are per ruleset, not per weapon.
  • Upgrading difficulty dice during a fight is not built.
  • A held hit answer (reaction) can't re-throw a symbol roll.

Validation

  • pnpm check parts run locally: shared, server and client typecheck; client eslint; format:check; localization:check
  • 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 scripts/regressions/game-ruleset-combat-symbol-pool.regression.ts covers the validator refusals, the pool split, soak, initiative, the exact forecast, contests, the spend picker, a full fight and its log lines, and the 1.382 gate.
  • Ruleset lane and combat lane (187/187) pass locally. Updated expectations in the capability lifecycle, symbol-pool, combat-pool, moving-initiative and combat-screen-client regressions.
  • Not clicked through in a browser: the only UI change is new combat log lines.

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): tracked on #7512
  • Version/release files updated (only if this PR includes a version bump)

🔄 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/8220 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 10/23/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `claude/project-thread-o9hpq2` --- ### 📝 Commits (10+) - [`de1e495`](https://github.com/Pasta-Devs/Marinara-Engine/commit/de1e495aac51ece4e7b38743fd6fdc01c43492e3) feat(rulesets): fights for symbol-pool rulesets (combat.kind symbol-pool, 1.382) - [`7aacdf3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7aacdf33304e17c00338879c4d4ec4077872d781) test(rulesets): moving-initiative pool message covers symbol-pool fights - [`135d690`](https://github.com/Pasta-Devs/Marinara-Engine/commit/135d69033f9d2745f34e1f1176160106067d8102) Merge remote-tracking branch 'origin/staging' into claude/project-thread-o9hpq2 - [`8b571ed`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8b571ed6e2766709ecfa5ce1d6293edfcc8c85ec) fix(rulesets): price and deliver symbol spends as the fight does - [`da2b1ab`](https://github.com/Pasta-Devs/Marinara-Engine/commit/da2b1abe1c9f9c938559df1f0bf3c165a918cec1) Merge remote-tracking branch 'origin/staging' into claude/project-thread-o9hpq2 - [`740a105`](https://github.com/Pasta-Devs/Marinara-Engine/commit/740a1055879dfd925fb38ff67b7d4419e7d76954) fix(rulesets): never charge symbols for a condition that would not land - [`7f2b5a1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7f2b5a17e8e976c8d0c61abb304547f1f59b4a44) fix(rulesets): a symbol spend is bought only as often as it lands - [`a1873b8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a1873b833c795bd6426422c168b07eda84a0d34f) Merge remote-tracking branch 'origin/staging' into claude/project-thread-o9hpq2 - [`b0a7926`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b0a7926d9911d20c4355db799342a2f8ae59865f) fix(rulesets): one spend budget per throw for the fight and its forecast - [`d65b993`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d65b993bc9464e7d80984ca1e8a2080bf8dfb542) fix(rulesets): settle two spends contending for one holder by worth ### 📊 Changes **22 files changed** (+2748 additions, -62 deletions) <details> <summary>View changed files</summary> 📝 `docs/extending/ruleset.schema.json` (+598 -1) 📝 `docs/extending/writing-rulesets.md` (+90 -8) 📝 `packages/client/src/lib/ruleset-combat-log.ts` (+87 -1) 📝 `packages/client/src/localization/locales/en.json` (+17 -0) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+23 -0) 📝 `packages/server/src/services/game/ruleset-combat-director.service.ts` (+12 -3) 📝 `packages/shared/src/features/ruleset-combat/creatures.ts` (+5 -0) 📝 `packages/shared/src/features/ruleset-combat/encounter.ts` (+136 -2) 📝 `packages/shared/src/features/ruleset-combat/index.ts` (+3 -0) 📝 `packages/shared/src/features/ruleset-combat/options.ts` (+69 -9) 📝 `packages/shared/src/features/ruleset-combat/pool.ts` (+6 -0) 📝 `packages/shared/src/features/ruleset-combat/resolve.ts` (+288 -10) ➕ `packages/shared/src/features/ruleset-combat/symbols.ts` (+430 -0) 📝 `packages/shared/src/features/ruleset-combat/types.ts` (+37 -1) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+7 -1) 📝 `packages/shared/src/schemas/ruleset.schema.ts` (+221 -18) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+6 -5) 📝 `scripts/regressions/game-ruleset-combat-moving-initiative.regression.ts` (+1 -1) 📝 `scripts/regressions/game-ruleset-combat-pool.regression.ts` (+1 -1) ➕ `scripts/regressions/game-ruleset-combat-symbol-pool.regression.ts` (+689 -0) _...and 2 more files_ </details> ### 📄 Description ## Linked issue Closes #8219 ## Why this change A ruleset whose checks throw symbol dice could not have an Engine fight: the validator refused its combat block, so every attack in such a game cost an LLM call. Letting the Engine take over those fights keeps Game Mode cheaper and gives ruleset creators the same option dice-pool and d20 rulesets already have. ## What changed - New opt-in `combat.kind: "symbol-pool"` (Capability API 1.382). It needs a `symbol-pool` resolution and a new `combat.symbols` block; it refuses `attackRoll` and `pool`. - Attacks throw the attacker's `toHit` dice (with `upgrades` of them upgraded) against `defense` difficulty dice. Condition bonuses and the wound penalty become boost or setback dice; advantage adds a boost die, disadvantage a setback die. A hit needs the ruleset's needed net successes. - Damage is the rolled damage plus `symbols.damage.perSuccess` for each success (`counts: "all"` or `"beyond"` the needed ones), plus whatever spends buy, minus flat soak from `symbols.soak` (`all` and `byKind`). - `symbols.spends` declares what leftover symbols buy: extra damage, a critical, a condition, a track move, or boost/setback dice on a combatant's next throw. Each spend names its symbol, cost, side (`by` attacker or target), when it applies (`hit`, `miss`, `any`), how many times it can be bought (`max`), and who it lands on (attacker, target, or an ally of either). The Engine picks the best set of spends for each side with a small knapsack and logs each one as a `symbol-spend` event. - Saves, gate checks, contests and initiative throw the symbol dice too. A creature action can carry `upgrades`; a sheet pool larger than its upgraded part is split into dice plus upgrades. - Forecasts are exact over the symbol outcome distribution, and the combat AI scores an attack by `forecast.worth`, which counts what the spends buy, so it prefers attacks whose leftover symbols are worth more. - Combat log lines, a schema regeneration, and a new docs section in `docs/extending/writing-rulesets.md`. Defaults chosen (easy to change in review): - The Engine picks spends for players as well as for the AI. There is no spend picker in the UI yet. - Spends apply to attack rolls only, not to saves, checks or contests. - Spend costs are per ruleset, not per weapon. - Upgrading difficulty dice during a fight is not built. - A held hit answer (reaction) can't re-throw a symbol roll. ## Validation - [x] `pnpm check` parts run locally: shared, server and client typecheck; client eslint; `format:check`; `localization:check` - [ ] 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 `scripts/regressions/game-ruleset-combat-symbol-pool.regression.ts` covers the validator refusals, the pool split, soak, initiative, the exact forecast, contests, the spend picker, a full fight and its log lines, and the 1.382 gate. - Ruleset lane and combat lane (187/187) pass locally. Updated expectations in the capability lifecycle, symbol-pool, combat-pool, moving-initiative and combat-screen-client regressions. - Not clicked through in a browser: the only UI change is new combat log lines. ## 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): tracked on #7512 - [ ] Version/release files updated (only if this PR includes a version bump) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-25 04:04:35 +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#8192
No description provided.