#194 : Saisie manuelle du résultat

This commit is contained in:
2021-06-28 20:19:02 +02:00
parent e9f6d5f4b9
commit 52fff9e79e
4 changed files with 20 additions and 5 deletions

View File

@ -114,7 +114,7 @@ export class RdDResolutionTable {
chances.showDice = rollData.showDice;
chances.rollMode = rollData.rollMode;
let rolled = await this.rollChances(chances, rollData.diviseurSignificative);
let rolled = await this.rollChances(chances, rollData.diviseurSignificative, rollData.forceDiceResult);
rolled.caracValue = caracValue;
rolled.finalLevel = finalLevel;
rolled.bonus = rollData.bonus;
@ -163,8 +163,11 @@ export class RdDResolutionTable {
}
/* -------------------------------------------- */
static async rollChances(chances, diviseur) {
chances.roll = await RdDDice.rollTotal("1d100", chances);
static async rollChances(chances, diviseur, forceDiceResult = -1) {
if (forceDiceResult <= 0 || forceDiceResult > 100) {
forceDiceResult = -1;
}
chances.roll = await RdDDice.rollTotal((forceDiceResult == -1) ? "1d100" : `${forceDiceResult}`, chances);
mergeObject(chances, this.computeReussite(chances, chances.roll, diviseur), { overwrite: true });
return chances;
}