#194 : Saisie manuelle du résultat

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

View File

@ -213,7 +213,7 @@ export class RdDCalendrier extends Application {
newList[i] = await this.ajouterNombreAstral(dayIndex, showDice );
}
}
console.log("SAVE list", newList, jourCourant);
//console.log("SAVE list", newList, jourCourant);
this.listeNombreAstral = newList;
game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral);
}

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;
}

View File

@ -61,7 +61,9 @@ export class RdDRoll extends Dialog {
encTotal: actor.getEncTotal(),
ajustementAstrologique: actor.ajustementAstrologique(),
surprise: actor.getSurprise(false),
canClose: true
canClose: true,
isGM: game.user.isGM,
forceDiceResult: -1
};
mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false });
@ -189,6 +191,9 @@ export class RdDRoll extends Dialog {
this.rollData.diffConditions = Misc.toInt(event.currentTarget.value); // Update the selected bonus/malus
this.updateRollResult();
});
html.find('#force-dice-result').change((event) => {
this.rollData.forceDiceResult = Misc.toInt(event.currentTarget.value);
});
html.find('#carac').change((event) => {
let caracKey = event.currentTarget.value;
this.rollData.selectedCarac = this.rollData.carac[caracKey]; // Update the selectedCarac

View File

@ -60,6 +60,13 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-surenc.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-enctotal.html"}}
{{#if isGM}}
<div>
<span><label>Forcer le résultat : </label><input name='force-dice--result' id='force-dice-result' value='{{forceDiceResult}}'></span>
</div>
{{/if}}
</div>
<div class="flex-group-left">