@swrpg-online/dice 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -22,6 +22,103 @@ function parseDiceNotation(input) {
22
22
  .split(" ")
23
23
  .filter((p) => p.length > 0);
24
24
  for (const part of parts) {
25
+ // Check for modifiers (start with + or -)
26
+ // Only treat as modifier if it has a known modifier suffix
27
+ if (part.startsWith("+") || (part.startsWith("-") && part.length > 2)) {
28
+ const isPositive = part.startsWith("+");
29
+ const modPart = part.slice(1);
30
+ const count = parseInt(modPart);
31
+ if (isNaN(count)) {
32
+ // If it starts with + but has no number, skip as invalid modifier
33
+ if (part.startsWith("+")) {
34
+ warnings.push(`Invalid modifier notation: "${part}" - number not found`);
35
+ continue;
36
+ }
37
+ // Otherwise treat as regular dice notation (for negative numbers)
38
+ }
39
+ else {
40
+ const modifier = modPart.slice(String(count).length).toLowerCase();
41
+ // Check if this is actually a modifier (has a known suffix)
42
+ const knownModifiers = [
43
+ "s",
44
+ "success",
45
+ "f",
46
+ "failure",
47
+ "a",
48
+ "advantage",
49
+ "t",
50
+ "threat",
51
+ "tr",
52
+ "triumph",
53
+ "d",
54
+ "despair",
55
+ "ua",
56
+ "upgradeability",
57
+ "ud",
58
+ "upgradedifficulty",
59
+ "dp",
60
+ "downgradeproficiency",
61
+ "dc",
62
+ "downgradechallenge",
63
+ ];
64
+ if (knownModifiers.includes(modifier)) {
65
+ const value = isPositive ? count : -count;
66
+ switch (modifier) {
67
+ // Automatic symbols
68
+ case "s":
69
+ case "success":
70
+ pool.automaticSuccesses = (pool.automaticSuccesses || 0) + value;
71
+ break;
72
+ case "f":
73
+ case "failure":
74
+ pool.automaticFailures = (pool.automaticFailures || 0) + value;
75
+ break;
76
+ case "a":
77
+ case "advantage":
78
+ pool.automaticAdvantages =
79
+ (pool.automaticAdvantages || 0) + value;
80
+ break;
81
+ case "t":
82
+ case "threat":
83
+ pool.automaticThreats = (pool.automaticThreats || 0) + value;
84
+ break;
85
+ case "tr":
86
+ case "triumph":
87
+ pool.automaticTriumphs = (pool.automaticTriumphs || 0) + value;
88
+ break;
89
+ case "d":
90
+ case "despair":
91
+ pool.automaticDespairs = (pool.automaticDespairs || 0) + value;
92
+ break;
93
+ // Upgrades and downgrades
94
+ case "ua":
95
+ case "upgradeability":
96
+ pool.upgradeAbility = (pool.upgradeAbility || 0) + value;
97
+ break;
98
+ case "ud":
99
+ case "upgradedifficulty":
100
+ pool.upgradeDifficulty = (pool.upgradeDifficulty || 0) + value;
101
+ break;
102
+ case "dp":
103
+ case "downgradeproficiency":
104
+ pool.downgradeProficiency =
105
+ (pool.downgradeProficiency || 0) + value;
106
+ break;
107
+ case "dc":
108
+ case "downgradechallenge":
109
+ pool.downgradeChallenge = (pool.downgradeChallenge || 0) + value;
110
+ break;
111
+ }
112
+ continue;
113
+ }
114
+ else if (part.startsWith("+")) {
115
+ // If it starts with + but has unknown suffix, warn and skip
116
+ warnings.push(`Invalid modifier type: "${modifier}" in "${part}"`);
117
+ continue;
118
+ }
119
+ // If it starts with - and has no known modifier suffix, treat as negative dice count
120
+ }
121
+ }
25
122
  const count = parseInt(part);
26
123
  // Check if parseInt returned NaN
27
124
  if (isNaN(count)) {
@@ -137,7 +234,8 @@ const main = () => {
137
234
  : args.join(" ");
138
235
  if (!diceNotation.trim()) {
139
236
  console.log(`Usage: swrpg-dice <dice-notation> <dice-options>
140
- Example: swrpg-dice 2y 1g 1p 1b 1sb --hints
237
+ Example: swrpg-dice 2y 1g 1p 1b 1sb +2s +1a --hints
238
+
141
239
  Dice Options:
142
240
  - y/pro = Yellow / Proficiency
143
241
  - g/a = Green / Ability
@@ -146,6 +244,22 @@ const main = () => {
146
244
  - p/diff = Purple / Difficulty
147
245
  - blk/k/sb/s = Black / Setback
148
246
  - w/f = White/Force
247
+
248
+ Modifiers (use + or - prefix):
249
+ Automatic Symbols:
250
+ - +Ns/success = Add N successes
251
+ - +Nf/failure = Add N failures
252
+ - +Na/advantage = Add N advantages
253
+ - +Nt/threat = Add N threats
254
+ - +Ntr/triumph = Add N triumphs
255
+ - +Nd/despair = Add N despairs
256
+
257
+ Dice Upgrades/Downgrades:
258
+ - +Nua = Upgrade N ability dice to proficiency
259
+ - +Nud = Upgrade N difficulty dice to challenge
260
+ - +Ndp = Downgrade N proficiency dice to ability
261
+ - +Ndc = Downgrade N challenge dice to difficulty
262
+
149
263
  Options:
150
264
  --hints Show possible actions based on roll results`);
151
265
  process.exit(1);
package/dist/dice.js CHANGED
@@ -487,7 +487,68 @@ const forceDieResult = (roll) => {
487
487
  };
488
488
  }
489
489
  };
490
- const sumResults = (results, options) => {
490
+ /**
491
+ * Applies dice upgrades and downgrades to a pool.
492
+ * Upgrades are applied first, then downgrades.
493
+ *
494
+ * @param pool - The dice pool to modify
495
+ * @returns A new dice pool with upgrades/downgrades applied
496
+ */
497
+ const applyDiceModifications = (pool) => {
498
+ const modifiedPool = { ...pool };
499
+ // Apply upgrades first (per game rules)
500
+ if (pool.upgradeAbility && pool.upgradeAbility > 0) {
501
+ let upgradesToApply = pool.upgradeAbility;
502
+ const currentAbility = modifiedPool.abilityDice || 0;
503
+ // Upgrade existing ability dice to proficiency
504
+ const upgradedDice = Math.min(currentAbility, upgradesToApply);
505
+ modifiedPool.abilityDice = currentAbility - upgradedDice;
506
+ modifiedPool.proficiencyDice =
507
+ (modifiedPool.proficiencyDice || 0) + upgradedDice;
508
+ upgradesToApply -= upgradedDice;
509
+ // Add remaining upgrades as new proficiency dice
510
+ if (upgradesToApply > 0) {
511
+ modifiedPool.proficiencyDice =
512
+ (modifiedPool.proficiencyDice || 0) + upgradesToApply;
513
+ }
514
+ }
515
+ if (pool.upgradeDifficulty && pool.upgradeDifficulty > 0) {
516
+ let upgradesToApply = pool.upgradeDifficulty;
517
+ const currentDifficulty = modifiedPool.difficultyDice || 0;
518
+ // Upgrade existing difficulty dice to challenge
519
+ const upgradedDice = Math.min(currentDifficulty, upgradesToApply);
520
+ modifiedPool.difficultyDice = currentDifficulty - upgradedDice;
521
+ modifiedPool.challengeDice =
522
+ (modifiedPool.challengeDice || 0) + upgradedDice;
523
+ upgradesToApply -= upgradedDice;
524
+ // Add remaining upgrades as new challenge dice
525
+ if (upgradesToApply > 0) {
526
+ modifiedPool.challengeDice =
527
+ (modifiedPool.challengeDice || 0) + upgradesToApply;
528
+ }
529
+ }
530
+ // Apply downgrades after upgrades
531
+ if (pool.downgradeProficiency && pool.downgradeProficiency > 0) {
532
+ const currentProficiency = modifiedPool.proficiencyDice || 0;
533
+ const downgradesToApply = Math.min(currentProficiency, pool.downgradeProficiency);
534
+ // Downgrade proficiency dice to ability dice
535
+ modifiedPool.proficiencyDice = currentProficiency - downgradesToApply;
536
+ modifiedPool.abilityDice =
537
+ (modifiedPool.abilityDice || 0) + downgradesToApply;
538
+ // Excess downgrades are ignored (per requirements)
539
+ }
540
+ if (pool.downgradeChallenge && pool.downgradeChallenge > 0) {
541
+ const currentChallenge = modifiedPool.challengeDice || 0;
542
+ const downgradesToApply = Math.min(currentChallenge, pool.downgradeChallenge);
543
+ // Downgrade challenge dice to difficulty dice
544
+ modifiedPool.challengeDice = currentChallenge - downgradesToApply;
545
+ modifiedPool.difficultyDice =
546
+ (modifiedPool.difficultyDice || 0) + downgradesToApply;
547
+ // Excess downgrades are ignored (per requirements)
548
+ }
549
+ return modifiedPool;
550
+ };
551
+ const sumResults = (results, automaticSymbols, options) => {
491
552
  const sums = results.reduce((acc, curr) => ({
492
553
  successes: acc.successes + curr.successes,
493
554
  failures: acc.failures + curr.failures,
@@ -498,12 +559,12 @@ const sumResults = (results, options) => {
498
559
  lightSide: acc.lightSide + (curr.lightSide || 0),
499
560
  darkSide: acc.darkSide + (curr.darkSide || 0),
500
561
  }), {
501
- successes: 0,
502
- failures: 0,
503
- advantages: 0,
504
- threats: 0,
505
- triumphs: 0,
506
- despair: 0,
562
+ successes: (automaticSymbols === null || automaticSymbols === void 0 ? void 0 : automaticSymbols.successes) || 0,
563
+ failures: (automaticSymbols === null || automaticSymbols === void 0 ? void 0 : automaticSymbols.failures) || 0,
564
+ advantages: (automaticSymbols === null || automaticSymbols === void 0 ? void 0 : automaticSymbols.advantages) || 0,
565
+ threats: (automaticSymbols === null || automaticSymbols === void 0 ? void 0 : automaticSymbols.threats) || 0,
566
+ triumphs: (automaticSymbols === null || automaticSymbols === void 0 ? void 0 : automaticSymbols.triumphs) || 0,
567
+ despair: (automaticSymbols === null || automaticSymbols === void 0 ? void 0 : automaticSymbols.despairs) || 0,
507
568
  lightSide: 0,
508
569
  darkSide: 0,
509
570
  });
@@ -519,11 +580,24 @@ const sumResults = (results, options) => {
519
580
  else {
520
581
  netFailures = sums.failures - sums.successes;
521
582
  }
583
+ // Advantages and threats cancel each other out
584
+ let netAdvantages = 0;
585
+ let netThreats = 0;
586
+ if (sums.advantages === sums.threats) {
587
+ netAdvantages = 0;
588
+ netThreats = 0;
589
+ }
590
+ else if (sums.advantages > sums.threats) {
591
+ netAdvantages = sums.advantages - sums.threats;
592
+ }
593
+ else {
594
+ netThreats = sums.threats - sums.advantages;
595
+ }
522
596
  const result = {
523
597
  successes: netSuccesses,
524
598
  failures: netFailures,
525
- advantages: sums.advantages,
526
- threats: sums.threats,
599
+ advantages: netAdvantages,
600
+ threats: netThreats,
527
601
  triumphs: sums.triumphs,
528
602
  despair: sums.despair,
529
603
  lightSide: sums.lightSide,
@@ -545,13 +619,15 @@ const sumResults = (results, options) => {
545
619
  */
546
620
  const roll = (pool, options) => {
547
621
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
548
- const boostCount = (_a = pool.boostDice) !== null && _a !== void 0 ? _a : 0;
549
- const abilityCount = (_b = pool.abilityDice) !== null && _b !== void 0 ? _b : 0;
550
- const proficiencyCount = (_c = pool.proficiencyDice) !== null && _c !== void 0 ? _c : 0;
551
- const setBackCount = (_d = pool.setBackDice) !== null && _d !== void 0 ? _d : 0;
552
- const difficultyCount = (_e = pool.difficultyDice) !== null && _e !== void 0 ? _e : 0;
553
- const challengeCount = (_f = pool.challengeDice) !== null && _f !== void 0 ? _f : 0;
554
- const forceCount = (_g = pool.forceDice) !== null && _g !== void 0 ? _g : 0;
622
+ // Apply dice modifications (upgrades/downgrades)
623
+ const modifiedPool = applyDiceModifications(pool);
624
+ const boostCount = (_a = modifiedPool.boostDice) !== null && _a !== void 0 ? _a : 0;
625
+ const abilityCount = (_b = modifiedPool.abilityDice) !== null && _b !== void 0 ? _b : 0;
626
+ const proficiencyCount = (_c = modifiedPool.proficiencyDice) !== null && _c !== void 0 ? _c : 0;
627
+ const setBackCount = (_d = modifiedPool.setBackDice) !== null && _d !== void 0 ? _d : 0;
628
+ const difficultyCount = (_e = modifiedPool.difficultyDice) !== null && _e !== void 0 ? _e : 0;
629
+ const challengeCount = (_f = modifiedPool.challengeDice) !== null && _f !== void 0 ? _f : 0;
630
+ const forceCount = (_g = modifiedPool.forceDice) !== null && _g !== void 0 ? _g : 0;
555
631
  // Get limits from options or use defaults
556
632
  const maxDicePerType = (_h = options === null || options === void 0 ? void 0 : options.maxDicePerType) !== null && _h !== void 0 ? _h : exports.DEFAULT_MAX_DICE_PER_TYPE;
557
633
  const maxTotalDice = (_j = options === null || options === void 0 ? void 0 : options.maxTotalDice) !== null && _j !== void 0 ? _j : exports.DEFAULT_MAX_TOTAL_DICE;
@@ -670,7 +746,15 @@ const roll = (pool, options) => {
670
746
  result: forceDieResult(roll),
671
747
  });
672
748
  }
673
- const summary = sumResults(detailedResults.map((r) => r.result));
749
+ const automaticSymbols = {
750
+ successes: pool.automaticSuccesses,
751
+ failures: pool.automaticFailures,
752
+ advantages: pool.automaticAdvantages,
753
+ threats: pool.automaticThreats,
754
+ triumphs: pool.automaticTriumphs,
755
+ despairs: pool.automaticDespairs,
756
+ };
757
+ const summary = sumResults(detailedResults.map((r) => r.result), automaticSymbols, options);
674
758
  if (options === null || options === void 0 ? void 0 : options.hints) {
675
759
  const applicableHints = hints_1.hints.filter((hint) => {
676
760
  const { cost } = hint;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { roll } from "./dice";
2
- export type { DicePool, RollResult } from "./types";
3
- export { createSkillCheck, createCombatCheck, createOpposedCheck, createDifficultyPool, } from "./pools";
2
+ export type { DicePool, RollResult, DiceResult, RollOptions } from "./types";
3
+ export { createSkillCheck, createCombatCheck, createOpposedCheck, createDifficultyPool, applyTalentModifiers, } from "./pools";
4
+ export type { PoolModifiers } from "./pools";
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createDifficultyPool = exports.createOpposedCheck = exports.createCombatCheck = exports.createSkillCheck = exports.roll = void 0;
3
+ exports.applyTalentModifiers = exports.createDifficultyPool = exports.createOpposedCheck = exports.createCombatCheck = exports.createSkillCheck = exports.roll = void 0;
4
4
  var dice_1 = require("./dice");
5
5
  Object.defineProperty(exports, "roll", { enumerable: true, get: function () { return dice_1.roll; } });
6
6
  var pools_1 = require("./pools");
@@ -8,3 +8,4 @@ Object.defineProperty(exports, "createSkillCheck", { enumerable: true, get: func
8
8
  Object.defineProperty(exports, "createCombatCheck", { enumerable: true, get: function () { return pools_1.createCombatCheck; } });
9
9
  Object.defineProperty(exports, "createOpposedCheck", { enumerable: true, get: function () { return pools_1.createOpposedCheck; } });
10
10
  Object.defineProperty(exports, "createDifficultyPool", { enumerable: true, get: function () { return pools_1.createDifficultyPool; } });
11
+ Object.defineProperty(exports, "applyTalentModifiers", { enumerable: true, get: function () { return pools_1.applyTalentModifiers; } });
package/dist/pools.d.ts CHANGED
@@ -1,32 +1,59 @@
1
1
  import { DicePool } from "./types";
2
+ /**
3
+ * Options for applying talent or equipment modifiers to a dice pool
4
+ */
5
+ export type PoolModifiers = {
6
+ automaticSuccesses?: number;
7
+ automaticFailures?: number;
8
+ automaticAdvantages?: number;
9
+ automaticThreats?: number;
10
+ automaticTriumphs?: number;
11
+ automaticDespairs?: number;
12
+ upgradeAbility?: number;
13
+ upgradeDifficulty?: number;
14
+ downgradeProficiency?: number;
15
+ downgradeChallenge?: number;
16
+ };
2
17
  /**
3
18
  * Creates a basic skill check dice pool
4
19
  * @param ability Number of ability (green) dice
5
20
  * @param proficiency Number of proficiency (yellow) dice
21
+ * @param modifiers Optional modifiers from talents, equipment, etc.
6
22
  * @returns DicePool configured for a basic skill check
7
23
  */
8
- export declare const createSkillCheck: (ability: number, proficiency: number) => DicePool;
24
+ export declare const createSkillCheck: (ability: number, proficiency: number, modifiers?: PoolModifiers) => DicePool;
9
25
  /**
10
26
  * Creates a combat check dice pool with optional boost die
11
27
  * @param ability Number of ability (green) dice
12
28
  * @param proficiency Number of proficiency (yellow) dice
13
29
  * @param boost Number of boost (blue) dice
30
+ * @param modifiers Optional modifiers from talents, equipment, etc.
14
31
  * @returns DicePool configured for a combat check
15
32
  */
16
- export declare const createCombatCheck: (ability: number, proficiency: number, boost?: number) => DicePool;
33
+ export declare const createCombatCheck: (ability: number, proficiency: number, boost?: number, modifiers?: PoolModifiers) => DicePool;
17
34
  /**
18
35
  * Creates an opposed check dice pool
19
36
  * @param ability Number of ability (green) dice
20
37
  * @param proficiency Number of proficiency (yellow) dice
21
38
  * @param difficulty Number of difficulty (purple) dice
22
39
  * @param challenge Number of challenge (red) dice
40
+ * @param modifiers Optional modifiers from talents, equipment, etc.
23
41
  * @returns DicePool configured for an opposed check
24
42
  */
25
- export declare const createOpposedCheck: (ability: number, proficiency: number, difficulty: number, challenge?: number) => DicePool;
43
+ export declare const createOpposedCheck: (ability: number, proficiency: number, difficulty: number, challenge?: number, modifiers?: PoolModifiers) => DicePool;
26
44
  /**
27
45
  * Creates a difficulty check dice pool
28
46
  * @param difficulty Number of difficulty (purple) dice
29
47
  * @param challenge Number of challenge (red) dice
48
+ * @param modifiers Optional modifiers from talents, equipment, etc.
30
49
  * @returns DicePool configured for a pure difficulty check
31
50
  */
32
- export declare const createDifficultyPool: (difficulty: number, challenge?: number) => DicePool;
51
+ export declare const createDifficultyPool: (difficulty: number, challenge?: number, modifiers?: PoolModifiers) => DicePool;
52
+ /**
53
+ * Applies talent modifiers to an existing dice pool
54
+ * Common use case for talents that add automatic advantages, successes, or upgrade dice
55
+ * @param pool The base dice pool
56
+ * @param modifiers The modifiers to apply
57
+ * @returns A new dice pool with modifiers applied
58
+ */
59
+ export declare const applyTalentModifiers: (pool: DicePool, modifiers: PoolModifiers) => DicePool;
package/dist/pools.js CHANGED
@@ -1,15 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createDifficultyPool = exports.createOpposedCheck = exports.createCombatCheck = exports.createSkillCheck = void 0;
3
+ exports.applyTalentModifiers = exports.createDifficultyPool = exports.createOpposedCheck = exports.createCombatCheck = exports.createSkillCheck = void 0;
4
4
  /**
5
5
  * Creates a basic skill check dice pool
6
6
  * @param ability Number of ability (green) dice
7
7
  * @param proficiency Number of proficiency (yellow) dice
8
+ * @param modifiers Optional modifiers from talents, equipment, etc.
8
9
  * @returns DicePool configured for a basic skill check
9
10
  */
10
- const createSkillCheck = (ability, proficiency) => ({
11
+ const createSkillCheck = (ability, proficiency, modifiers) => ({
11
12
  abilityDice: Math.max(0, ability),
12
13
  proficiencyDice: Math.max(0, proficiency),
14
+ ...modifiers,
13
15
  });
14
16
  exports.createSkillCheck = createSkillCheck;
15
17
  /**
@@ -17,12 +19,14 @@ exports.createSkillCheck = createSkillCheck;
17
19
  * @param ability Number of ability (green) dice
18
20
  * @param proficiency Number of proficiency (yellow) dice
19
21
  * @param boost Number of boost (blue) dice
22
+ * @param modifiers Optional modifiers from talents, equipment, etc.
20
23
  * @returns DicePool configured for a combat check
21
24
  */
22
- const createCombatCheck = (ability, proficiency, boost = 0) => ({
25
+ const createCombatCheck = (ability, proficiency, boost = 0, modifiers) => ({
23
26
  abilityDice: Math.max(0, ability),
24
27
  proficiencyDice: Math.max(0, proficiency),
25
28
  boostDice: Math.max(0, boost),
29
+ ...modifiers,
26
30
  });
27
31
  exports.createCombatCheck = createCombatCheck;
28
32
  /**
@@ -31,23 +35,48 @@ exports.createCombatCheck = createCombatCheck;
31
35
  * @param proficiency Number of proficiency (yellow) dice
32
36
  * @param difficulty Number of difficulty (purple) dice
33
37
  * @param challenge Number of challenge (red) dice
38
+ * @param modifiers Optional modifiers from talents, equipment, etc.
34
39
  * @returns DicePool configured for an opposed check
35
40
  */
36
- const createOpposedCheck = (ability, proficiency, difficulty, challenge = 0) => ({
41
+ const createOpposedCheck = (ability, proficiency, difficulty, challenge = 0, modifiers) => ({
37
42
  abilityDice: Math.max(0, ability),
38
43
  proficiencyDice: Math.max(0, proficiency),
39
44
  difficultyDice: Math.max(0, difficulty),
40
45
  challengeDice: Math.max(0, challenge),
46
+ ...modifiers,
41
47
  });
42
48
  exports.createOpposedCheck = createOpposedCheck;
43
49
  /**
44
50
  * Creates a difficulty check dice pool
45
51
  * @param difficulty Number of difficulty (purple) dice
46
52
  * @param challenge Number of challenge (red) dice
53
+ * @param modifiers Optional modifiers from talents, equipment, etc.
47
54
  * @returns DicePool configured for a pure difficulty check
48
55
  */
49
- const createDifficultyPool = (difficulty, challenge = 0) => ({
56
+ const createDifficultyPool = (difficulty, challenge = 0, modifiers) => ({
50
57
  difficultyDice: Math.max(0, difficulty),
51
58
  challengeDice: Math.max(0, challenge),
59
+ ...modifiers,
52
60
  });
53
61
  exports.createDifficultyPool = createDifficultyPool;
62
+ /**
63
+ * Applies talent modifiers to an existing dice pool
64
+ * Common use case for talents that add automatic advantages, successes, or upgrade dice
65
+ * @param pool The base dice pool
66
+ * @param modifiers The modifiers to apply
67
+ * @returns A new dice pool with modifiers applied
68
+ */
69
+ const applyTalentModifiers = (pool, modifiers) => ({
70
+ ...pool,
71
+ automaticSuccesses: (pool.automaticSuccesses || 0) + (modifiers.automaticSuccesses || 0),
72
+ automaticFailures: (pool.automaticFailures || 0) + (modifiers.automaticFailures || 0),
73
+ automaticAdvantages: (pool.automaticAdvantages || 0) + (modifiers.automaticAdvantages || 0),
74
+ automaticThreats: (pool.automaticThreats || 0) + (modifiers.automaticThreats || 0),
75
+ automaticTriumphs: (pool.automaticTriumphs || 0) + (modifiers.automaticTriumphs || 0),
76
+ automaticDespairs: (pool.automaticDespairs || 0) + (modifiers.automaticDespairs || 0),
77
+ upgradeAbility: (pool.upgradeAbility || 0) + (modifiers.upgradeAbility || 0),
78
+ upgradeDifficulty: (pool.upgradeDifficulty || 0) + (modifiers.upgradeDifficulty || 0),
79
+ downgradeProficiency: (pool.downgradeProficiency || 0) + (modifiers.downgradeProficiency || 0),
80
+ downgradeChallenge: (pool.downgradeChallenge || 0) + (modifiers.downgradeChallenge || 0),
81
+ });
82
+ exports.applyTalentModifiers = applyTalentModifiers;
package/dist/types.d.ts CHANGED
@@ -6,6 +6,16 @@ export type DicePool = {
6
6
  difficultyDice?: number;
7
7
  challengeDice?: number;
8
8
  forceDice?: number;
9
+ automaticSuccesses?: number;
10
+ automaticFailures?: number;
11
+ automaticAdvantages?: number;
12
+ automaticThreats?: number;
13
+ automaticTriumphs?: number;
14
+ automaticDespairs?: number;
15
+ upgradeAbility?: number;
16
+ upgradeDifficulty?: number;
17
+ downgradeProficiency?: number;
18
+ downgradeChallenge?: number;
9
19
  };
10
20
  export type DiceResult = {
11
21
  successes: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swrpg-online/dice",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "A TypeScript library that creates dice rolls using the narrative dice system for the Star Wars Roleplaying Game by Fantasy Flight Games and Edge Studio.",
5
5
  "keywords": [
6
6
  "swrpg",