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