Merge branch 'v1.4-fixes' into 'v1.4'

V1.4 fixes

See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!277
This commit is contained in:
Leratier Bretonnien 2021-06-13 20:34:42 +00:00
commit 7253b35084
5 changed files with 15 additions and 15 deletions

View File

@ -298,7 +298,8 @@ export class RdDCalendrier extends Application {
let rollData = { let rollData = {
caracValue: request.carac_vue, caracValue: request.carac_vue,
finalLevel: niveau, finalLevel: niveau,
showDice: false showDice: false,
rollMode: "blindroll"
}; };
await RdDResolutionTable.rollData(rollData); await RdDResolutionTable.rollData(rollData);
let nbAstral = this.getNombreAstral(request.date); let nbAstral = this.getNombreAstral(request.date);

View File

@ -911,7 +911,7 @@ export class RdDCombat {
console.log("RdDCombat._onEchecTotal >>>", rollData); console.log("RdDCombat._onEchecTotal >>>", rollData);
const arme = rollData.arme; const arme = rollData.arme;
const avecArme = arme?.data.categorie_parade != 'sans-armes'; const avecArme = arme && arme.data.categorie_parade != 'sans-armes';
const action = (rollData.attackerRoll ? (arme ? "la parade" : "l'esquive") : "l'attaque"); const action = (rollData.attackerRoll ? (arme ? "la parade" : "l'esquive") : "l'attaque");
ChatUtility.createChatWithRollMode(this.defender.name, { ChatUtility.createChatWithRollMode(this.defender.name, {
content: `<strong>Maladresse à ${action}!</strong> ` + await RdDRollTables.getMaladresse({ arme: avecArme }) content: `<strong>Maladresse à ${action}!</strong> ` + await RdDRollTables.getMaladresse({ arme: avecArme })

View File

@ -134,9 +134,7 @@ export class RdDDice {
static async roll(formula, options = { showDice: false, rollMode: undefined }) { static async roll(formula, options = { showDice: false, rollMode: undefined }) {
const roll = new Roll(formula); const roll = new Roll(formula);
await roll.evaluate({ async: true }); await roll.evaluate({ async: true });
if (options.showDice) { roll.showDice = options.showDice;
roll.showDice = options.showDice;
}
await RdDDice.show(roll, options.rollMode ?? game.settings.get("core", "rollMode")); await RdDDice.show(roll, options.rollMode ?? game.settings.get("core", "rollMode"));
return roll; return roll;
} }

View File

@ -102,22 +102,23 @@ export class RdDResolutionTable {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async rollData(rollData) { static async rollData(rollData) {
rollData.rolled = await this.roll(rollData.caracValue, rollData.finalLevel, rollData.bonus, rollData.diviseurSignificative, rollData.showDice); rollData.rolled = await this.roll(rollData.caracValue, rollData.finalLevel, rollData);
return rollData; return rollData;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async roll(caracValue, finalLevel, bonus = undefined, diviseur = undefined, showDice = true) { static async roll(caracValue, finalLevel, rollData = {}){
let chances = this.computeChances(caracValue, finalLevel); let chances = this.computeChances(caracValue, finalLevel);
this._updateChancesWithBonus(chances, bonus); this._updateChancesWithBonus(chances, rollData.bonus);
this._updateChancesFactor(chances, diviseur); this._updateChancesFactor(chances, rollData.diviseurSignificative);
chances.showDice = showDice; chances.showDice = rollData.showDice;
chances.rollMode = rollData.rollMode;
let rolled = await this.rollChances(chances, diviseur); let rolled = await this.rollChances(chances, rollData.diviseurSignificative);
rolled.caracValue = caracValue; rolled.caracValue = caracValue;
rolled.finalLevel = finalLevel; rolled.finalLevel = finalLevel;
rolled.bonus = bonus; rolled.bonus = rollData.bonus;
rolled.factorHtml = Misc.getFractionHtml(diviseur); rolled.factorHtml = Misc.getFractionHtml(rollData.diviseurSignificative);
rolled.niveauNecessaire = this.findNiveauNecessaire(caracValue, rolled.roll ); rolled.niveauNecessaire = this.findNiveauNecessaire(caracValue, rolled.roll );
rolled.ajustementNecessaire = rolled.niveauNecessaire - finalLevel; rolled.ajustementNecessaire = rolled.niveauNecessaire - finalLevel;
return rolled; return rolled;
@ -163,7 +164,7 @@ export class RdDResolutionTable {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async rollChances(chances, diviseur) { static async rollChances(chances, diviseur) {
chances.roll = await RdDDice.rollTotal("1d100", {showDice:chances.showDice}); chances.roll = await RdDDice.rollTotal("1d100", chances);
mergeObject(chances, this.computeReussite(chances, chances.roll, diviseur), { overwrite: true }); mergeObject(chances, this.computeReussite(chances, chances.roll, diviseur), { overwrite: true });
return chances; return chances;
} }

View File

@ -2,7 +2,7 @@
"name": "foundryvtt-reve-de-dragon", "name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT", "description": "Rêve de Dragon RPG for FoundryVTT",
"version": "1.4.31", "version": "1.4.32",
"manifestPlusVersion": "1.0.0", "manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.8.0", "minimumCoreVersion": "0.8.0",
"compatibleCoreVersion": "0.8.99", "compatibleCoreVersion": "0.8.99",