@platonic-dice/core 2.2.2 → 3.0.2
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 +12 -15
- 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
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates an outcome map for all possible base rolls given the configuration.
|
|
3
|
-
* Uses memoization cache for performance.
|
|
4
|
-
*
|
|
5
|
-
* @param {import("../entities/DieType").DieTypeValue} dieType - The type of die
|
|
6
|
-
* @param {import("../entities/TestType").TestTypeValue} testType - The type of test being performed
|
|
7
|
-
* @param {import("../entities/TestConditions").TestConditionsInstance} testConditions - The test conditions
|
|
8
|
-
* @param {import("../entities/RollModifier").RollModifierInstance|null} modifier - Optional modifier to apply
|
|
9
|
-
* @param {boolean|null} useNaturalCrits - Whether to use natural crits (null = auto-determine)
|
|
10
|
-
* @returns {Object.<number, import("../entities/Outcome").OutcomeValue>} Map of baseRoll -> outcome
|
|
11
|
-
*/
|
|
12
|
-
export function createOutcomeMap(dieType: import("../entities/DieType").DieTypeValue, testType: import("../entities/TestType").TestTypeValue, testConditions: import("../entities/TestConditions").TestConditionsInstance, modifier?: import("../entities/RollModifier").RollModifierInstance | null, useNaturalCrits?: boolean | null): {
|
|
13
|
-
[x: number]: import("../entities").OutcomeValue;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Clears the outcome map cache.
|
|
17
|
-
* Useful for testing or memory management.
|
|
18
|
-
*
|
|
19
|
-
* @function clearOutcomeMapCache
|
|
20
|
-
*/
|
|
21
|
-
export function clearOutcomeMapCache(): void;
|
|
22
|
-
/**
|
|
23
|
-
* Gets the current size of the outcome map cache.
|
|
24
|
-
*
|
|
25
|
-
* @function getOutcomeMapCacheSize
|
|
26
|
-
* @returns {number}
|
|
27
|
-
*/
|
|
28
|
-
export function getOutcomeMapCacheSize(): number;
|
|
29
|
-
//# sourceMappingURL=outcomeMapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"outcomeMapper.d.ts","sourceRoot":"","sources":["../../src/utils/outcomeMapper.js"],"names":[],"mappings":"AAsGA;;;;;;;;;;GAUG;AACH,0CAPW,OAAO,qBAAqB,EAAE,YAAY,YAC1C,OAAO,sBAAsB,EAAE,aAAa,kBAC5C,OAAO,4BAA4B,EAAE,sBAAsB,aAC3D,OAAO,0BAA0B,EAAE,oBAAoB,GAAC,IAAI,oBAC5D,OAAO,GAAC,IAAI;;EA4DtB;AAED;;;;;GAKG;AACH,6CAEC;AAED;;;;;GAKG;AACH,0CAFa,MAAM,CAIlB"}
|
package/dist-types.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// Convenience type re-exports for consumers. This file points at the generated
|
|
2
|
-
// declaration files in `dist/entities` so TypeScript users can import type
|
|
3
|
-
// aliases directly from the package root via the `types` field.
|
|
4
|
-
|
|
5
|
-
export type {
|
|
6
|
-
RollModifierFunction,
|
|
7
|
-
RollModifierInstance,
|
|
8
|
-
} from "./dist/entities/RollModifier";
|
|
9
|
-
export type { OutcomeValue } from "./dist/entities/Outcome";
|
|
10
|
-
export type { TestConditionsInstance } from "./dist/entities/TestConditions";
|
|
11
|
-
export type { RollTypeValue } from "./dist/entities/RollType";
|
|
12
|
-
export type { TestTypeValue } from "./dist/entities/TestType";
|
|
13
|
-
export type { DieTypeValue } from "./dist/entities/DieType";
|
|
14
|
-
|
|
15
|
-
// Re-export other commonly used entity types
|
|
16
|
-
export * from "./dist/entities/index";
|
|
17
|
-
|
|
18
|
-
// Re-export top-level runtime APIs (roll helpers) so consumers can import
|
|
19
|
-
// functions like `roll`, `rollMod`, and `rollTest` from the package root.
|
|
20
|
-
export * from "./dist/roll";
|
|
21
|
-
export * from "./dist/rollMod";
|
|
22
|
-
export * from "./dist/rollDice";
|
|
23
|
-
export * from "./dist/rollDiceMod";
|
|
24
|
-
export * from "./dist/rollTest";
|
|
25
|
-
export * from "./dist/rollModTest";
|
|
26
|
-
export * from "./dist/analyseTest";
|
|
27
|
-
export * from "./dist/analyseModTest";
|
|
28
|
-
|
|
29
|
-
// The `rollMod`/`rollTest`/`rollModTest` d.ts files are emitted using a CommonJS `export =`
|
|
30
|
-
// shape which doesn't always expose named exports for consumers under some
|
|
31
|
-
// moduleResolution strategies. Provide explicit ESM-style type declarations
|
|
32
|
-
// here so TypeScript imports like `import { rollMod } from '@platonic-dice/core'`
|
|
33
|
-
// resolve correctly.
|
|
34
|
-
export function rollMod(
|
|
35
|
-
dieType: import("./dist/entities/DieType").DieTypeValue,
|
|
36
|
-
modifier:
|
|
37
|
-
| import("./dist/entities/RollModifier").RollModifierFunction
|
|
38
|
-
| import("./dist/entities/RollModifier").RollModifierInstance,
|
|
39
|
-
rollType?: import("./dist/entities/RollType").RollTypeValue
|
|
40
|
-
): { base: number; modified: number };
|
|
41
|
-
|
|
42
|
-
export function rollTest(
|
|
43
|
-
dieType: import("./dist/entities/DieType").DieTypeValue,
|
|
44
|
-
testConditions:
|
|
45
|
-
| import("./dist/entities/TestConditions").TestConditionsInstance
|
|
46
|
-
| {
|
|
47
|
-
testType: import("./dist/entities/TestType").TestTypeValue;
|
|
48
|
-
[k: string]: any;
|
|
49
|
-
},
|
|
50
|
-
rollType?: import("./dist/entities/RollType").RollTypeValue
|
|
51
|
-
): { base: number; outcome: import("./dist/entities/Outcome").OutcomeValue };
|
|
52
|
-
|
|
53
|
-
export function rollModTest(
|
|
54
|
-
dieType: import("./dist/entities/DieType").DieTypeValue,
|
|
55
|
-
modifier:
|
|
56
|
-
| import("./dist/entities/RollModifier").RollModifierFunction
|
|
57
|
-
| import("./dist/entities/RollModifier").RollModifierInstance,
|
|
58
|
-
testConditions:
|
|
59
|
-
| import("./dist/entities/TestConditions").TestConditionsInstance
|
|
60
|
-
| {
|
|
61
|
-
testType: import("./dist/entities/TestType").TestTypeValue;
|
|
62
|
-
[k: string]: any;
|
|
63
|
-
},
|
|
64
|
-
rollType?: import("./dist/entities/RollType").RollTypeValue,
|
|
65
|
-
options?: { useNaturalCrits?: boolean }
|
|
66
|
-
): {
|
|
67
|
-
base: number;
|
|
68
|
-
modified: number;
|
|
69
|
-
outcome: import("./dist/entities/Outcome").OutcomeValue;
|
|
70
|
-
};
|