Skip to content

feat: wire hit threshold and glitch rules into dice engine (#846)#897

Merged
Jasrags merged 1 commit into
mainfrom
feature/846-dice-rules-toggle
Apr 14, 2026
Merged

feat: wire hit threshold and glitch rules into dice engine (#846)#897
Jasrags merged 1 commit into
mainfrom
feature/846-dice-rules-toggle

Conversation

@Jasrags

@Jasrags Jasrags commented Apr 14, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #846.

  • Add resolveDiceRules(houseRules, base) in lib/rules/action-resolution/dice-engine.ts that merges hitThreshold, glitchThreshold, woundBoxesPerPenalty, and woundMaxPenalty overrides onto an EditionDiceRules base (other fields preserved).
  • Thread houseRules through ExecutionRequest/RerollRequest so the action executor resolves campaign-specific dice rules before rolling.
  • Wire campaign house rules into the three action API routes (characters/[id]/actions, its reroll endpoint, and combat/[sessionId]/actions) so the GM toggles already in the settings UI actually affect rolls. Campaign is looked up via character.campaignId / session.campaignId.

Test plan

  • pnpm type-check
  • pnpm test — 10536 passed
  • pnpm eslint on changed files — no new warnings
  • New unit tests for resolveDiceRules covering undefined/empty input, single + combined threshold overrides, wound modifier overrides (including sign normalization), base preservation, and integration with calculateHits / calculateGlitch.

Add resolveDiceRules() helper that applies HouseRules overrides
(hitThreshold, glitchThreshold, woundBoxesPerPenalty, woundMaxPenalty)
to EditionDiceRules. Wire campaign house rules through the action
executor and three action/reroll/combat API routes so GM toggles
actually affect rolls.
@Jasrags Jasrags self-assigned this Apr 14, 2026
@Jasrags Jasrags merged commit 9657a18 into main Apr 14, 2026
3 checks passed
@Jasrags Jasrags deleted the feature/846-dice-rules-toggle branch April 14, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: GM toggle — Hit threshold and glitch rules

1 participant