@yipe/dice 0.2.12 → 0.2.13
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
|
@@ -3080,7 +3080,18 @@ function astFromRollConfigs(configs) {
|
|
|
3080
3080
|
const baseCount = Math.max(1, Math.floor(Math.abs(count || 1)));
|
|
3081
3081
|
const trials = Math.max(1, Math.floor(cfg.keep.total));
|
|
3082
3082
|
const k = Math.max(0, Math.floor(cfg.keep.count));
|
|
3083
|
-
if (
|
|
3083
|
+
if (k === 1 && cfg.keep.mode === "highest") {
|
|
3084
|
+
const perTrial = {
|
|
3085
|
+
type: "sum",
|
|
3086
|
+
count: baseCount,
|
|
3087
|
+
child: node
|
|
3088
|
+
};
|
|
3089
|
+
if (trials === 1) {
|
|
3090
|
+
node = perTrial;
|
|
3091
|
+
} else {
|
|
3092
|
+
node = { type: "maxOf", count: trials, child: perTrial };
|
|
3093
|
+
}
|
|
3094
|
+
} else if (trials === baseCount) {
|
|
3084
3095
|
const base = { type: "sum", count: trials, child: node };
|
|
3085
3096
|
node = {
|
|
3086
3097
|
type: "keep",
|
|
@@ -3096,8 +3107,6 @@ function astFromRollConfigs(configs) {
|
|
|
3096
3107
|
};
|
|
3097
3108
|
if (trials === 1) {
|
|
3098
3109
|
node = perTrial;
|
|
3099
|
-
} else if (k === 1 && cfg.keep.mode === "highest") {
|
|
3100
|
-
node = { type: "maxOf", count: trials, child: perTrial };
|
|
3101
3110
|
} else {
|
|
3102
3111
|
const trialPool = {
|
|
3103
3112
|
type: "sum",
|