Small cleanup
This commit is contained in:
parent
eb0866cfa7
commit
919091a211
1 changed files with 10 additions and 16 deletions
|
@ -61,33 +61,25 @@ export class DS4Check extends DiceTerm {
|
||||||
minimumFumbleResult = DS4Check.DEFAULT_MINIMUM_FUMBLE_RESULT;
|
minimumFumbleResult = DS4Check.DEFAULT_MINIMUM_FUMBLE_RESULT;
|
||||||
maximumCoupResult = DS4Check.DEFAULT_MAXIMUM_COUP_RESULT;
|
maximumCoupResult = DS4Check.DEFAULT_MAXIMUM_COUP_RESULT;
|
||||||
|
|
||||||
/**
|
/** @override */
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
get expression(): string {
|
get expression(): string {
|
||||||
return `ds${this.modifiers.join("")}`;
|
return `ds${this.modifiers.join("")}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @override */
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
get total(): number | null {
|
get total(): number | null {
|
||||||
if (this.fumble) return 0;
|
if (this.fumble) return 0;
|
||||||
return super.total;
|
return super.total;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @override */
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
evaluate({ minimize = false, maximize = false } = {}): this {
|
evaluate({ minimize = false, maximize = false } = {}): this {
|
||||||
super.evaluate({ minimize, maximize });
|
super.evaluate({ minimize, maximize });
|
||||||
this.evaluateResults();
|
this.evaluateResults();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @override */
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
roll({ minimize = false, maximize = false } = {}): DiceTerm.Result {
|
roll({ minimize = false, maximize = false } = {}): DiceTerm.Result {
|
||||||
// Swap minimize / maximize because in DS4, the best possible roll is a 1 and the worst possible roll is a 20
|
// Swap minimize / maximize because in DS4, the best possible roll is a 1 and the worst possible roll is a 20
|
||||||
return super.roll({ minimize: maximize, maximize: minimize });
|
return super.roll({ minimize: maximize, maximize: minimize });
|
||||||
|
@ -105,10 +97,12 @@ export class DS4Check extends DiceTerm {
|
||||||
this.fumble = results[0].failure ?? false;
|
this.fumble = results[0].failure ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @override */
|
||||||
* @override
|
static fromResults<T extends DS4Check>(
|
||||||
*/
|
this: ConstructorOf<T>,
|
||||||
static fromResults(options: Partial<DiceTerm.TermData>, results: DiceTerm.Result[]): DS4Check {
|
options: Partial<DiceTerm.TermData>,
|
||||||
|
results: DiceTerm.Result[],
|
||||||
|
): T {
|
||||||
const term = new this(options);
|
const term = new this(options);
|
||||||
term.results = results;
|
term.results = results;
|
||||||
term.evaluateResults();
|
term.evaluateResults();
|
||||||
|
|
Loading…
Reference in a new issue