28 lines
695 B
TypeScript
28 lines
695 B
TypeScript
export interface RollOptions {
|
|
maxCritSucc: number;
|
|
minCritFail: number;
|
|
useSlayingDice: boolean;
|
|
slayingDiceRepetition: boolean;
|
|
}
|
|
|
|
export class DefaultRollOptions implements RollOptions {
|
|
public maxCritSucc = 1;
|
|
public minCritFail = 20;
|
|
public useSlayingDice = false;
|
|
public slayingDiceRepetition = false;
|
|
|
|
mergeWith(other: Partial<RollOptions>): RollOptions {
|
|
return { ...this, ...other } as RollOptions;
|
|
}
|
|
}
|
|
|
|
export class RollResult {
|
|
constructor(public value: number, public status: RollResultStatus, public dice: Array<number>) {}
|
|
}
|
|
|
|
export enum RollResultStatus {
|
|
FAILURE,
|
|
SUCCESS,
|
|
CRITICAL_FAILURE,
|
|
CRITICAL_SUCCESS,
|
|
}
|