@yipe/dice 0.11.0 → 0.12.1
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 +282 -8
- package/dist/builder/ac.d.ts +44 -1
- package/dist/builder/ac.d.ts.map +1 -1
- package/dist/builder/arguments.d.ts +6 -0
- package/dist/builder/arguments.d.ts.map +1 -0
- package/dist/builder/ast.d.ts +36 -7
- package/dist/builder/ast.d.ts.map +1 -1
- package/dist/builder/attack.d.ts +88 -5
- package/dist/builder/attack.d.ts.map +1 -1
- package/dist/builder/dc.d.ts +13 -0
- package/dist/builder/dc.d.ts.map +1 -1
- package/dist/builder/example.d.ts +11 -15
- package/dist/builder/example.d.ts.map +1 -1
- package/dist/builder/expression.d.ts +72 -0
- package/dist/builder/expression.d.ts.map +1 -0
- package/dist/builder/factory.d.ts +2 -3
- package/dist/builder/factory.d.ts.map +1 -1
- package/dist/builder/index.cjs +3657 -1373
- package/dist/builder/index.cjs.map +1 -1
- package/dist/builder/index.js +3650 -1374
- package/dist/builder/index.js.map +1 -1
- package/dist/builder/nodes.d.ts +7 -1
- package/dist/builder/nodes.d.ts.map +1 -1
- package/dist/builder/prob.d.ts +9 -0
- package/dist/builder/prob.d.ts.map +1 -1
- package/dist/builder/roll.d.ts +151 -21
- package/dist/builder/roll.d.ts.map +1 -1
- package/dist/builder/save.d.ts +6 -1
- package/dist/builder/save.d.ts.map +1 -1
- package/dist/builder/types.d.ts +18 -0
- package/dist/builder/types.d.ts.map +1 -1
- package/dist/common/bounce.d.ts +24 -11
- package/dist/common/bounce.d.ts.map +1 -1
- package/dist/common/lru-cache.d.ts +29 -1
- package/dist/common/lru-cache.d.ts.map +1 -1
- package/dist/index.cjs +1219 -421
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1219 -421
- package/dist/index.js.map +1 -1
- package/dist/parser/dice.d.ts +59 -16
- package/dist/parser/dice.d.ts.map +1 -1
- package/dist/parser/parser.d.ts +1 -5
- package/dist/parser/parser.d.ts.map +1 -1
- package/dist/parser/rollType.d.ts +4 -4
- package/dist/parser/scaleDice.d.ts +14 -0
- package/dist/parser/scaleDice.d.ts.map +1 -0
- package/dist/pmf/mixture.d.ts +17 -3
- package/dist/pmf/mixture.d.ts.map +1 -1
- package/dist/pmf/pmf.d.ts +118 -33
- package/dist/pmf/pmf.d.ts.map +1 -1
- package/dist/pmf/query.d.ts +25 -12
- package/dist/pmf/query.d.ts.map +1 -1
- package/dist/turn/effects.d.ts +114 -0
- package/dist/turn/effects.d.ts.map +1 -0
- package/dist/turn/index.d.ts +3 -1
- package/dist/turn/index.d.ts.map +1 -1
- package/dist/turn/plan.d.ts +101 -21
- package/dist/turn/plan.d.ts.map +1 -1
- package/dist/turn/state.d.ts +14 -8
- package/dist/turn/state.d.ts.map +1 -1
- package/dist/turn/turn.d.ts +127 -26
- package/dist/turn/turn.d.ts.map +1 -1
- package/dist/turn/types.d.ts +154 -17
- package/dist/turn/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/parser/dice.d.ts
CHANGED
|
@@ -6,22 +6,52 @@ export interface DicePrivateData {
|
|
|
6
6
|
isDCCheck?: boolean;
|
|
7
7
|
/** The "other" distribution recorded by {@link Dice.combine}. */
|
|
8
8
|
except?: Dice | Record<string, never>;
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* and modifiers, for a correct plain-`crit` probability. See parser.ts's "Track a flat ...
|
|
15
|
-
* base check die" comment. */
|
|
16
|
-
checkDie?: {
|
|
17
|
-
sides: number;
|
|
18
|
-
rerollOne: boolean;
|
|
9
|
+
/** Set by a keep (`4kh3`, `2kl1`) on the dice it keeps from: how many of the repeated copies are
|
|
10
|
+
* kept, and whether the lowest or the highest. A keep of one (`2kh1d20`) keeps a single natural roll. */
|
|
11
|
+
keep?: {
|
|
12
|
+
kept: number;
|
|
13
|
+
lowest: boolean;
|
|
19
14
|
};
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
|
|
15
|
+
/** The natural roll of an attack check, followed through every op applied to it, so a crit is the
|
|
16
|
+
* natural-max event (or an `xcrit` range of natural faces) at any bonus roll. It is the check's one
|
|
17
|
+
* d20 wherever it sits in the sum, or with no d20 its largest die; other dice are bonus dice. Read
|
|
18
|
+
* and written by {@link parseExpression} in parser.ts; set on every freshly parsed `dN`/`hdN` atom. */
|
|
19
|
+
critTrack?: CritTrack;
|
|
20
|
+
/** Set instead of {@link critTrack} on a value whose natural die has no single natural roll to
|
|
21
|
+
* follow (`2d20`, `d20 + d20`, `(d20 + 1d4)!`, a bonus pool like `2d4`): that die's size, so a
|
|
22
|
+
* die it outranks never passes for the natural roll. Read and written by parser.ts. */
|
|
23
|
+
untrackedSides?: number;
|
|
24
|
+
/** Set on a value built from numbers alone, with no die anywhere in it but an AC or DC target. As an
|
|
25
|
+
* attack check it has no natural roll, so its crit mass is exactly 0. Read and written by parser.ts. */
|
|
26
|
+
noDie?: true;
|
|
27
|
+
/** The operands of an `&` mix, each carried through every op since with its own natural roll, so the
|
|
28
|
+
* mix crits where a branch does, at that branch's share. Read and written by parser.ts. */
|
|
29
|
+
branches?: readonly Dice[];
|
|
30
|
+
/** Set on the result of an `AC` gate: a following `*` is an attack's hit payload, which crits
|
|
31
|
+
* even with no crit clause. Read by {@link parseExpression} in parser.ts. */
|
|
32
|
+
isACCheck?: boolean;
|
|
33
|
+
/** Set on an attack whose crit is its hit payload doubled (no crit clause): the payload's
|
|
34
|
+
* text, so a trailing hit-only term joins the payload and doubles with it. See parser.ts. */
|
|
35
|
+
implicitCrit?: {
|
|
36
|
+
payload: string;
|
|
37
|
+
};
|
|
38
|
+
/** Set on an attack's payload: the result of an AC check's `*`, and of each hit-only term after it.
|
|
39
|
+
* A landed hit that deals 0 there is recorded under `hit` at 0, where the misses also sit, as an AC
|
|
40
|
+
* check's landed total of exactly 0 is (see {@link Dice.ac}). A later hit-only term treats it as
|
|
41
|
+
* the hit it is (see {@link Dice.calculateHitDistribution}). Read and written by parser.ts. */
|
|
42
|
+
attackPayload?: true;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* An attack check's natural roll. `slice(f)` is the check's share where the kept natural roll is f,
|
|
46
|
+
* in the check's own counts: every op after the natural die acts face by face, so replaying the
|
|
47
|
+
* ops on face f's weight gives exactly that share, and a mix of checks adds its branches' shares.
|
|
48
|
+
*/
|
|
49
|
+
export interface CritTrack {
|
|
50
|
+
/** The natural die's size. */
|
|
51
|
+
readonly sides: number;
|
|
52
|
+
/** The check is its natural roll itself, with no op since (`d20`, `2kh1d20`, `d20 > d20`, `d20 & d20`). */
|
|
53
|
+
readonly bare: boolean;
|
|
54
|
+
readonly slice: (face: number) => Dice;
|
|
25
55
|
}
|
|
26
56
|
/**
|
|
27
57
|
* @internal
|
|
@@ -42,7 +72,6 @@ export declare class Dice {
|
|
|
42
72
|
calculateHitDistribution(): DamageDistribution;
|
|
43
73
|
private ensureHitDistribution;
|
|
44
74
|
private binaryOp;
|
|
45
|
-
private removeFaces;
|
|
46
75
|
getFaceEntries(): [number, number][];
|
|
47
76
|
getFaceMap(): DamageDistribution;
|
|
48
77
|
get(face: number): number;
|
|
@@ -54,6 +83,7 @@ export declare class Dice {
|
|
|
54
83
|
maxFace(): number;
|
|
55
84
|
minFace(): number;
|
|
56
85
|
increment(face: number, count: number): void;
|
|
86
|
+
/** Scales every face count, and every outcome's counts with it, so each outcome keeps its share. */
|
|
57
87
|
normalize(scalar: number): Dice;
|
|
58
88
|
add(other: Dice | number): Dice;
|
|
59
89
|
subtract(other: Dice | number): Dice;
|
|
@@ -68,11 +98,24 @@ export declare class Dice {
|
|
|
68
98
|
divide(other: Dice | number): Dice;
|
|
69
99
|
divideRoundUp(other: Dice | number): Dice;
|
|
70
100
|
divideRoundDown(other: Dice | number): Dice;
|
|
101
|
+
/** A divisor that can be 0 has no quotient there. A 0 face with no weight is never rolled, so it passes. */
|
|
102
|
+
private assertNonZeroDivisor;
|
|
71
103
|
and(other: Dice | number): Dice;
|
|
72
104
|
private checkTarget;
|
|
73
105
|
dc(other: Dice | number): Dice;
|
|
106
|
+
/**
|
|
107
|
+
* An attack check: a total that meets the target lands at its own value, and a miss is 0. A total
|
|
108
|
+
* of exactly 0 that meets the target (a target of 0 or less) lands at 0 too, where the misses sit:
|
|
109
|
+
* its count is recorded under `hit` at 0, like a payload's 0-damage hit, so the ops after the
|
|
110
|
+
* check tell it from a miss.
|
|
111
|
+
*/
|
|
74
112
|
ac(other: Dice | number): Dice;
|
|
75
113
|
deleteFace(face: number): Dice;
|
|
114
|
+
/**
|
|
115
|
+
* Roll once and, on a result in `toReroll`'s faces, roll again and keep the second roll. Each
|
|
116
|
+
* result keeps its own weight: with T the total count and c_R the count on the rerolled faces,
|
|
117
|
+
* face v's new count is c_v·(T·[v∉R] + c_R), i.e. p′(v) = p(v)·[v∉R] + P(R)·p(v).
|
|
118
|
+
*/
|
|
76
119
|
reroll(toReroll: Dice | number): Dice;
|
|
77
120
|
combine(other: Dice | number): Dice;
|
|
78
121
|
combineInPlace(other: Dice): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dice.d.ts","sourceRoot":"","sources":["../../src/parser/dice.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,kBAAkB,EAElB,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAYjC,sEAAsE;AACtE,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iEAAiE;IACjE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtC
|
|
1
|
+
{"version":3,"file":"dice.d.ts","sourceRoot":"","sources":["../../src/parser/dice.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,kBAAkB,EAElB,WAAW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IAAI,CA0BzC;IAEM,cAAc,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CAMvC;IAEM,OAAO,IAAI,kBAAkB,CASnC;IAEM,OAAO,IAAI,MAAM,CAUvB;IAMM,KAAK,CAAC,UAAU,GAAE,MAAY,GAAG,GAAG,CAuI1C;CACF;AAED,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC"}
|
package/dist/parser/parser.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
/** Enable or disable the internal parse cache. */
|
|
3
|
-
export declare function setCachingEnabled(enabled: boolean): void;
|
|
4
|
-
/** Returns whether the internal parse cache is currently enabled. */
|
|
5
|
-
export declare function getCachingEnabled(): boolean;
|
|
1
|
+
import { PMF } from "../pmf/pmf.js";
|
|
6
2
|
/** Clears the internal parse cache. */
|
|
7
3
|
export declare function clearParserCache(): void;
|
|
8
4
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/parser/parser.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/parser/parser.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AA6BjC,uCAAuC;AACvC,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,GAAE,MAAU,GAAG,GAAG,CAuD5D"}
|
|
@@ -4,10 +4,10 @@ import { PMF } from "../pmf/pmf.js";
|
|
|
4
4
|
* Parse without throwing — for UI code that reparses on every keystroke, where
|
|
5
5
|
* a transiently invalid expression is normal rather than exceptional.
|
|
6
6
|
*
|
|
7
|
-
* Also accepts
|
|
8
|
-
* delta at
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Also accepts `+` before an integer, which the grammar has no use for: `"+7"`
|
|
8
|
+
* becomes a delta at 7. Integers are read here rather than by the grammar
|
|
9
|
+
* (which reads `"-3"` as a unary minus) so a huge one is refused instead of
|
|
10
|
+
* rounded; a half-typed damage field is a bare signed number often enough.
|
|
11
11
|
*
|
|
12
12
|
* The failure value is {@link PMF.empty}, which has **mass 0**, not a
|
|
13
13
|
* distribution. Convolving it collapses the whole result to mass 0, so a caller
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Why a parsed string's dice cannot double: it is not a damage expression `scaleParsedDice` can rewrite. */
|
|
2
|
+
export declare class UndoubleableExpressionError extends Error {
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Why a damage payload's dice cannot double on a crit: it is damage, but "double the dice"
|
|
6
|
+
* has more than one reading for it (a keep other than keep-highest-of-1, a `bestOf()`, a die rolled
|
|
7
|
+
* with advantage, an `&` mix with dice). Never caught as {@link UndoubleableExpressionError}: no
|
|
8
|
+
* crit is approximated.
|
|
9
|
+
*/
|
|
10
|
+
export declare class AmbiguousCritDoublingError extends Error {
|
|
11
|
+
}
|
|
12
|
+
/** Rewrites every dice term's count in a parsed damage expression by `scale`. */
|
|
13
|
+
export declare function scaleParsedDice(expression: string, scale: number): string;
|
|
14
|
+
//# sourceMappingURL=scaleDice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaleDice.d.ts","sourceRoot":"","sources":["../../src/parser/scaleDice.ts"],"names":[],"mappings":"AAoCA,6GAA6G;AAC7G,qBAAa,2BAA4B,SAAQ,KAAK;CAAG;AAEzD;;;;;GAKG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;CAAG;AA6IxD,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAiHzE"}
|
package/dist/pmf/mixture.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { PMF } from "./pmf.js";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* A labeled mixture builder that preserves provenance in Bin.count.
|
|
4
|
+
*
|
|
5
|
+
* `eps` prunes relative to the normalized mass: an outcome whose share of the total is below
|
|
6
|
+
* `eps` is dropped when the PMF is built, and the survivors are renormalized. `eps = 0` keeps
|
|
7
|
+
* every outcome with positive mass.
|
|
8
|
+
*/
|
|
3
9
|
export declare class Mixture<L extends string = string> {
|
|
4
10
|
private readonly totals;
|
|
5
11
|
private readonly labelMass;
|
|
@@ -13,13 +19,21 @@ export declare class Mixture<L extends string = string> {
|
|
|
13
19
|
hasLabel(label: L): boolean;
|
|
14
20
|
/**
|
|
15
21
|
* Add a labeled component with a mixture weight.
|
|
16
|
-
* Weight can be any positive finite number
|
|
22
|
+
* Weight can be any positive finite number; only the ratios between weights matter.
|
|
17
23
|
*/
|
|
18
24
|
add(label: L, pmf: PMF, weight?: number): this;
|
|
25
|
+
/**
|
|
26
|
+
* The normalized mixture. Each bin's `p` and per-label `count` are its raw mass divided by
|
|
27
|
+
* the grand total, so labels sum to `p` whatever the weights summed to. Outcomes below
|
|
28
|
+
* `eps` of the total (the pruning `eps` given to the constructor) are dropped first.
|
|
29
|
+
*
|
|
30
|
+
* @param eps Epsilon carried by the built PMF.
|
|
31
|
+
*/
|
|
19
32
|
buildPMF(eps?: number): PMF;
|
|
20
33
|
/**
|
|
21
34
|
* Produce normalized *per-label* PMFs (labels independent).
|
|
22
|
-
* These are unlabeled PMFs built from the raw mass of that label alone
|
|
35
|
+
* These are unlabeled PMFs built from the raw mass of that label alone; values below `eps`
|
|
36
|
+
* of the label's own mass are pruned.
|
|
23
37
|
*/
|
|
24
38
|
byOutcome(): Record<L, PMF>;
|
|
25
39
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mixture.d.ts","sourceRoot":"","sources":["../../src/pmf/mixture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B
|
|
1
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AAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAClD,GAAG,GAAE,MAAY,GAChB,GAAG,CAIL;CACF"}
|
package/dist/pmf/pmf.d.ts
CHANGED
|
@@ -41,11 +41,11 @@ export interface DamageAttributionChartModel {
|
|
|
41
41
|
* Probability Mass Function for discrete damage distributions.
|
|
42
42
|
*/
|
|
43
43
|
export declare class PMF {
|
|
44
|
-
readonly map:
|
|
44
|
+
readonly map: ReadonlyMap<number, Bin>;
|
|
45
45
|
readonly epsilon: number;
|
|
46
46
|
readonly normalized: boolean;
|
|
47
47
|
readonly identifier: string;
|
|
48
|
-
private _preservedProvenance;
|
|
48
|
+
private readonly _preservedProvenance;
|
|
49
49
|
private static __anonIdCounter;
|
|
50
50
|
private _support?;
|
|
51
51
|
private _min?;
|
|
@@ -55,7 +55,27 @@ export declare class PMF {
|
|
|
55
55
|
private _variance?;
|
|
56
56
|
private _stdev?;
|
|
57
57
|
private _fingerprint?;
|
|
58
|
-
|
|
58
|
+
private _cumulative?;
|
|
59
|
+
private _frozen;
|
|
60
|
+
/**
|
|
61
|
+
* @param map Damage value → bin. Typed read-only: a PMF is immutable once built. A PMF returned
|
|
62
|
+
* from the library's caches is frozen: its bins, its map and the `map` property itself reject
|
|
63
|
+
* writes (see {@link freeze}).
|
|
64
|
+
*/
|
|
65
|
+
constructor(map?: ReadonlyMap<number, Bin>, epsilon?: number, normalized?: boolean, identifier?: string, _preservedProvenance?: boolean);
|
|
66
|
+
/**
|
|
67
|
+
* A PMF cache that freezes every stored PMF and follows `setCachingEnabled`. The library's
|
|
68
|
+
* own caches are built with this.
|
|
69
|
+
*/
|
|
70
|
+
static createCache(maxSize: number): LRUCache<string, PMF>;
|
|
71
|
+
/**
|
|
72
|
+
* Freezes this PMF so it can be shared through a cache. Every bin is deep-frozen, including its
|
|
73
|
+
* `count` and `attr` maps, so writing to one throws a `TypeError`. The map is replaced by a copy
|
|
74
|
+
* whose `set`/`delete`/`clear` throw a `TypeError` (the map this PMF was built with stays the
|
|
75
|
+
* caller's), and the `map` property becomes read-only, so assigning it throws too.
|
|
76
|
+
* Returns this PMF.
|
|
77
|
+
*/
|
|
78
|
+
freeze(): this;
|
|
59
79
|
static empty(epsilon?: number, identifier?: string): PMF;
|
|
60
80
|
static zero(epsilon?: number): PMF;
|
|
61
81
|
static delta(value: number, epsilon?: number): PMF;
|
|
@@ -188,18 +208,19 @@ export declare class PMF {
|
|
|
188
208
|
* ]);
|
|
189
209
|
*/
|
|
190
210
|
static mixN(weights: [number, PMF][], eps?: number): PMF;
|
|
191
|
-
|
|
211
|
+
/**
|
|
212
|
+
* False for a PMF produced by {@link power}, which folds independent attacks into one
|
|
213
|
+
* distribution and cannot say which attack produced which label.
|
|
214
|
+
*/
|
|
192
215
|
preservedProvenance(): boolean;
|
|
193
216
|
private getPowerCacheKey;
|
|
194
217
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
* This is ONLY SAFE if you are trying to calculate masses.
|
|
202
|
-
* If you want to query any atLeast probabilities, you should use the DiceQuery class instead without power().
|
|
218
|
+
* Convolves this PMF with itself `n` times, by exponentiation by squaring. `n` must be a
|
|
219
|
+
* positive integer.
|
|
220
|
+
*
|
|
221
|
+
* NOTE: this folds `n` independent, identical attacks into one PMF, so it loses data
|
|
222
|
+
* provenance. It is only safe when computing masses; for `atLeast`-style queries use a
|
|
223
|
+
* `DiceQuery` instead of `power()`.
|
|
203
224
|
*/
|
|
204
225
|
power(n: number, eps?: number): PMF;
|
|
205
226
|
replicate(n: number): PMF[];
|
|
@@ -217,13 +238,21 @@ export declare class PMF {
|
|
|
217
238
|
min(): number;
|
|
218
239
|
max(): number;
|
|
219
240
|
/**
|
|
220
|
-
* Returns the expected (mean) damage value.
|
|
221
|
-
*
|
|
241
|
+
* Returns the expected (mean) damage value, Σ v·p. Cached.
|
|
242
|
+
*
|
|
243
|
+
* On a PMF whose mass is not 1 this is the partial expectation (the slice's contribution to
|
|
244
|
+
* the whole distribution's mean), not the conditional mean; `DiceQuery.mean()` divides by the
|
|
245
|
+
* mass instead.
|
|
222
246
|
*/
|
|
223
247
|
mean(): number;
|
|
224
248
|
/**
|
|
225
|
-
* Returns the variance of the damage distribution.
|
|
226
|
-
*
|
|
249
|
+
* Returns the variance of the damage distribution. Cached.
|
|
250
|
+
*
|
|
251
|
+
* On a PMF whose mass is not 1 (a slice such as {@link filterOutcome}'s output) this is the
|
|
252
|
+
* variance of the distribution conditioned on the slice, Σ (v − μ)²·p / m with μ = Σ v·p / m
|
|
253
|
+
* and m = {@link mass}, the same quantity `DiceQuery.variance()` reports for that PMF. Note
|
|
254
|
+
* that {@link mean} is not conditioned: it stays the partial expectation Σ v·p, so slices add
|
|
255
|
+
* up. Within 1e-12 of unit mass (or at zero or negative mass) no conditioning is applied.
|
|
227
256
|
*/
|
|
228
257
|
variance(): number;
|
|
229
258
|
/**
|
|
@@ -237,30 +266,29 @@ export declare class PMF {
|
|
|
237
266
|
private static mergeInto;
|
|
238
267
|
add(other: PMF): PMF;
|
|
239
268
|
/**
|
|
240
|
-
* Returns a new PMF with
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* able to model "I can probably have this opportunity attack 40% of rounds"
|
|
244
|
-
* Example: `pmf.addScaled(critBranch, 0.05)` → PMF including 5% crit outcomes
|
|
269
|
+
* Returns a new PMF with `branch` added to this one, scaled by `probability` before merging —
|
|
270
|
+
* the primitive for conditional effects. Example: `pmf.addScaled(critBranch, 0.05)` → a PMF
|
|
271
|
+
* including a 5% crit slice.
|
|
245
272
|
*/
|
|
246
273
|
addScaled(branch: PMF, probability: number): PMF;
|
|
247
274
|
/**
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
* sub-one AoE target fraction.
|
|
275
|
+
* Bernoulli thinning: the effect this PMF describes happens with probability
|
|
276
|
+
* `frequency` and otherwise deals nothing — a conditional attack, an on-hit
|
|
277
|
+
* rider, or a sub-one AoE target fraction. The result is
|
|
278
|
+
* `frequency · X + (1 − frequency) · δ0`.
|
|
251
279
|
*
|
|
252
|
-
* Every
|
|
253
|
-
* per-label `count
|
|
254
|
-
*
|
|
255
|
-
*
|
|
280
|
+
* Every bin (negative damage included) keeps `frequency` of its probability
|
|
281
|
+
* mass, per-label `count` and per-label `attr`; the zero bin keeps its labels
|
|
282
|
+
* at that share too. The freed mass, `(1 − frequency) · mass()`, is added to
|
|
283
|
+
* the damage-0 bin under the canonical `missNone` outcome, so the total mass
|
|
284
|
+
* is unchanged, also for a slice whose mass is not 1.
|
|
256
285
|
*
|
|
257
286
|
* Unlike a bare {@link scaleMass} or {@link mapDamage}, this keeps damage
|
|
258
287
|
* attribution (`attr`) intact, so a frequency-scaled PMF still renders
|
|
259
288
|
* correctly in the damage-attribution charts.
|
|
260
289
|
*
|
|
261
290
|
* `frequency >= 1` (or non-finite) returns this PMF unchanged; `frequency <= 0`
|
|
262
|
-
*
|
|
263
|
-
* encoded at damage value 0.
|
|
291
|
+
* leaves only the damage-0 bin, holding all of the mass as `missNone`.
|
|
264
292
|
*
|
|
265
293
|
* @param frequency Probability in [0, 1] that the effect occurs.
|
|
266
294
|
*/
|
|
@@ -277,9 +305,42 @@ export declare class PMF {
|
|
|
277
305
|
* "did not match" halves by the exact per-damage-value match probability.
|
|
278
306
|
*/
|
|
279
307
|
splitByFactor(factor: (damage: number) => number): [PMF, PMF];
|
|
308
|
+
/**
|
|
309
|
+
* Max of two i.i.d. copies of this PMF's distribution: normalize, square
|
|
310
|
+
* the CDF, then restore the original mass. The engine's damage-reroll
|
|
311
|
+
* substitution (`onFirstHit(keepBestDamage())`) applies this to a landing
|
|
312
|
+
* attack's base payload slice — "roll it again, keep the better total".
|
|
313
|
+
*
|
|
314
|
+
* PRESERVES outcome labels and attribution. A max, unlike a sum, is
|
|
315
|
+
* literally one of the two draws: the value that wins was drawn from this
|
|
316
|
+
* same distribution, so its `count`/`attr` composition is unchanged in
|
|
317
|
+
* *proportion* — only that bin's total mass is recomputed (via the
|
|
318
|
+
* squared-CDF step) and every label is rescaled by the same factor. This
|
|
319
|
+
* is why {@link power}'s documented provenance loss does not apply here:
|
|
320
|
+
* for a sum, one output value arises from many `(x1, x2)` pairs with
|
|
321
|
+
* different attribution mixes, so provenance is genuinely ambiguous; for a
|
|
322
|
+
* max, there is exactly one realized draw per bin. A naive rebuild through
|
|
323
|
+
* {@link fromMap} would silently discard both `count` and `attr`.
|
|
324
|
+
*
|
|
325
|
+
* Works on a non-unit-mass slice (e.g. {@link filterOutcome}'s output):
|
|
326
|
+
* the CDF is squared on the NORMALIZED distribution, then the result is
|
|
327
|
+
* rescaled back to this PMF's original total mass, not to 1.
|
|
328
|
+
*/
|
|
329
|
+
maxOfTwo(): PMF;
|
|
280
330
|
scaleMass(factor: number): PMF;
|
|
281
331
|
mapDamage(damageTransformFunction: (damageValue: number) => number): PMF;
|
|
282
|
-
|
|
332
|
+
/**
|
|
333
|
+
* Multiplies every damage value by `factor / denominator` and rounds: `floor`
|
|
334
|
+
* (toward −∞, the default), `ceil` (toward +∞) or `round` (to nearest, halves
|
|
335
|
+
* toward +∞). Values that land on the same result merge, labels included.
|
|
336
|
+
*
|
|
337
|
+
* With an integer `factor` and `denominator` the rounding is exact: `v·factor`
|
|
338
|
+
* is an exact integer, and one division of two integers below 2^53 lands on
|
|
339
|
+
* the correct side of every integer. Pass a ratio that way, e.g.
|
|
340
|
+
* `scaleDamage(9, "ceil", 7)`; `scaleDamage(9 / 7, "ceil")` rounds the factor
|
|
341
|
+
* to a double first, so 21·(9/7) = 27.000000000000004 would round up to 28.
|
|
342
|
+
*/
|
|
343
|
+
scaleDamage(factor: number, rounding?: "floor" | "round" | "ceil", denominator?: number): PMF;
|
|
283
344
|
private getPMFCombineCacheKey;
|
|
284
345
|
/**
|
|
285
346
|
* A content fingerprint of every bin (probability, per-label `count`, per-label `attr`) plus
|
|
@@ -291,7 +352,8 @@ export declare class PMF {
|
|
|
291
352
|
* because a PMF is immutable once constructed -- this avoids re-deriving the key on every
|
|
292
353
|
* convolve()/power() call (including cache hits). Bin order is sorted by damage value (and
|
|
293
354
|
* label keys sorted within each bin) so two equal-content PMFs built via different code paths
|
|
294
|
-
* fingerprint identically regardless of Map insertion order.
|
|
355
|
+
* fingerprint identically regardless of Map insertion order. Label keys are JSON-encoded, so a
|
|
356
|
+
* label containing the separators cannot make two different bins read the same.
|
|
295
357
|
*/
|
|
296
358
|
fingerprint(): string;
|
|
297
359
|
convolve(other: PMF, eps?: number, raw?: boolean): PMF;
|
|
@@ -361,8 +423,22 @@ export declare class PMF {
|
|
|
361
423
|
denseSupport(): number[];
|
|
362
424
|
/** CDF at x: P(X ≤ x). */
|
|
363
425
|
cdfAt(x: number): number;
|
|
364
|
-
/**
|
|
426
|
+
/**
|
|
427
|
+
* Quantile / inverse CDF: the smallest support value x with P(X ≤ x) ≥ p·mass().
|
|
428
|
+
* `p <= 0` gives the smallest support value; `p >= 1` or NaN gives the largest.
|
|
429
|
+
*
|
|
430
|
+
* A float running sum can land an ulp short of a CDF that is exactly p (a d20's CDF(10) sums
|
|
431
|
+
* to 0.49999999999999994), so the comparison allows a relative slack of a few ulps per bin.
|
|
432
|
+
* Below the median it compares the CDF summed from the low end; above it, the mass strictly
|
|
433
|
+
* above x summed from the high end. A sum of non-negative terms is accurate relative to its
|
|
434
|
+
* own size, so the tail that decides the answer is never swamped by the rest of the mass.
|
|
435
|
+
*/
|
|
365
436
|
quantile(p: number): number;
|
|
437
|
+
/**
|
|
438
|
+
* Sorted support with `below[i]` = Σ p over values ≤ values[i], summed from the low end,
|
|
439
|
+
* and `above[i]` = Σ p over values > values[i], summed from the high end. Cached.
|
|
440
|
+
*/
|
|
441
|
+
private cumulative;
|
|
366
442
|
/** Get outcome probability at specific damage value. */
|
|
367
443
|
outcomeAt(damage: number, outcome: string): number;
|
|
368
444
|
/** Get all outcome types present in this PMF. */
|
|
@@ -455,6 +531,15 @@ export declare class PMF {
|
|
|
455
531
|
pNone: number;
|
|
456
532
|
pAny: number;
|
|
457
533
|
};
|
|
534
|
+
/**
|
|
535
|
+
* Maps every damage value through `f`, then optionally rounds it (`rounding`, default
|
|
536
|
+
* `"none"`). Values that land on the same result merge their probability and, unless
|
|
537
|
+
* `preserveCounts` is false, their per-label `count`. Damage attribution (`attr`) is dropped,
|
|
538
|
+
* because it is tied to the old values. Nothing is pruned and the mass is unchanged.
|
|
539
|
+
*
|
|
540
|
+
* @param eps Epsilon carried by the result.
|
|
541
|
+
* @throws Error when a mapped value is not a finite integer.
|
|
542
|
+
*/
|
|
458
543
|
mapValues(f: (v: number) => number, eps?: number, opts?: {
|
|
459
544
|
rounding?: Rounding;
|
|
460
545
|
preserveCounts?: boolean;
|
package/dist/pmf/pmf.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pmf.d.ts","sourceRoot":"","sources":["../../src/pmf/pmf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"pmf.d.ts","sourceRoot":"","sources":["../../src/pmf/pmf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,KAAK,EAAE,GAAG,EAAmB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAOtE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAQpC,eAAO,MAAM,QAAQ,uBAAyD,CAAC;AAgC/E;;;;;GAKG;AACH,MAAM,WAAW,2BAA2B;IAC1C,sFAAsF;IACtF,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,2FAA2F;IAC3F,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC7C,6FAA6F;IAC7F,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,uGAAuG;IACvG,MAAM,E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;QAAE,oBAAoB,CAAC,EAAE,OAAO,CAAA;KAAO,GACvE,GAAG,CAiCL;IAED,KAAK,IAAI,SAAS,CAEjB;CACF"}
|
package/dist/pmf/query.d.ts
CHANGED
|
@@ -121,7 +121,8 @@ export declare class DiceQuery {
|
|
|
121
121
|
*/
|
|
122
122
|
probTotalAtLeast(threshold: number): number;
|
|
123
123
|
/**
|
|
124
|
-
* Returns damage values at specific percentiles
|
|
124
|
+
* Returns damage values at specific percentiles: for each p, the smallest damage x with
|
|
125
|
+
* P(total ≤ x) ≥ p, exact at CDF boundaries (see {@link PMF.quantile}).
|
|
125
126
|
*
|
|
126
127
|
* Example: `query.percentiles([0.25, 0.5, 0.75])` → [8, 12, 18]
|
|
127
128
|
* Use case: "What are my 25th, 50th, and 75th percentile damage values?"
|
|
@@ -169,7 +170,7 @@ export declare class DiceQuery {
|
|
|
169
170
|
* Note:
|
|
170
171
|
*
|
|
171
172
|
* - You have to pass in an array of labels to avoid double-counting if you are
|
|
172
|
-
* using multiple labels. You cannot just add them.
|
|
173
|
+
* using multiple labels. You cannot just add them. A label listed twice counts once.
|
|
173
174
|
*/
|
|
174
175
|
probAtLeastOne(labels: OutcomeType | OutcomeType[]): number;
|
|
175
176
|
/**
|
|
@@ -205,8 +206,8 @@ export declare class DiceQuery {
|
|
|
205
206
|
* - "How likely am I to get exactly 2 successes out of 3 attacks?"
|
|
206
207
|
* - "What's the probability that exactly half my attacks succeed?"
|
|
207
208
|
*
|
|
208
|
-
* Note: For arrays, an attack counts as a "success" if it has any of the specified labels
|
|
209
|
-
*
|
|
209
|
+
* Note: For arrays, an attack counts as a "success" if it has any of the specified labels,
|
|
210
|
+
* as in probAtLeastK and probAtMostK. A negative k has probability 0.
|
|
210
211
|
*/
|
|
211
212
|
probExactlyK(labels: OutcomeType | OutcomeType[], k: number): number;
|
|
212
213
|
/**
|
|
@@ -243,6 +244,10 @@ export declare class DiceQuery {
|
|
|
243
244
|
* - "How much damage do I expect from successful attacks?"
|
|
244
245
|
* - "What's the damage contribution from critical hits specifically?"
|
|
245
246
|
* - "How much damage comes from miss effects (like save-for-half spells)?"
|
|
247
|
+
*
|
|
248
|
+
* A single whose mass is not 1 is normalized exactly as {@link mean} normalizes it, so the
|
|
249
|
+
* contributions of labels that cover every outcome add up to `mean()`. A label listed twice
|
|
250
|
+
* counts once.
|
|
246
251
|
*/
|
|
247
252
|
expectedDamageFrom(labels: OutcomeType | OutcomeType[]): number;
|
|
248
253
|
/**
|
|
@@ -366,10 +371,15 @@ export declare class DiceQuery {
|
|
|
366
371
|
*/
|
|
367
372
|
probabilityOf(labels: OutcomeType | OutcomeType[]): number;
|
|
368
373
|
/**
|
|
369
|
-
* Returns the probability
|
|
374
|
+
* Returns the probability that at least one attack misses (either kind of miss:
|
|
375
|
+
* `missNone` or `missDamage`). For a single attack this is its miss chance.
|
|
376
|
+
*
|
|
377
|
+
* Example: `query.missChance()` → 0.45
|
|
378
|
+
* Use case: "What's the chance I miss at least once this turn?"
|
|
370
379
|
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
380
|
+
* For the chance that every attack misses, use
|
|
381
|
+
* `probExactlyK(["missNone", "missDamage"], n)` with n attacks, or
|
|
382
|
+
* `probAtMostK(["hit", "crit"], 0)`.
|
|
373
383
|
*/
|
|
374
384
|
missChance(): number;
|
|
375
385
|
/**
|
|
@@ -447,7 +457,7 @@ export declare class DiceQuery {
|
|
|
447
457
|
};
|
|
448
458
|
/** Probability of doing strictly more than threshold damage (default >0). */
|
|
449
459
|
probDamageGreaterThan(threshold?: number): number;
|
|
450
|
-
/** All outcome keys
|
|
460
|
+
/** All outcome keys present in the PMF, ordered by `order` when given. */
|
|
451
461
|
outcomeKeys(order?: OutcomeType[]): OutcomeType[];
|
|
452
462
|
/** Total probability per outcome across the PMF. */
|
|
453
463
|
outcomeTotals(outcomes?: OutcomeType[]): Map<OutcomeType, number>;
|
|
@@ -561,19 +571,22 @@ export declare class DiceQuery {
|
|
|
561
571
|
*/
|
|
562
572
|
mapDamage(damageTransformFunction: (damageValue: number) => number): DiceQuery;
|
|
563
573
|
/**
|
|
564
|
-
* Returns a new DiceQuery with damage values scaled by
|
|
565
|
-
* Convenient wrapper around mapDamage for multiplicative scaling
|
|
574
|
+
* Returns a new DiceQuery with damage values scaled by `factor / denominator`.
|
|
575
|
+
* Convenient wrapper around mapDamage for multiplicative scaling; see
|
|
576
|
+
* {@link PMF.scaleDamage} for the rounding rules.
|
|
566
577
|
*
|
|
567
|
-
* @param factor Scaling factor for damage values
|
|
578
|
+
* @param factor Scaling factor for damage values (the numerator of a ratio)
|
|
568
579
|
* @param rounding Rounding method: "floor" (default), "round", or "ceil"
|
|
580
|
+
* @param denominator Divisor; integer `factor` and `denominator` round exactly
|
|
569
581
|
* @returns New DiceQuery with scaled damage values
|
|
570
582
|
*
|
|
571
583
|
* @example
|
|
572
584
|
* const baseAttack = parse("2d6 + 3");
|
|
573
585
|
* const doubled = baseAttack.scaleDamage(2); // Double damage
|
|
574
586
|
* const halfDamage = baseAttack.scaleDamage(0.5, "round"); // Half damage, rounded
|
|
587
|
+
* const sevenTenths = baseAttack.scaleDamage(7, "floor", 10); // floor(7v/10), exactly
|
|
575
588
|
*/
|
|
576
|
-
scaleDamage(factor: number, rounding?: "floor" | "round" | "ceil"): DiceQuery;
|
|
589
|
+
scaleDamage(factor: number, rounding?: "floor" | "round" | "ceil", denominator?: number): DiceQuery;
|
|
577
590
|
/**
|
|
578
591
|
* Returns a new DiceQuery combining this query with another via convolution.
|
|
579
592
|
* Equivalent to rolling both queries independently and adding results.
|
package/dist/pmf/query.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/pmf/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,KAAK,EAAE,2BAA2B,E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