From 37704558e06d4fbea63194f25e7f7524399b9785 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 19 Jan 2023 01:42:42 +0100 Subject: [PATCH] =?UTF-8?q?Combat=20bloqu=C3=A9=20en=20cas=20d'init=20n?= =?UTF-8?q?=C3=A9gative?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le code essayait de modifier le total d'un roll, qui n'est pas un champ mais une methode get de la classe Roll --- module/rdd-combat.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 45202088..9aedd422 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -1,6 +1,5 @@ import { ChatUtility } from "./chat-utility.js"; -import { ENTITE_BLURETTE, ENTITE_INCARNE, ENTITE_NONINCARNE, HIDE_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js"; -import { DialogSelectTarget } from "./dialog-select-target.js"; +import { ENTITE_BLURETTE, HIDE_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js"; import { Grammar } from "./grammar.js"; import { RdDItemArme } from "./item-arme.js"; import { RdDItemCompetence } from "./item-competence.js"; @@ -111,10 +110,10 @@ export class RdDCombatManager extends Combat { if (!roll.total) { roll.evaluate({ async: false }); } - if (roll.total <= 0) roll.total = 0.00; - console.log("Compute init for", rollFormula, roll.total, combatant); + const total = Math.max(roll.total, 0.00); + console.log("Compute init for", rollFormula, roll, total, combatant); let id = combatant._id || combatant.id; - await this.updateEmbeddedDocuments("Combatant", [{ _id: id, initiative: roll.total }]); + await this.updateEmbeddedDocuments("Combatant", [{ _id: id, initiative: total }]); // Send a chat message let rollMode = messageOptions.rollMode || game.settings.get("core", "rollMode");