@platonic-dice/core 2.1.2 → 3.0.0
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/README.md +11 -2
- package/dist/analyseModTest.js +12 -10
- package/dist/analyseTest.js +43 -11
- package/dist/entities/DiceTestConditions.js +174 -0
- package/dist/entities/ModifiedTestConditions.js +30 -41
- package/dist/entities/RollModifier.js +15 -1
- package/dist/entities/TestConditions.js +26 -182
- package/dist/entities/TestConditionsArray.js +87 -0
- package/dist/entities/index.js +250 -39
- package/dist/index.js +42 -25
- package/dist/rollDiceMod.js +30 -17
- package/dist/rollDiceTest.js +68 -0
- package/dist/rollMod.js +3 -4
- package/dist/rollModTest.js +40 -13
- package/dist/rollTest.js +50 -15
- package/dist/utils/determineOutcome.js +35 -7
- package/dist/utils/getArrayEvaluator.js +48 -0
- package/dist/utils/getEvaluator.js +84 -0
- package/dist/utils/index.js +244 -16
- package/dist/utils/outcomeMapper.js +62 -15
- package/dist/utils/testRegistry.js +91 -0
- package/dist/utils/testValidators.js +190 -0
- package/package.json +15 -17
- package/dist/analyseModTest.d.ts +0 -126
- package/dist/analyseModTest.d.ts.map +0 -1
- package/dist/analyseTest.d.ts +0 -101
- package/dist/analyseTest.d.ts.map +0 -1
- package/dist/entities/DieType.d.ts +0 -35
- package/dist/entities/DieType.d.ts.map +0 -1
- package/dist/entities/ModifiedTestConditions.d.ts +0 -89
- package/dist/entities/ModifiedTestConditions.d.ts.map +0 -1
- package/dist/entities/Outcome.d.ts +0 -26
- package/dist/entities/Outcome.d.ts.map +0 -1
- package/dist/entities/RollModifier.d.ts +0 -115
- package/dist/entities/RollModifier.d.ts.map +0 -1
- package/dist/entities/RollType.d.ts +0 -24
- package/dist/entities/RollType.d.ts.map +0 -1
- package/dist/entities/TestConditions.d.ts +0 -97
- package/dist/entities/TestConditions.d.ts.map +0 -1
- package/dist/entities/TestType.d.ts +0 -28
- package/dist/entities/TestType.d.ts.map +0 -1
- package/dist/entities/index.d.ts +0 -19
- package/dist/entities/index.d.ts.map +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +0 -1
- package/dist/roll.d.ts +0 -66
- package/dist/roll.d.ts.map +0 -1
- package/dist/rollDice.d.ts +0 -48
- package/dist/rollDice.d.ts.map +0 -1
- package/dist/rollDiceMod.d.ts +0 -54
- package/dist/rollDiceMod.d.ts.map +0 -1
- package/dist/rollMod.d.ts +0 -52
- package/dist/rollMod.d.ts.map +0 -1
- package/dist/rollModTest.d.ts +0 -72
- package/dist/rollModTest.d.ts.map +0 -1
- package/dist/rollTest.d.ts +0 -59
- package/dist/rollTest.d.ts.map +0 -1
- package/dist/utils/determineOutcome.d.ts +0 -45
- package/dist/utils/determineOutcome.d.ts.map +0 -1
- package/dist/utils/generateResult.d.ts +0 -30
- package/dist/utils/generateResult.d.ts.map +0 -1
- package/dist/utils/index.d.ts +0 -8
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/outcomeMapper.d.ts +0 -29
- package/dist/utils/outcomeMapper.d.ts.map +0 -1
- package/dist-types.d.ts +0 -70
|
@@ -9,13 +9,27 @@
|
|
|
9
9
|
* const result = rollTest(DieType.D20, tc);
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const { isValidDieType } = require("./DieType");
|
|
13
12
|
const { isValidTestType } = require("./TestType");
|
|
14
|
-
const
|
|
13
|
+
const validators = require("../utils/testValidators");
|
|
14
|
+
|
|
15
|
+
/* Typedef ownership:
|
|
16
|
+
* - `TestConditionsLike`
|
|
17
|
+
*/
|
|
15
18
|
|
|
16
19
|
/**
|
|
17
20
|
* @typedef {import("./TestType").TestTypeValue} TestTypeValue
|
|
18
21
|
* @typedef {import("./DieType").DieTypeValue} DieTypeValue
|
|
22
|
+
* @typedef {import("../utils/testValidators").Conditions} Conditions
|
|
23
|
+
* @typedef {import("../utils/testValidators").ConditionsLike} ConditionsLike
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A public 'like' type for test conditions accepted by many APIs.
|
|
28
|
+
* - Either a fully constructed `TestConditions` instance, or a plain
|
|
29
|
+
* object containing at minimum a `testType` property and other condition
|
|
30
|
+
* fields. We reuse `PlainObject` from `testValidators` for the plain case.
|
|
31
|
+
*
|
|
32
|
+
* @typedef {InstanceType<typeof TestConditions>|({ testType: TestTypeValue } & import("../utils/testValidators").PlainObject)} TestConditionsLike
|
|
19
33
|
*/
|
|
20
34
|
|
|
21
35
|
/**
|
|
@@ -48,19 +62,19 @@ class TestConditions {
|
|
|
48
62
|
case "at_most":
|
|
49
63
|
case "exact":
|
|
50
64
|
throw new RangeError(
|
|
51
|
-
`Invalid ${testType} condition for die type ${dieType}: target must be an integer within valid die faces
|
|
65
|
+
`Invalid ${testType} condition for die type ${dieType}: target must be an integer within valid die faces.`,
|
|
52
66
|
);
|
|
53
67
|
case "within":
|
|
54
68
|
throw new RangeError(
|
|
55
|
-
`Invalid 'within' condition for die type ${dieType}: min must be ≤ max and both valid face values
|
|
69
|
+
`Invalid 'within' condition for die type ${dieType}: min must be ≤ max and both valid face values.`,
|
|
56
70
|
);
|
|
57
71
|
case "in_list":
|
|
58
72
|
throw new RangeError(
|
|
59
|
-
`Invalid 'specificList' condition for die type ${dieType}: values must be a non-empty array of valid face values
|
|
73
|
+
`Invalid 'specificList' condition for die type ${dieType}: values must be a non-empty array of valid face values.`,
|
|
60
74
|
);
|
|
61
75
|
case "skill":
|
|
62
76
|
throw new RangeError(
|
|
63
|
-
`Invalid 'skill' condition for die type ${dieType}: target, critical_success, and critical_failure must be valid and logically ordered
|
|
77
|
+
`Invalid 'skill' condition for die type ${dieType}: target, critical_success, and critical_failure must be valid and logically ordered.`,
|
|
64
78
|
);
|
|
65
79
|
default:
|
|
66
80
|
throw new TypeError(`Unknown testType '${testType}'.`);
|
|
@@ -77,14 +91,14 @@ class TestConditions {
|
|
|
77
91
|
|
|
78
92
|
/**
|
|
79
93
|
* Validates that the test conditions still conforms to spec.
|
|
80
|
-
* (Useful if they are loaded dynamically or
|
|
94
|
+
* (Useful if they are loaded dynamically or serialised.)
|
|
81
95
|
* @throws {TypeError} If the test conditions are invalid.
|
|
82
96
|
*/
|
|
83
97
|
validate() {
|
|
84
98
|
if (
|
|
85
99
|
!areValidTestConditions(
|
|
86
100
|
{ ...this.conditions, dieType: this.dieType },
|
|
87
|
-
this.testType
|
|
101
|
+
this.testType,
|
|
88
102
|
)
|
|
89
103
|
) {
|
|
90
104
|
throw new TypeError("Invalid test conditions shape.");
|
|
@@ -101,27 +115,8 @@ class TestConditions {
|
|
|
101
115
|
* @returns {boolean}
|
|
102
116
|
*/
|
|
103
117
|
function areValidTestConditions(c, testType) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
case "at_most":
|
|
107
|
-
case "exact":
|
|
108
|
-
// @ts-expect-error: we know c is TargetConditions for these test types
|
|
109
|
-
return isValidTargetConditions(c);
|
|
110
|
-
case "within":
|
|
111
|
-
// @ts-expect-error: we know c is WithinConditions for this test type
|
|
112
|
-
return isValidWithinConditions(c);
|
|
113
|
-
case "in_list":
|
|
114
|
-
// @ts-expect-error: we know c is SpecificListConditions
|
|
115
|
-
return isValidSpecificListConditions(c);
|
|
116
|
-
// case "odd":
|
|
117
|
-
// case "even":
|
|
118
|
-
// return isValidOddEvenCondition(c);
|
|
119
|
-
case "skill":
|
|
120
|
-
// @ts-expect-error: we know c is SkillConditions
|
|
121
|
-
return isValidSkillTestCondition(c);
|
|
122
|
-
default:
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
118
|
+
// Delegate master validation to utils/testValidators for consistency
|
|
119
|
+
return validators.areValidTestConditions(c, testType);
|
|
125
120
|
}
|
|
126
121
|
|
|
127
122
|
/**
|
|
@@ -130,7 +125,7 @@ function areValidTestConditions(c, testType) {
|
|
|
130
125
|
* Automatically validates all conditions for the specified die type.
|
|
131
126
|
*
|
|
132
127
|
* @function normaliseTestConditions
|
|
133
|
-
* @param {TestConditions |
|
|
128
|
+
* @param {TestConditions | TestConditionsLike} tc
|
|
134
129
|
* A {@link TestConditions} instance or plain object with `testType` and other fields.
|
|
135
130
|
* @param {DieTypeValue} dieType
|
|
136
131
|
* The die type (e.g., `'d6'`, `'d20'`) used for validation.
|
|
@@ -158,22 +153,10 @@ function normaliseTestConditions(tc, dieType) {
|
|
|
158
153
|
return new TestConditions(testType, { ...rest }, dieType);
|
|
159
154
|
}
|
|
160
155
|
throw new TypeError(
|
|
161
|
-
`Invalid TestConditions: must be a TestConditions instance or a plain object
|
|
156
|
+
`Invalid TestConditions: must be a TestConditions instance or a plain object.`,
|
|
162
157
|
);
|
|
163
158
|
}
|
|
164
159
|
|
|
165
|
-
/**
|
|
166
|
-
* Represents any valid dice roll test condition.
|
|
167
|
-
*
|
|
168
|
-
* This is a union type of all the internal test condition shapes:
|
|
169
|
-
* - `TargetConditions` – single target value
|
|
170
|
-
* - `SkillConditions` – target with optional critical thresholds
|
|
171
|
-
* - `WithinConditions` – min/max range
|
|
172
|
-
* - `SpecificListConditions` – array of specific allowed values
|
|
173
|
-
*
|
|
174
|
-
* @typedef {TargetConditions | SkillConditions | WithinConditions | SpecificListConditions} Conditions
|
|
175
|
-
*/
|
|
176
|
-
|
|
177
160
|
/**
|
|
178
161
|
* @typedef {InstanceType<typeof TestConditions>} TestConditionsInstance
|
|
179
162
|
*/
|
|
@@ -183,142 +166,3 @@ module.exports = {
|
|
|
183
166
|
areValidTestConditions,
|
|
184
167
|
normaliseTestConditions,
|
|
185
168
|
};
|
|
186
|
-
|
|
187
|
-
//
|
|
188
|
-
// PRIVATE HELPER FUNCTIONS
|
|
189
|
-
//
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* @private
|
|
193
|
-
* @typedef {Object} BaseTestCondition
|
|
194
|
-
* @property {DieTypeValue} dieType
|
|
195
|
-
*/
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* @private
|
|
199
|
-
* @typedef {BaseTestCondition & { target: number }} TargetConditions
|
|
200
|
-
* @private
|
|
201
|
-
* @typedef {BaseTestCondition & { min: number, max: number }} WithinConditions
|
|
202
|
-
* @private
|
|
203
|
-
* @typedef {BaseTestCondition & { values: number[] }} SpecificListConditions
|
|
204
|
-
* @private
|
|
205
|
-
* @typedef {BaseTestCondition & { target: number, critical_success?: number, critical_failure?: number }} SkillConditions
|
|
206
|
-
*/
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Checks if a number is a valid face value for a die with the given sides.
|
|
210
|
-
*
|
|
211
|
-
* @private
|
|
212
|
-
* @function isValidFaceValue
|
|
213
|
-
* @param {number} n
|
|
214
|
-
* @param {number} sides
|
|
215
|
-
* @returns {boolean}
|
|
216
|
-
*/
|
|
217
|
-
function isValidFaceValue(n, sides) {
|
|
218
|
-
return Number.isInteger(n) && n >= 1 && n <= sides;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Checks multiple keys in an object for valid face values.
|
|
223
|
-
*
|
|
224
|
-
* @private
|
|
225
|
-
* @function areValidFaceValues
|
|
226
|
-
* @template T
|
|
227
|
-
* @param {T} obj
|
|
228
|
-
* @param {number} sides
|
|
229
|
-
* @param {(keyof T)[]} keys
|
|
230
|
-
* @returns {boolean}
|
|
231
|
-
*/
|
|
232
|
-
function areValidFaceValues(obj, sides, keys) {
|
|
233
|
-
return keys.every((key) => {
|
|
234
|
-
const value = obj[key];
|
|
235
|
-
return (
|
|
236
|
-
value == null || isValidFaceValue(/** @type {number} */ (value), sides)
|
|
237
|
-
);
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Validates the ordering of target and critical thresholds.
|
|
243
|
-
*
|
|
244
|
-
* @private
|
|
245
|
-
* @function isValidThresholdOrder
|
|
246
|
-
* @param {SkillConditions} thresholds
|
|
247
|
-
* @returns {boolean}
|
|
248
|
-
*/
|
|
249
|
-
function isValidThresholdOrder({ target, critical_success, critical_failure }) {
|
|
250
|
-
if (critical_failure != null && critical_failure >= target) return false;
|
|
251
|
-
if (critical_success != null && critical_success < target) return false;
|
|
252
|
-
return true;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Validates a target-based condition.
|
|
257
|
-
*
|
|
258
|
-
* @private
|
|
259
|
-
* @function isValidTargetConditions
|
|
260
|
-
* @param {TargetConditions} c
|
|
261
|
-
* @returns {boolean}
|
|
262
|
-
*/
|
|
263
|
-
function isValidTargetConditions(c) {
|
|
264
|
-
if (!c || !isValidDieType(c.dieType)) return false;
|
|
265
|
-
return isValidFaceValue(c.target, numSides(c.dieType));
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Validates a skill-based test condition.
|
|
270
|
-
*
|
|
271
|
-
* @private
|
|
272
|
-
* @function isValidSkillTestCondition
|
|
273
|
-
* @param {SkillConditions} c
|
|
274
|
-
* @returns {boolean}
|
|
275
|
-
*/
|
|
276
|
-
function isValidSkillTestCondition(c) {
|
|
277
|
-
if (!c || !isValidDieType(c.dieType)) return false;
|
|
278
|
-
const sides = numSides(c.dieType);
|
|
279
|
-
|
|
280
|
-
if (
|
|
281
|
-
!areValidFaceValues(c, sides, [
|
|
282
|
-
"target",
|
|
283
|
-
"critical_success",
|
|
284
|
-
"critical_failure",
|
|
285
|
-
])
|
|
286
|
-
)
|
|
287
|
-
return false;
|
|
288
|
-
if (!isValidThresholdOrder(c)) return false;
|
|
289
|
-
|
|
290
|
-
return true;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Validates a "within" range condition.
|
|
295
|
-
*
|
|
296
|
-
* @private
|
|
297
|
-
* @function isValidWithinConditions
|
|
298
|
-
* @param {WithinConditions} c
|
|
299
|
-
* @returns {boolean}
|
|
300
|
-
*/
|
|
301
|
-
function isValidWithinConditions(c) {
|
|
302
|
-
if (!c || !isValidDieType(c.dieType)) return false;
|
|
303
|
-
const sides = numSides(c.dieType);
|
|
304
|
-
|
|
305
|
-
if (!areValidFaceValues(c, sides, ["min", "max"])) return false;
|
|
306
|
-
if (c.min > c.max) return false;
|
|
307
|
-
|
|
308
|
-
return true;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Validates a "specific list" condition.
|
|
313
|
-
*
|
|
314
|
-
* @private
|
|
315
|
-
* @function isValidSpecificListConditions
|
|
316
|
-
* @param {SpecificListConditions} c
|
|
317
|
-
* @returns {boolean}
|
|
318
|
-
*/
|
|
319
|
-
function isValidSpecificListConditions(c) {
|
|
320
|
-
if (!c || !isValidDieType(c.dieType)) return false;
|
|
321
|
-
const sides = numSides(c.dieType);
|
|
322
|
-
if (!Array.isArray(c.values) || c.values.length === 0) return false;
|
|
323
|
-
return c.values.every((v) => isValidFaceValue(v, sides));
|
|
324
|
-
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @platonic-dice/core/src/entities/TestConditionsArray
|
|
3
|
+
* @description
|
|
4
|
+
* Represents an ordered array of `TestConditions`-like entries which can be
|
|
5
|
+
* evaluated against a set of dice (or modified dice results) to produce an
|
|
6
|
+
* array of outcomes. This is a lightweight building block for multi-dice
|
|
7
|
+
* test types that need to evaluate multiple per-die or per-condition checks.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const { TestConditions, normaliseTestConditions } = require("./TestConditions");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {import("./TestConditions").TestConditionsInstance} TestConditionsInstance
|
|
14
|
+
* @typedef {import("./TestConditions").TestConditionsLike} TestConditionsLike
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
class TestConditionsArray {
|
|
18
|
+
/**
|
|
19
|
+
* @param {Array<TestConditionsInstance|Object>} arr - Array of TestConditions instances or plain objects
|
|
20
|
+
* @param {string|undefined} [defaultDieType] - Optional default die type used to normalise plain objects
|
|
21
|
+
/**
|
|
22
|
+
* @param {Array<TestConditionsInstance|TestConditionsLike>} arr - Array of TestConditions instances or plain objects
|
|
23
|
+
* @param {string|undefined} [defaultDieType] - Optional default die type used to normalise plain objects
|
|
24
|
+
*/
|
|
25
|
+
constructor(arr = [], defaultDieType = undefined) {
|
|
26
|
+
this.defaultDieType = defaultDieType;
|
|
27
|
+
/** @type {TestConditionsInstance[]} */
|
|
28
|
+
this.conditions = arr.map((c, idx) => {
|
|
29
|
+
// If already a TestConditions instance, accept as-is
|
|
30
|
+
if (c instanceof TestConditions) return c;
|
|
31
|
+
|
|
32
|
+
// Plain object: try to determine dieType per-entry
|
|
33
|
+
if (c && typeof c === "object") {
|
|
34
|
+
// c is a TestConditionsLike here; prefer per-entry dieType then default
|
|
35
|
+
const entryDie =
|
|
36
|
+
/** @type {TestConditionsLike} */ (c).dieType || defaultDieType;
|
|
37
|
+
if (!entryDie)
|
|
38
|
+
throw new TypeError(
|
|
39
|
+
`TestConditionsArray: element at index ${idx} requires a dieType (either on the element or a default passed to the constructor)`,
|
|
40
|
+
);
|
|
41
|
+
return normaliseTestConditions(
|
|
42
|
+
/** @type {TestConditionsLike} */ (c),
|
|
43
|
+
entryDie,
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
throw new TypeError(
|
|
48
|
+
`TestConditionsArray: element at index ${idx} must be a TestConditions instance or a plain object`,
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Evaluate each contained condition against a provided numeric value.
|
|
55
|
+
* Returns an array of outcome values (strings) for each condition in order.
|
|
56
|
+
*
|
|
57
|
+
* @param {number} value - The numeric value to evaluate (e.g., a die face or modified value)
|
|
58
|
+
* @param {Function} evaluator - A function `(value, testConditionsInstance) => outcome`.
|
|
59
|
+
* If omitted, each TestConditions instance is expected to be consumable by
|
|
60
|
+
* existing utilities that accept a TestConditions instance.
|
|
61
|
+
* @returns {Array<string>} outcomes
|
|
62
|
+
*/
|
|
63
|
+
evaluateEach(value, evaluator) {
|
|
64
|
+
if (typeof value !== "number")
|
|
65
|
+
throw new TypeError("value must be a number");
|
|
66
|
+
const evalFn = evaluator;
|
|
67
|
+
return this.conditions.map((tc) => {
|
|
68
|
+
if (typeof evalFn === "function") return evalFn(value, tc);
|
|
69
|
+
// Default: delegate to a helper that callers should provide; throw otherwise
|
|
70
|
+
throw new TypeError(
|
|
71
|
+
"No evaluator provided for TestConditionsArray.evaluateEach",
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Convenience to return the raw TestConditions instances array.
|
|
78
|
+
* @returns {TestConditionsInstance[]}
|
|
79
|
+
*/
|
|
80
|
+
toArray() {
|
|
81
|
+
return this.conditions.slice();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
module.exports = {
|
|
86
|
+
TestConditionsArray,
|
|
87
|
+
};
|
package/dist/entities/index.js
CHANGED
|
@@ -13,42 +13,253 @@
|
|
|
13
13
|
* const result = roll(DieType.D20, RollType.Advantage);
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
16
|
+
// Lazy-loaded per-export getters to avoid circular require during
|
|
17
|
+
// module initialization. Each exported name is resolved on first
|
|
18
|
+
// access and cached locally. Properties are `configurable: true`
|
|
19
|
+
// so test frameworks (e.g., Jest) can spy/mock them.
|
|
20
|
+
|
|
21
|
+
// DieType
|
|
22
|
+
/** @type {typeof import("./DieType").DieType | undefined} */
|
|
23
|
+
let _DieType;
|
|
24
|
+
Object.defineProperty(exports, "DieType", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
get() {
|
|
28
|
+
if (_DieType !== undefined) return _DieType;
|
|
29
|
+
_DieType = require("./DieType.js").DieType;
|
|
30
|
+
return _DieType;
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
/** @type {typeof import("./DieType").isValidDieType | undefined} */
|
|
35
|
+
let _isValidDieType;
|
|
36
|
+
Object.defineProperty(exports, "isValidDieType", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
get() {
|
|
40
|
+
if (_isValidDieType !== undefined) return _isValidDieType;
|
|
41
|
+
_isValidDieType = require("./DieType.js").isValidDieType;
|
|
42
|
+
return _isValidDieType;
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Outcome
|
|
47
|
+
/** @type {typeof import("./Outcome").Outcome | undefined} */
|
|
48
|
+
let _Outcome;
|
|
49
|
+
Object.defineProperty(exports, "Outcome", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
configurable: true,
|
|
52
|
+
get() {
|
|
53
|
+
if (_Outcome !== undefined) return _Outcome;
|
|
54
|
+
_Outcome = require("./Outcome.js").Outcome;
|
|
55
|
+
return _Outcome;
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
/** @type {typeof import("./Outcome").isValidOutcome | undefined} */
|
|
60
|
+
let _isValidOutcome;
|
|
61
|
+
Object.defineProperty(exports, "isValidOutcome", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
configurable: true,
|
|
64
|
+
get() {
|
|
65
|
+
if (_isValidOutcome !== undefined) return _isValidOutcome;
|
|
66
|
+
_isValidOutcome = require("./Outcome.js").isValidOutcome;
|
|
67
|
+
return _isValidOutcome;
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// RollModifier
|
|
72
|
+
/** @type {typeof import("./RollModifier").RollModifier | undefined} */
|
|
73
|
+
let _RollModifier;
|
|
74
|
+
Object.defineProperty(exports, "RollModifier", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
configurable: true,
|
|
77
|
+
get() {
|
|
78
|
+
if (_RollModifier !== undefined) return _RollModifier;
|
|
79
|
+
_RollModifier = require("./RollModifier.js").RollModifier;
|
|
80
|
+
return _RollModifier;
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
/** @type {typeof import("./RollModifier").isValidRollModifier | undefined} */
|
|
85
|
+
let _isValidRollModifier;
|
|
86
|
+
Object.defineProperty(exports, "isValidRollModifier", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
configurable: true,
|
|
89
|
+
get() {
|
|
90
|
+
if (_isValidRollModifier !== undefined) return _isValidRollModifier;
|
|
91
|
+
_isValidRollModifier = require("./RollModifier.js").isValidRollModifier;
|
|
92
|
+
return _isValidRollModifier;
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
/** @type {typeof import("./RollModifier").normaliseRollModifier | undefined} */
|
|
97
|
+
let _normaliseRollModifier;
|
|
98
|
+
Object.defineProperty(exports, "normaliseRollModifier", {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
configurable: true,
|
|
101
|
+
get() {
|
|
102
|
+
if (_normaliseRollModifier !== undefined) return _normaliseRollModifier;
|
|
103
|
+
_normaliseRollModifier = require("./RollModifier.js").normaliseRollModifier;
|
|
104
|
+
return _normaliseRollModifier;
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// RollType
|
|
109
|
+
/** @type {typeof import("./RollType").RollType | undefined} */
|
|
110
|
+
let _RollType;
|
|
111
|
+
Object.defineProperty(exports, "RollType", {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
configurable: true,
|
|
114
|
+
get() {
|
|
115
|
+
if (_RollType !== undefined) return _RollType;
|
|
116
|
+
_RollType = require("./RollType.js").RollType;
|
|
117
|
+
return _RollType;
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
/** @type {typeof import("./RollType").isValidRollType | undefined} */
|
|
122
|
+
let _isValidRollType;
|
|
123
|
+
Object.defineProperty(exports, "isValidRollType", {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
configurable: true,
|
|
126
|
+
get() {
|
|
127
|
+
if (_isValidRollType !== undefined) return _isValidRollType;
|
|
128
|
+
_isValidRollType = require("./RollType.js").isValidRollType;
|
|
129
|
+
return _isValidRollType;
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// TestConditions
|
|
134
|
+
/** @type {typeof import("./TestConditions").TestConditions | undefined} */
|
|
135
|
+
let _TestConditions;
|
|
136
|
+
Object.defineProperty(exports, "TestConditions", {
|
|
137
|
+
enumerable: true,
|
|
138
|
+
configurable: true,
|
|
139
|
+
get() {
|
|
140
|
+
if (_TestConditions !== undefined) return _TestConditions;
|
|
141
|
+
_TestConditions = require("./TestConditions.js").TestConditions;
|
|
142
|
+
return _TestConditions;
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
/** @type {typeof import("./TestConditions").areValidTestConditions | undefined} */
|
|
147
|
+
let _areValidTestConditions;
|
|
148
|
+
Object.defineProperty(exports, "areValidTestConditions", {
|
|
149
|
+
enumerable: true,
|
|
150
|
+
configurable: true,
|
|
151
|
+
get() {
|
|
152
|
+
if (_areValidTestConditions !== undefined) return _areValidTestConditions;
|
|
153
|
+
_areValidTestConditions =
|
|
154
|
+
require("./TestConditions.js").areValidTestConditions;
|
|
155
|
+
return _areValidTestConditions;
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
/** @type {typeof import("./TestConditions").normaliseTestConditions | undefined} */
|
|
160
|
+
let _normaliseTestConditions;
|
|
161
|
+
Object.defineProperty(exports, "normaliseTestConditions", {
|
|
162
|
+
enumerable: true,
|
|
163
|
+
configurable: true,
|
|
164
|
+
get() {
|
|
165
|
+
if (_normaliseTestConditions !== undefined) return _normaliseTestConditions;
|
|
166
|
+
_normaliseTestConditions =
|
|
167
|
+
require("./TestConditions.js").normaliseTestConditions;
|
|
168
|
+
return _normaliseTestConditions;
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// DiceTestConditions
|
|
173
|
+
/** @type {typeof import("./DiceTestConditions").DiceTestConditions | undefined} */
|
|
174
|
+
let _DiceTestConditions;
|
|
175
|
+
Object.defineProperty(exports, "DiceTestConditions", {
|
|
176
|
+
enumerable: true,
|
|
177
|
+
configurable: true,
|
|
178
|
+
get() {
|
|
179
|
+
if (_DiceTestConditions !== undefined) return _DiceTestConditions;
|
|
180
|
+
_DiceTestConditions = require("./DiceTestConditions.js").DiceTestConditions;
|
|
181
|
+
return _DiceTestConditions;
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
// TestConditionsArray
|
|
186
|
+
/** @type {typeof import("./TestConditionsArray").TestConditionsArray | undefined} */
|
|
187
|
+
let _TestConditionsArray;
|
|
188
|
+
Object.defineProperty(exports, "TestConditionsArray", {
|
|
189
|
+
enumerable: true,
|
|
190
|
+
configurable: true,
|
|
191
|
+
get() {
|
|
192
|
+
if (_TestConditionsArray !== undefined) return _TestConditionsArray;
|
|
193
|
+
_TestConditionsArray =
|
|
194
|
+
require("./TestConditionsArray.js").TestConditionsArray;
|
|
195
|
+
return _TestConditionsArray;
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// ModifiedTestConditions
|
|
200
|
+
/** @type {typeof import("./ModifiedTestConditions").ModifiedTestConditions | undefined} */
|
|
201
|
+
let _ModifiedTestConditions;
|
|
202
|
+
Object.defineProperty(exports, "ModifiedTestConditions", {
|
|
203
|
+
enumerable: true,
|
|
204
|
+
configurable: true,
|
|
205
|
+
get() {
|
|
206
|
+
if (_ModifiedTestConditions !== undefined) return _ModifiedTestConditions;
|
|
207
|
+
_ModifiedTestConditions =
|
|
208
|
+
require("./ModifiedTestConditions.js").ModifiedTestConditions;
|
|
209
|
+
return _ModifiedTestConditions;
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
/** @type {typeof import("./ModifiedTestConditions").areValidModifiedTestConditions | undefined} */
|
|
214
|
+
let _areValidModifiedTestConditions;
|
|
215
|
+
Object.defineProperty(exports, "areValidModifiedTestConditions", {
|
|
216
|
+
enumerable: true,
|
|
217
|
+
configurable: true,
|
|
218
|
+
get() {
|
|
219
|
+
if (_areValidModifiedTestConditions !== undefined)
|
|
220
|
+
return _areValidModifiedTestConditions;
|
|
221
|
+
_areValidModifiedTestConditions =
|
|
222
|
+
require("./ModifiedTestConditions.js").areValidModifiedTestConditions;
|
|
223
|
+
return _areValidModifiedTestConditions;
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
/** @type {typeof import("./ModifiedTestConditions").computeModifiedRange | undefined} */
|
|
228
|
+
let _computeModifiedRange;
|
|
229
|
+
Object.defineProperty(exports, "computeModifiedRange", {
|
|
230
|
+
enumerable: true,
|
|
231
|
+
configurable: true,
|
|
232
|
+
get() {
|
|
233
|
+
if (_computeModifiedRange !== undefined) return _computeModifiedRange;
|
|
234
|
+
_computeModifiedRange =
|
|
235
|
+
require("./ModifiedTestConditions.js").computeModifiedRange;
|
|
236
|
+
return _computeModifiedRange;
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
// TestType
|
|
241
|
+
/** @type {typeof import("./TestType").TestType | undefined} */
|
|
242
|
+
let _TestType;
|
|
243
|
+
Object.defineProperty(exports, "TestType", {
|
|
244
|
+
enumerable: true,
|
|
245
|
+
configurable: true,
|
|
246
|
+
get() {
|
|
247
|
+
if (_TestType !== undefined) return _TestType;
|
|
248
|
+
_TestType = require("./TestType.js").TestType;
|
|
249
|
+
return _TestType;
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
/** @type {typeof import("./TestType").isValidTestType | undefined} */
|
|
254
|
+
let _isValidTestType;
|
|
255
|
+
Object.defineProperty(exports, "isValidTestType", {
|
|
256
|
+
enumerable: true,
|
|
257
|
+
configurable: true,
|
|
258
|
+
get() {
|
|
259
|
+
if (_isValidTestType !== undefined) return _isValidTestType;
|
|
260
|
+
_isValidTestType = require("./TestType.js").isValidTestType;
|
|
261
|
+
return _isValidTestType;
|
|
262
|
+
},
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
// Type exports are provided by @types/platonic-dice__core.
|