@dicelette/core 1.18.5 → 1.20.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/dist/index.d.mts +42 -125
- package/dist/index.d.ts +42 -125
- package/dist/index.js +81 -55
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -51
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Engine } from 'random-js';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -8,12 +9,12 @@ import { z } from 'zod';
|
|
|
8
9
|
* Random stats = 6
|
|
9
10
|
* result = "1d20>3"
|
|
10
11
|
*/
|
|
11
|
-
declare function createCriticalCustom(dice: string, customCritical: CustomCritical, template: StatisticalTemplate): string;
|
|
12
|
+
declare function createCriticalCustom(dice: string, customCritical: CustomCritical, template: StatisticalTemplate, engine?: Engine | null): string;
|
|
12
13
|
/**
|
|
13
14
|
* Parse the string provided and turn it as a readable dice for dice parser
|
|
14
15
|
* @param dice {string}
|
|
15
16
|
*/
|
|
16
|
-
declare function roll(dice: string): Resultat | undefined;
|
|
17
|
+
declare function roll(dice: string, engine?: Engine | null): Resultat | undefined;
|
|
17
18
|
/**
|
|
18
19
|
* Evaluate a formula and replace "^" by "**" if any
|
|
19
20
|
* @param {Sign} sign
|
|
@@ -231,16 +232,25 @@ declare function isNumber(value: unknown): boolean;
|
|
|
231
232
|
* Replace the `{exp}` in the dice.
|
|
232
233
|
* If the `{exp}` has a default value in the form of `{exp || defaultValue}`, it will be replaced by the default value.
|
|
233
234
|
* @param {string} dice
|
|
235
|
+
* @param engine
|
|
234
236
|
* @returns {string} the dice with the {exp} replaced by a random value
|
|
235
237
|
*/
|
|
236
|
-
declare function replaceExpByRandom(dice: string): string;
|
|
238
|
+
declare function replaceExpByRandom(dice: string, engine?: Engine | null): string;
|
|
239
|
+
/**
|
|
240
|
+
* Utility function to get the engine from its name
|
|
241
|
+
* @param engine {"nativeMath" | "browserCrypto" | "nodeCrypto"} The engine name
|
|
242
|
+
* @returns {Engine} The engine
|
|
243
|
+
* @public
|
|
244
|
+
*/
|
|
245
|
+
declare function getEngine(engine: "nativeMath" | "browserCrypto" | "nodeCrypto"): Engine;
|
|
246
|
+
declare function randomInt(min: number, max: number, engine?: Engine | null): number;
|
|
237
247
|
|
|
238
248
|
/**
|
|
239
249
|
* Verify if the provided dice work with random value
|
|
240
250
|
* @param testDice {string}
|
|
241
251
|
* @param allStats {Record<string,number>}
|
|
242
252
|
*/
|
|
243
|
-
declare function evalStatsDice(testDice: string, allStats?: Record<string, number
|
|
253
|
+
declare function evalStatsDice(testDice: string, allStats?: Record<string, number>, engine?: Engine | null): string;
|
|
244
254
|
/**
|
|
245
255
|
* Generate a random dice and remove the formula (+ evaluate it)
|
|
246
256
|
* Used for diceDamage only
|
|
@@ -248,13 +258,13 @@ declare function evalStatsDice(testDice: string, allStats?: Record<string, numbe
|
|
|
248
258
|
* @param template {StatisticalTemplate}
|
|
249
259
|
* @returns
|
|
250
260
|
*/
|
|
251
|
-
declare function diceRandomParse(value: string, template: StatisticalTemplate): string;
|
|
261
|
+
declare function diceRandomParse(value: string, template: StatisticalTemplate, engine?: Engine | null): string;
|
|
252
262
|
/**
|
|
253
263
|
* Same as damageDice but for DiceType
|
|
254
264
|
* @param dice {string}
|
|
255
265
|
* @param template {StatisticalTemplate}
|
|
256
266
|
*/
|
|
257
|
-
declare function diceTypeRandomParse(dice: string, template: StatisticalTemplate): string;
|
|
267
|
+
declare function diceTypeRandomParse(dice: string, template: StatisticalTemplate, engine?: Engine | null): string;
|
|
258
268
|
/**
|
|
259
269
|
* Random the combinaison and evaluate it to check if everything is valid
|
|
260
270
|
* @param combinaison {Record<string,string>}
|
|
@@ -273,17 +283,17 @@ declare function evalOneCombinaison(combinaison: string, stats: Record<string, n
|
|
|
273
283
|
* @param {boolean} verify - If true, will roll the dices to check if everything is valid
|
|
274
284
|
* @returns {StatisticalTemplate}
|
|
275
285
|
*/
|
|
276
|
-
declare function verifyTemplateValue(template: unknown, verify?: boolean): StatisticalTemplate;
|
|
286
|
+
declare function verifyTemplateValue(template: unknown, verify?: boolean, engine?: Engine | null): StatisticalTemplate;
|
|
277
287
|
/**
|
|
278
288
|
* Test each damage roll from the template.damage
|
|
279
289
|
* @param {StatisticalTemplate} template
|
|
280
290
|
*/
|
|
281
|
-
declare function testDiceRegistered(template: StatisticalTemplate): void;
|
|
291
|
+
declare function testDiceRegistered(template: StatisticalTemplate, engine?: Engine | null): void;
|
|
282
292
|
/**
|
|
283
293
|
* Test all combinaison with generated random value
|
|
284
294
|
* @param {StatisticalTemplate} template
|
|
285
295
|
*/
|
|
286
|
-
declare function testStatCombinaison(template: StatisticalTemplate): void;
|
|
296
|
+
declare function testStatCombinaison(template: StatisticalTemplate, engine?: Engine | null): void;
|
|
287
297
|
/**
|
|
288
298
|
* Generate a random stat based on the template and the statistical min and max
|
|
289
299
|
* @param {number|undefined} total
|
|
@@ -291,7 +301,7 @@ declare function testStatCombinaison(template: StatisticalTemplate): void;
|
|
|
291
301
|
* @param {number | undefined} min
|
|
292
302
|
* @returns
|
|
293
303
|
*/
|
|
294
|
-
declare function generateRandomStat(total?: number | undefined, max?: number, min?: number): number;
|
|
304
|
+
declare function generateRandomStat(total?: number | undefined, max?: number, min?: number, engine?: Engine | null): number;
|
|
295
305
|
|
|
296
306
|
declare class DiceTypeError extends Error {
|
|
297
307
|
readonly dice: string;
|
|
@@ -340,133 +350,40 @@ declare const DETECT_CRITICAL: RegExp;
|
|
|
340
350
|
|
|
341
351
|
declare const templateSchema: z.ZodObject<{
|
|
342
352
|
charName: z.ZodOptional<z.ZodBoolean>;
|
|
343
|
-
statistics: z.
|
|
344
|
-
max: z.ZodOptional<z.
|
|
345
|
-
min: z.ZodOptional<z.
|
|
346
|
-
combinaison: z.ZodOptional<z.
|
|
353
|
+
statistics: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
354
|
+
max: z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>;
|
|
355
|
+
min: z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>;
|
|
356
|
+
combinaison: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string | undefined, string>>>;
|
|
347
357
|
exclude: z.ZodOptional<z.ZodBoolean>;
|
|
348
|
-
},
|
|
349
|
-
|
|
350
|
-
max?: number | undefined;
|
|
351
|
-
combinaison?: string | undefined;
|
|
352
|
-
exclude?: boolean | undefined;
|
|
353
|
-
}, {
|
|
354
|
-
min?: number | undefined;
|
|
355
|
-
max?: number | undefined;
|
|
356
|
-
combinaison?: string | undefined;
|
|
357
|
-
exclude?: boolean | undefined;
|
|
358
|
-
}>, {
|
|
359
|
-
min?: number | undefined;
|
|
360
|
-
max?: number | undefined;
|
|
361
|
-
combinaison?: string | undefined;
|
|
362
|
-
exclude?: boolean | undefined;
|
|
363
|
-
}, {
|
|
364
|
-
min?: number | undefined;
|
|
365
|
-
max?: number | undefined;
|
|
366
|
-
combinaison?: string | undefined;
|
|
367
|
-
exclude?: boolean | undefined;
|
|
368
|
-
}>>>, Record<string, {
|
|
369
|
-
min?: number | undefined;
|
|
370
|
-
max?: number | undefined;
|
|
371
|
-
combinaison?: string | undefined;
|
|
372
|
-
exclude?: boolean | undefined;
|
|
373
|
-
}> | undefined, Record<string, {
|
|
374
|
-
min?: number | undefined;
|
|
375
|
-
max?: number | undefined;
|
|
376
|
-
combinaison?: string | undefined;
|
|
377
|
-
exclude?: boolean | undefined;
|
|
378
|
-
}> | undefined>;
|
|
379
|
-
total: z.ZodOptional<z.ZodEffects<z.ZodNumber, number | undefined, number>>;
|
|
358
|
+
}, z.core.$strip>>>;
|
|
359
|
+
total: z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>;
|
|
380
360
|
forceDistrib: z.ZodOptional<z.ZodBoolean>;
|
|
381
361
|
diceType: z.ZodOptional<z.ZodString>;
|
|
382
|
-
critical: z.ZodOptional<z.
|
|
362
|
+
critical: z.ZodOptional<z.ZodPipe<z.ZodObject<{
|
|
383
363
|
success: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
384
364
|
failure: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
385
|
-
},
|
|
386
|
-
success?: string | number | undefined;
|
|
387
|
-
failure?: string | number | undefined;
|
|
388
|
-
}, {
|
|
389
|
-
success?: string | number | undefined;
|
|
390
|
-
failure?: string | number | undefined;
|
|
391
|
-
}>, {
|
|
365
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
392
366
|
success?: string | number | undefined;
|
|
393
367
|
failure?: string | number | undefined;
|
|
394
368
|
}, {
|
|
395
369
|
success?: string | number | undefined;
|
|
396
370
|
failure?: string | number | undefined;
|
|
397
|
-
}
|
|
398
|
-
customCritical: z.
|
|
399
|
-
sign: z.ZodEnum<
|
|
371
|
+
}>>>;
|
|
372
|
+
customCritical: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
373
|
+
sign: z.ZodEnum<{
|
|
374
|
+
">=": ">=";
|
|
375
|
+
"<=": "<=";
|
|
376
|
+
"<": "<";
|
|
377
|
+
">": ">";
|
|
378
|
+
"!=": "!=";
|
|
379
|
+
"==": "==";
|
|
380
|
+
}>;
|
|
400
381
|
value: z.ZodString;
|
|
401
382
|
onNaturalDice: z.ZodOptional<z.ZodBoolean>;
|
|
402
383
|
affectSkill: z.ZodOptional<z.ZodBoolean>;
|
|
403
|
-
},
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
onNaturalDice?: boolean | undefined;
|
|
407
|
-
affectSkill?: boolean | undefined;
|
|
408
|
-
}, {
|
|
409
|
-
value: string;
|
|
410
|
-
sign: ">=" | "<=" | "<" | ">" | "!=" | "==";
|
|
411
|
-
onNaturalDice?: boolean | undefined;
|
|
412
|
-
affectSkill?: boolean | undefined;
|
|
413
|
-
}>>>, Record<string, {
|
|
414
|
-
value: string;
|
|
415
|
-
sign: ">=" | "<=" | "<" | ">" | "!=" | "==";
|
|
416
|
-
onNaturalDice?: boolean | undefined;
|
|
417
|
-
affectSkill?: boolean | undefined;
|
|
418
|
-
}> | undefined, Record<string, {
|
|
419
|
-
value: string;
|
|
420
|
-
sign: ">=" | "<=" | "<" | ">" | "!=" | "==";
|
|
421
|
-
onNaturalDice?: boolean | undefined;
|
|
422
|
-
affectSkill?: boolean | undefined;
|
|
423
|
-
}> | undefined>;
|
|
424
|
-
damage: z.ZodEffects<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>, Record<string, string> | undefined, Record<string, string> | undefined>;
|
|
425
|
-
}, "strip", z.ZodTypeAny, {
|
|
426
|
-
total?: number | undefined;
|
|
427
|
-
charName?: boolean | undefined;
|
|
428
|
-
statistics?: Record<string, {
|
|
429
|
-
min?: number | undefined;
|
|
430
|
-
max?: number | undefined;
|
|
431
|
-
combinaison?: string | undefined;
|
|
432
|
-
exclude?: boolean | undefined;
|
|
433
|
-
}> | undefined;
|
|
434
|
-
forceDistrib?: boolean | undefined;
|
|
435
|
-
diceType?: string | undefined;
|
|
436
|
-
critical?: {
|
|
437
|
-
success?: string | number | undefined;
|
|
438
|
-
failure?: string | number | undefined;
|
|
439
|
-
} | undefined;
|
|
440
|
-
customCritical?: Record<string, {
|
|
441
|
-
value: string;
|
|
442
|
-
sign: ">=" | "<=" | "<" | ">" | "!=" | "==";
|
|
443
|
-
onNaturalDice?: boolean | undefined;
|
|
444
|
-
affectSkill?: boolean | undefined;
|
|
445
|
-
}> | undefined;
|
|
446
|
-
damage?: Record<string, string> | undefined;
|
|
447
|
-
}, {
|
|
448
|
-
total?: number | undefined;
|
|
449
|
-
charName?: boolean | undefined;
|
|
450
|
-
statistics?: Record<string, {
|
|
451
|
-
min?: number | undefined;
|
|
452
|
-
max?: number | undefined;
|
|
453
|
-
combinaison?: string | undefined;
|
|
454
|
-
exclude?: boolean | undefined;
|
|
455
|
-
}> | undefined;
|
|
456
|
-
forceDistrib?: boolean | undefined;
|
|
457
|
-
diceType?: string | undefined;
|
|
458
|
-
critical?: {
|
|
459
|
-
success?: string | number | undefined;
|
|
460
|
-
failure?: string | number | undefined;
|
|
461
|
-
} | undefined;
|
|
462
|
-
customCritical?: Record<string, {
|
|
463
|
-
value: string;
|
|
464
|
-
sign: ">=" | "<=" | "<" | ">" | "!=" | "==";
|
|
465
|
-
onNaturalDice?: boolean | undefined;
|
|
466
|
-
affectSkill?: boolean | undefined;
|
|
467
|
-
}> | undefined;
|
|
468
|
-
damage?: Record<string, string> | undefined;
|
|
469
|
-
}>;
|
|
384
|
+
}, z.core.$strip>>>;
|
|
385
|
+
damage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
386
|
+
}, z.core.$strip>;
|
|
470
387
|
|
|
471
388
|
interface StatisticalSchema extends StatisticalTemplate {
|
|
472
389
|
/**
|
|
@@ -476,4 +393,4 @@ interface StatisticalSchema extends StatisticalTemplate {
|
|
|
476
393
|
$schema?: string;
|
|
477
394
|
}
|
|
478
395
|
|
|
479
|
-
export { COMMENT_REGEX, type Compare, type ComparedValue, type Critical, type CustomCritical, type CustomCriticalMap, DETECT_CRITICAL, DiceTypeError, EmptyObjectError, FormulaError, MaxGreater, type Modifier, NoStatisticsError, type Resultat, SIGN_REGEX, SIGN_REGEX_SPACE, SYMBOL_DICE, type Sign, type Statistic, type StatisticalSchema, type StatisticalTemplate, TooManyDice, TooManyStats, calculator, createCriticalCustom, diceRandomParse, diceTypeRandomParse, escapeRegex, evalCombinaison, evalOneCombinaison, evalStatsDice, generateRandomStat, generateStatsDice, isNumber, replaceExpByRandom, replaceFormulaInDice, roll, standardizeDice, templateSchema, testDiceRegistered, testStatCombinaison, verifyTemplateValue };
|
|
396
|
+
export { COMMENT_REGEX, type Compare, type ComparedValue, type Critical, type CustomCritical, type CustomCriticalMap, DETECT_CRITICAL, DiceTypeError, EmptyObjectError, FormulaError, MaxGreater, type Modifier, NoStatisticsError, type Resultat, SIGN_REGEX, SIGN_REGEX_SPACE, SYMBOL_DICE, type Sign, type Statistic, type StatisticalSchema, type StatisticalTemplate, TooManyDice, TooManyStats, calculator, createCriticalCustom, diceRandomParse, diceTypeRandomParse, escapeRegex, evalCombinaison, evalOneCombinaison, evalStatsDice, generateRandomStat, generateStatsDice, getEngine, isNumber, randomInt, replaceExpByRandom, replaceFormulaInDice, roll, standardizeDice, templateSchema, testDiceRegistered, testStatCombinaison, verifyTemplateValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Engine } from 'random-js';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -8,12 +9,12 @@ import { z } from 'zod';
|
|
|
8
9
|
* Random stats = 6
|
|
9
10
|
* result = "1d20>3"
|
|
10
11
|
*/
|
|
11
|
-
declare function createCriticalCustom(dice: string, customCritical: CustomCritical, template: StatisticalTemplate): string;
|
|
12
|
+
declare function createCriticalCustom(dice: string, customCritical: CustomCritical, template: StatisticalTemplate, engine?: Engine | null): string;
|
|
12
13
|
/**
|
|
13
14
|
* Parse the string provided and turn it as a readable dice for dice parser
|
|
14
15
|
* @param dice {string}
|
|
15
16
|
*/
|
|
16
|
-
declare function roll(dice: string): Resultat | undefined;
|
|
17
|
+
declare function roll(dice: string, engine?: Engine | null): Resultat | undefined;
|
|
17
18
|
/**
|
|
18
19
|
* Evaluate a formula and replace "^" by "**" if any
|
|
19
20
|
* @param {Sign} sign
|
|
@@ -231,16 +232,25 @@ declare function isNumber(value: unknown): boolean;
|
|
|
231
232
|
* Replace the `{exp}` in the dice.
|
|
232
233
|
* If the `{exp}` has a default value in the form of `{exp || defaultValue}`, it will be replaced by the default value.
|
|
233
234
|
* @param {string} dice
|
|
235
|
+
* @param engine
|
|
234
236
|
* @returns {string} the dice with the {exp} replaced by a random value
|
|
235
237
|
*/
|
|
236
|
-
declare function replaceExpByRandom(dice: string): string;
|
|
238
|
+
declare function replaceExpByRandom(dice: string, engine?: Engine | null): string;
|
|
239
|
+
/**
|
|
240
|
+
* Utility function to get the engine from its name
|
|
241
|
+
* @param engine {"nativeMath" | "browserCrypto" | "nodeCrypto"} The engine name
|
|
242
|
+
* @returns {Engine} The engine
|
|
243
|
+
* @public
|
|
244
|
+
*/
|
|
245
|
+
declare function getEngine(engine: "nativeMath" | "browserCrypto" | "nodeCrypto"): Engine;
|
|
246
|
+
declare function randomInt(min: number, max: number, engine?: Engine | null): number;
|
|
237
247
|
|
|
238
248
|
/**
|
|
239
249
|
* Verify if the provided dice work with random value
|
|
240
250
|
* @param testDice {string}
|
|
241
251
|
* @param allStats {Record<string,number>}
|
|
242
252
|
*/
|
|
243
|
-
declare function evalStatsDice(testDice: string, allStats?: Record<string, number
|
|
253
|
+
declare function evalStatsDice(testDice: string, allStats?: Record<string, number>, engine?: Engine | null): string;
|
|
244
254
|
/**
|
|
245
255
|
* Generate a random dice and remove the formula (+ evaluate it)
|
|
246
256
|
* Used for diceDamage only
|
|
@@ -248,13 +258,13 @@ declare function evalStatsDice(testDice: string, allStats?: Record<string, numbe
|
|
|
248
258
|
* @param template {StatisticalTemplate}
|
|
249
259
|
* @returns
|
|
250
260
|
*/
|
|
251
|
-
declare function diceRandomParse(value: string, template: StatisticalTemplate): string;
|
|
261
|
+
declare function diceRandomParse(value: string, template: StatisticalTemplate, engine?: Engine | null): string;
|
|
252
262
|
/**
|
|
253
263
|
* Same as damageDice but for DiceType
|
|
254
264
|
* @param dice {string}
|
|
255
265
|
* @param template {StatisticalTemplate}
|
|
256
266
|
*/
|
|
257
|
-
declare function diceTypeRandomParse(dice: string, template: StatisticalTemplate): string;
|
|
267
|
+
declare function diceTypeRandomParse(dice: string, template: StatisticalTemplate, engine?: Engine | null): string;
|
|
258
268
|
/**
|
|
259
269
|
* Random the combinaison and evaluate it to check if everything is valid
|
|
260
270
|
* @param combinaison {Record<string,string>}
|
|
@@ -273,17 +283,17 @@ declare function evalOneCombinaison(combinaison: string, stats: Record<string, n
|
|
|
273
283
|
* @param {boolean} verify - If true, will roll the dices to check if everything is valid
|
|
274
284
|
* @returns {StatisticalTemplate}
|
|
275
285
|
*/
|
|
276
|
-
declare function verifyTemplateValue(template: unknown, verify?: boolean): StatisticalTemplate;
|
|
286
|
+
declare function verifyTemplateValue(template: unknown, verify?: boolean, engine?: Engine | null): StatisticalTemplate;
|
|
277
287
|
/**
|
|
278
288
|
* Test each damage roll from the template.damage
|
|
279
289
|
* @param {StatisticalTemplate} template
|
|
280
290
|
*/
|
|
281
|
-
declare function testDiceRegistered(template: StatisticalTemplate): void;
|
|
291
|
+
declare function testDiceRegistered(template: StatisticalTemplate, engine?: Engine | null): void;
|
|
282
292
|
/**
|
|
283
293
|
* Test all combinaison with generated random value
|
|
284
294
|
* @param {StatisticalTemplate} template
|
|
285
295
|
*/
|
|
286
|
-
declare function testStatCombinaison(template: StatisticalTemplate): void;
|
|
296
|
+
declare function testStatCombinaison(template: StatisticalTemplate, engine?: Engine | null): void;
|
|
287
297
|
/**
|
|
288
298
|
* Generate a random stat based on the template and the statistical min and max
|
|
289
299
|
* @param {number|undefined} total
|
|
@@ -291,7 +301,7 @@ declare function testStatCombinaison(template: StatisticalTemplate): void;
|
|
|
291
301
|
* @param {number | undefined} min
|
|
292
302
|
* @returns
|
|
293
303
|
*/
|
|
294
|
-
declare function generateRandomStat(total?: number | undefined, max?: number, min?: number): number;
|
|
304
|
+
declare function generateRandomStat(total?: number | undefined, max?: number, min?: number, engine?: Engine | null): number;
|
|
295
305
|
|
|
296
306
|
declare class DiceTypeError extends Error {
|
|
297
307
|
readonly dice: string;
|
|
@@ -340,133 +350,40 @@ declare const DETECT_CRITICAL: RegExp;
|
|
|
340
350
|
|
|
341
351
|
declare const templateSchema: z.ZodObject<{
|
|
342
352
|
charName: z.ZodOptional<z.ZodBoolean>;
|
|
343
|
-
statistics: z.
|
|
344
|
-
max: z.ZodOptional<z.
|
|
345
|
-
min: z.ZodOptional<z.
|
|
346
|
-
combinaison: z.ZodOptional<z.
|
|
353
|
+
statistics: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
354
|
+
max: z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>;
|
|
355
|
+
min: z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>;
|
|
356
|
+
combinaison: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string | undefined, string>>>;
|
|
347
357
|
exclude: z.ZodOptional<z.ZodBoolean>;
|
|
348
|
-
},
|
|
349
|
-
|
|
350
|
-
max?: number | undefined;
|
|
351
|
-
combinaison?: string | undefined;
|
|
352
|
-
exclude?: boolean | undefined;
|
|
353
|
-
}, {
|
|
354
|
-
min?: number | undefined;
|
|
355
|
-
max?: number | undefined;
|
|
356
|
-
combinaison?: string | undefined;
|
|
357
|
-
exclude?: boolean | undefined;
|
|
358
|
-
}>, {
|
|
359
|
-
min?: number | undefined;
|
|
360
|
-
max?: number | undefined;
|
|
361
|
-
combinaison?: string | undefined;
|
|
362
|
-
exclude?: boolean | undefined;
|
|
363
|
-
}, {
|
|
364
|
-
min?: number | undefined;
|
|
365
|
-
max?: number | undefined;
|
|
366
|
-
combinaison?: string | undefined;
|
|
367
|
-
exclude?: boolean | undefined;
|
|
368
|
-
}>>>, Record<string, {
|
|
369
|
-
min?: number | undefined;
|
|
370
|
-
max?: number | undefined;
|
|
371
|
-
combinaison?: string | undefined;
|
|
372
|
-
exclude?: boolean | undefined;
|
|
373
|
-
}> | undefined, Record<string, {
|
|
374
|
-
min?: number | undefined;
|
|
375
|
-
max?: number | undefined;
|
|
376
|
-
combinaison?: string | undefined;
|
|
377
|
-
exclude?: boolean | undefined;
|
|
378
|
-
}> | undefined>;
|
|
379
|
-
total: z.ZodOptional<z.ZodEffects<z.ZodNumber, number | undefined, number>>;
|
|
358
|
+
}, z.core.$strip>>>;
|
|
359
|
+
total: z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>;
|
|
380
360
|
forceDistrib: z.ZodOptional<z.ZodBoolean>;
|
|
381
361
|
diceType: z.ZodOptional<z.ZodString>;
|
|
382
|
-
critical: z.ZodOptional<z.
|
|
362
|
+
critical: z.ZodOptional<z.ZodPipe<z.ZodObject<{
|
|
383
363
|
success: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
384
364
|
failure: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
385
|
-
},
|
|
386
|
-
success?: string | number | undefined;
|
|
387
|
-
failure?: string | number | undefined;
|
|
388
|
-
}, {
|
|
389
|
-
success?: string | number | undefined;
|
|
390
|
-
failure?: string | number | undefined;
|
|
391
|
-
}>, {
|
|
365
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
392
366
|
success?: string | number | undefined;
|
|
393
367
|
failure?: string | number | undefined;
|
|
394
368
|
}, {
|
|
395
369
|
success?: string | number | undefined;
|
|
396
370
|
failure?: string | number | undefined;
|
|
397
|
-
}
|
|
398
|
-
customCritical: z.
|
|
399
|
-
sign: z.ZodEnum<
|
|
371
|
+
}>>>;
|
|
372
|
+
customCritical: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
373
|
+
sign: z.ZodEnum<{
|
|
374
|
+
">=": ">=";
|
|
375
|
+
"<=": "<=";
|
|
376
|
+
"<": "<";
|
|
377
|
+
">": ">";
|
|
378
|
+
"!=": "!=";
|
|
379
|
+
"==": "==";
|
|
380
|
+
}>;
|
|
400
381
|
value: z.ZodString;
|
|
401
382
|
onNaturalDice: z.ZodOptional<z.ZodBoolean>;
|
|
402
383
|
affectSkill: z.ZodOptional<z.ZodBoolean>;
|
|
403
|
-
},
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
onNaturalDice?: boolean | undefined;
|
|
407
|
-
affectSkill?: boolean | undefined;
|
|
408
|
-
}, {
|
|
409
|
-
value: string;
|
|
410
|
-
sign: ">=" | "<=" | "<" | ">" | "!=" | "==";
|
|
411
|
-
onNaturalDice?: boolean | undefined;
|
|
412
|
-
affectSkill?: boolean | undefined;
|
|
413
|
-
}>>>, Record<string, {
|
|
414
|
-
value: string;
|
|
415
|
-
sign: ">=" | "<=" | "<" | ">" | "!=" | "==";
|
|
416
|
-
onNaturalDice?: boolean | undefined;
|
|
417
|
-
affectSkill?: boolean | undefined;
|
|
418
|
-
}> | undefined, Record<string, {
|
|
419
|
-
value: string;
|
|
420
|
-
sign: ">=" | "<=" | "<" | ">" | "!=" | "==";
|
|
421
|
-
onNaturalDice?: boolean | undefined;
|
|
422
|
-
affectSkill?: boolean | undefined;
|
|
423
|
-
}> | undefined>;
|
|
424
|
-
damage: z.ZodEffects<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>, Record<string, string> | undefined, Record<string, string> | undefined>;
|
|
425
|
-
}, "strip", z.ZodTypeAny, {
|
|
426
|
-
total?: number | undefined;
|
|
427
|
-
charName?: boolean | undefined;
|
|
428
|
-
statistics?: Record<string, {
|
|
429
|
-
min?: number | undefined;
|
|
430
|
-
max?: number | undefined;
|
|
431
|
-
combinaison?: string | undefined;
|
|
432
|
-
exclude?: boolean | undefined;
|
|
433
|
-
}> | undefined;
|
|
434
|
-
forceDistrib?: boolean | undefined;
|
|
435
|
-
diceType?: string | undefined;
|
|
436
|
-
critical?: {
|
|
437
|
-
success?: string | number | undefined;
|
|
438
|
-
failure?: string | number | undefined;
|
|
439
|
-
} | undefined;
|
|
440
|
-
customCritical?: Record<string, {
|
|
441
|
-
value: string;
|
|
442
|
-
sign: ">=" | "<=" | "<" | ">" | "!=" | "==";
|
|
443
|
-
onNaturalDice?: boolean | undefined;
|
|
444
|
-
affectSkill?: boolean | undefined;
|
|
445
|
-
}> | undefined;
|
|
446
|
-
damage?: Record<string, string> | undefined;
|
|
447
|
-
}, {
|
|
448
|
-
total?: number | undefined;
|
|
449
|
-
charName?: boolean | undefined;
|
|
450
|
-
statistics?: Record<string, {
|
|
451
|
-
min?: number | undefined;
|
|
452
|
-
max?: number | undefined;
|
|
453
|
-
combinaison?: string | undefined;
|
|
454
|
-
exclude?: boolean | undefined;
|
|
455
|
-
}> | undefined;
|
|
456
|
-
forceDistrib?: boolean | undefined;
|
|
457
|
-
diceType?: string | undefined;
|
|
458
|
-
critical?: {
|
|
459
|
-
success?: string | number | undefined;
|
|
460
|
-
failure?: string | number | undefined;
|
|
461
|
-
} | undefined;
|
|
462
|
-
customCritical?: Record<string, {
|
|
463
|
-
value: string;
|
|
464
|
-
sign: ">=" | "<=" | "<" | ">" | "!=" | "==";
|
|
465
|
-
onNaturalDice?: boolean | undefined;
|
|
466
|
-
affectSkill?: boolean | undefined;
|
|
467
|
-
}> | undefined;
|
|
468
|
-
damage?: Record<string, string> | undefined;
|
|
469
|
-
}>;
|
|
384
|
+
}, z.core.$strip>>>;
|
|
385
|
+
damage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
386
|
+
}, z.core.$strip>;
|
|
470
387
|
|
|
471
388
|
interface StatisticalSchema extends StatisticalTemplate {
|
|
472
389
|
/**
|
|
@@ -476,4 +393,4 @@ interface StatisticalSchema extends StatisticalTemplate {
|
|
|
476
393
|
$schema?: string;
|
|
477
394
|
}
|
|
478
395
|
|
|
479
|
-
export { COMMENT_REGEX, type Compare, type ComparedValue, type Critical, type CustomCritical, type CustomCriticalMap, DETECT_CRITICAL, DiceTypeError, EmptyObjectError, FormulaError, MaxGreater, type Modifier, NoStatisticsError, type Resultat, SIGN_REGEX, SIGN_REGEX_SPACE, SYMBOL_DICE, type Sign, type Statistic, type StatisticalSchema, type StatisticalTemplate, TooManyDice, TooManyStats, calculator, createCriticalCustom, diceRandomParse, diceTypeRandomParse, escapeRegex, evalCombinaison, evalOneCombinaison, evalStatsDice, generateRandomStat, generateStatsDice, isNumber, replaceExpByRandom, replaceFormulaInDice, roll, standardizeDice, templateSchema, testDiceRegistered, testStatCombinaison, verifyTemplateValue };
|
|
396
|
+
export { COMMENT_REGEX, type Compare, type ComparedValue, type Critical, type CustomCritical, type CustomCriticalMap, DETECT_CRITICAL, DiceTypeError, EmptyObjectError, FormulaError, MaxGreater, type Modifier, NoStatisticsError, type Resultat, SIGN_REGEX, SIGN_REGEX_SPACE, SYMBOL_DICE, type Sign, type Statistic, type StatisticalSchema, type StatisticalTemplate, TooManyDice, TooManyStats, calculator, createCriticalCustom, diceRandomParse, diceTypeRandomParse, escapeRegex, evalCombinaison, evalOneCombinaison, evalStatsDice, generateRandomStat, generateStatsDice, getEngine, isNumber, randomInt, replaceExpByRandom, replaceFormulaInDice, roll, standardizeDice, templateSchema, testDiceRegistered, testStatCombinaison, verifyTemplateValue };
|