Skip to content

Commit 2dfb1fb

Browse files
jziggasterragon-labs[bot]claude
authored
Refactor dice face handling with centralized face type definitions, tests, and added light/dark side support (#15)
* refactor(dice): use centralized dice face mappings for result calculations - Introduced diceFaces.ts to centralize die face symbol mappings. - Updated dice.ts to replace switch-case with lookups from diceFaces constants. - Added new types for die face values in types.ts. - Exported dice face constants and types from index.ts. - Updated tests to reflect new dice face mappings and fixed inconsistencies. This refactor improves maintainability and consistency by consolidating die face data. Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com> * feat!: add automatic light/dark side points to dice pools - Added automaticLightSide and automaticDarkSide to DicePool type - Updated sumResults function to handle automatic force points - Updated CLI to parse +ls/lightside and +ds/darkside modifiers - Added comprehensive tests for automatic force points BREAKING CHANGE: Dice face mappings have been corrected to match official SWRPG specifications. Boost die faces 3-6 and Force die face distributions have been fixed. This changes the probability distributions for these dice. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: correct boost die face mappings to match official specification - Face 3: Changed from (A)(A) to (S) - Face 4: Changed from (A) to (S)(A) - Face 5: Remains (S)(A) - already correct - Face 6: Changed from (S) to (A) Updated all corresponding tests to match corrected face mappings. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent bf7609d commit 2dfb1fb

File tree

10 files changed

+490
-484
lines changed

10 files changed

+490
-484
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ export function parseDiceNotation(input: string): DicePool {
5656
"triumph",
5757
"d",
5858
"despair",
59+
"ls",
60+
"lightside",
61+
"ds",
62+
"darkside",
5963
"ua",
6064
"upgradeability",
6165
"ud",
@@ -96,6 +100,14 @@ export function parseDiceNotation(input: string): DicePool {
96100
case "despair":
97101
pool.automaticDespairs = (pool.automaticDespairs || 0) + value;
98102
break;
103+
case "ls":
104+
case "lightside":
105+
pool.automaticLightSide = (pool.automaticLightSide || 0) + value;
106+
break;
107+
case "ds":
108+
case "darkside":
109+
pool.automaticDarkSide = (pool.automaticDarkSide || 0) + value;
110+
break;
99111
// Upgrades and downgrades
100112
case "ua":
101113
case "upgradeability":

0 commit comments

Comments
 (0)