@yipe/dice 0.2.8 → 0.2.9
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.cjs
CHANGED
|
@@ -2655,13 +2655,19 @@ var RollBuilder = class _RollBuilder {
|
|
|
2655
2655
|
];
|
|
2656
2656
|
return new this.constructor(configs);
|
|
2657
2657
|
}
|
|
2658
|
-
|
|
2658
|
+
scaleDice(scale) {
|
|
2659
|
+
const scaleInt = Math.floor(scale);
|
|
2660
|
+
if (scaleInt !== scale) throw new Error("Scale must be an integer");
|
|
2661
|
+
if (scaleInt <= 0) throw new Error("Scale must be > 0");
|
|
2659
2662
|
const newConfigs = this.getSubRollConfigs().map((config) => {
|
|
2660
2663
|
if (!config.sides || config.sides <= 0) return config;
|
|
2661
|
-
return { ...config, count: config.count *
|
|
2664
|
+
return { ...config, count: config.count * scaleInt };
|
|
2662
2665
|
});
|
|
2663
2666
|
return new this.constructor(newConfigs);
|
|
2664
2667
|
}
|
|
2668
|
+
doubleDice() {
|
|
2669
|
+
return this.scaleDice(2);
|
|
2670
|
+
}
|
|
2665
2671
|
copy() {
|
|
2666
2672
|
return new this.constructor(this.getSubRollConfigs());
|
|
2667
2673
|
}
|