@yipe/dice 0.2.9 → 0.2.10

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.
@@ -2698,7 +2698,7 @@ var RollBuilder = class _RollBuilder {
2698
2698
  let rootD20Group;
2699
2699
  if (rootConfig && rootConfig.sides === 20) {
2700
2700
  const rootIndex = groupedConfigs.findIndex(
2701
- ({ config }) => config.sides === rootConfig.sides && config.rollType === rootConfig.rollType && config.reroll === rootConfig.reroll && config.explode === rootConfig.explode && config.minimum === rootConfig.minimum && config.bestOf === rootConfig.bestOf && JSON.stringify(config.keep) === JSON.stringify(rootConfig.keep)
2701
+ ({ config }) => rollConfigsEqual(config, rootConfig) && JSON.stringify(config.keep) === JSON.stringify(rootConfig.keep)
2702
2702
  );
2703
2703
  if (rootIndex !== -1) {
2704
2704
  rootD20Group = groupedConfigs.splice(rootIndex, 1)[0];
@@ -2737,13 +2737,19 @@ var RollBuilder = class _RollBuilder {
2737
2737
  const expression = diceExpressions[i];
2738
2738
  if (i === 0) {
2739
2739
  result = (config.isSubtraction ? "-" : "") + expression;
2740
+ if (config.sides === 20 && totalModifier !== 0) {
2741
+ if (totalModifier > 0) result += ` + ${totalModifier}`;
2742
+ else result += ` - ${Math.abs(totalModifier)}`;
2743
+ }
2740
2744
  } else {
2741
2745
  const operator = config.isSubtraction ? " - " : " + ";
2742
2746
  result += operator + expression;
2743
2747
  }
2744
2748
  }
2745
- if (totalModifier > 0) result += ` + ${totalModifier}`;
2746
- else if (totalModifier < 0) result += ` - ${Math.abs(totalModifier)}`;
2749
+ if (diceConfigs.length === 0 || diceConfigs[0].sides !== 20) {
2750
+ if (totalModifier > 0) result += ` + ${totalModifier}`;
2751
+ else if (totalModifier < 0) result += ` - ${Math.abs(totalModifier)}`;
2752
+ }
2747
2753
  return result.replace(/\+ -/g, "-");
2748
2754
  }
2749
2755
  toPMF(eps = 0) {