[PR #8608] [MERGED] Ruleset combat rolls through the shared seeded die roller (part 5 of #8489) #8699

Closed
opened 2026-11-07 17:39:02 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

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


📝 Commits (1)

  • e789ce2 Ruleset combat rolls through the shared seeded die roller

📊 Changes

5 files changed (+74 additions, -5 deletions)

View changed files

📝 packages/server/src/services/game/ruleset-combat-director.service.ts (+2 -1)
📝 packages/shared/src/features/ruleset-combat/dice.ts (+2 -3)
📝 packages/shared/src/features/ruleset-combat/types.ts (+2 -1)
📝 packages/shared/src/utils/dice-notation.ts (+16 -0)
➕ scripts/regressions/seeded-die-roller.regression.ts (+52 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #8489 (the last step of the plan in its comments: ruleset combat on the shared roller, after the SRD ruleset work landed).

Why this change

  • Ruleset combat still carried its own seeded die formula, so a fight, its item uses, loot and markets threw dice outside the shared dice service that every other roll now uses.

What changed

  • The shared dice module (packages/shared/src/utils/dice-notation.ts) gains seededDieRoller(seed, cursor), the replayable roller ruleset combat used (one deriveSubSeed tick per die, mulberry32), and dieRollerFrom(rng) for a caller that already holds a [0,1) stream.
  • RulesetCombatRoller is now the shared DieRoller type, and rulesetCombatRoller(seed, cursor) returns seededDieRoller(seed, cursor). Every caller (encounters, turns, the director, item use, loot, markets) is unchanged.
  • The director's opponent purses roll through dieRollerFrom instead of an inline formula.
  • Every face is the same as before, so saved fights and replays are unchanged. No schema change, parseRulesetCombatDice and the sides fields are untouched, and no Capability API version.
  • Player-facing rolls keep rollDieSecurely.

Validation

  • pnpm check passes locally (server and client tsc, Prettier on the changed files, and the regressions below)
  • 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

  • Not run in a browser. New seeded-die-roller regression: the shared roller and rulesetCombatRoller throw exactly the old formula's faces across many seeds, cursors and die sizes, one tick per die, and dieRollerFrom matches the hand formula. Also passing: all 477 ruleset-combat regressions, the 24 dice regressions, game-ruleset-item-use (3), game-ruleset-loot and market.

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)

UI evidence (if applicable)

  • No UI change.

🔄 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/8608 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `claude/project-thread-mhcusi` --- ### 📝 Commits (1) - [`e789ce2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e789ce2c395630b308b52884ccc8bb87d0830a8f) Ruleset combat rolls through the shared seeded die roller ### 📊 Changes **5 files changed** (+74 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/services/game/ruleset-combat-director.service.ts` (+2 -1) 📝 `packages/shared/src/features/ruleset-combat/dice.ts` (+2 -3) 📝 `packages/shared/src/features/ruleset-combat/types.ts` (+2 -1) 📝 `packages/shared/src/utils/dice-notation.ts` (+16 -0) ➕ `scripts/regressions/seeded-die-roller.regression.ts` (+52 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #8489 (the last step of the plan in its comments: ruleset combat on the shared roller, after the SRD ruleset work landed). ## Why this change - Ruleset combat still carried its own seeded die formula, so a fight, its item uses, loot and markets threw dice outside the shared dice service that every other roll now uses. ## What changed - The shared dice module (`packages/shared/src/utils/dice-notation.ts`) gains `seededDieRoller(seed, cursor)`, the replayable roller ruleset combat used (one `deriveSubSeed` tick per die, mulberry32), and `dieRollerFrom(rng)` for a caller that already holds a [0,1) stream. - `RulesetCombatRoller` is now the shared `DieRoller` type, and `rulesetCombatRoller(seed, cursor)` returns `seededDieRoller(seed, cursor)`. Every caller (encounters, turns, the director, item use, loot, markets) is unchanged. - The director's opponent purses roll through `dieRollerFrom` instead of an inline formula. - Every face is the same as before, so saved fights and replays are unchanged. No schema change, `parseRulesetCombatDice` and the `sides` fields are untouched, and no Capability API version. - Player-facing rolls keep `rollDieSecurely`. ## Validation - [x] `pnpm check` passes locally (server and client `tsc`, Prettier on the changed files, and the regressions below) - [ ] 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 - Not run in a browser. New `seeded-die-roller` regression: the shared roller and `rulesetCombatRoller` throw exactly the old formula's faces across many seeds, cursors and die sizes, one tick per die, and `dieRollerFrom` matches the hand formula. Also passing: all 477 `ruleset-combat` regressions, the 24 `dice` regressions, `game-ruleset-item-use` (3), `game-ruleset-loot` and `market`. ## Docs and release impact - [x] 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) ## UI evidence (if applicable) - No UI change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 17:39:02 +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#8699
No description provided.