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