FIx creating DS4Check from data / results
This commit is contained in:
parent
0b98925aeb
commit
e1d376057c
1 changed files with 22 additions and 2 deletions
|
@ -75,6 +75,15 @@ export class DS4Check extends DiceTerm {
|
|||
return super.total;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
evaluate({ minimize = false, maximize = false } = {}): this {
|
||||
super.evaluate({ minimize, maximize });
|
||||
this.evaluateResults();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
|
@ -95,12 +104,23 @@ export class DS4Check extends DiceTerm {
|
|||
this.fumble = results[0].failure ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
static fromResults(options: Partial<DS4CheckTermData>, results: DiceTerm.Result[]): DS4Check {
|
||||
const term = new this(options);
|
||||
term.results = results;
|
||||
term.evaluateResults();
|
||||
term._evaluated = true;
|
||||
return term;
|
||||
}
|
||||
|
||||
static readonly DEFAULT_CHECK_TARGET_NUMBER = 10;
|
||||
static readonly DEFAULT_MAXIMUM_COUP_RESULT = 1;
|
||||
static readonly DEFAULT_MINIMUM_FUMBLE_RESULT = 20;
|
||||
static DENOMINATION = "s";
|
||||
static MODIFIERS = {
|
||||
c: (): void => undefined, // Modifier is consumed in constructor for crit
|
||||
v: "evaluateResults",
|
||||
c: (): void => undefined, // Modifier is consumed in constructor for maximumCoupResult / minimumFumbleResult
|
||||
v: (): void => undefined, // Modifier is consumed in constructor for checkTargetNumber
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue