diff --git a/module/actor-sheet.js b/module/actor-sheet.js
index ecbbdf66..20bd8f12 100644
--- a/module/actor-sheet.js
+++ b/module/actor-sheet.js
@@ -234,7 +234,7 @@ export class RdDActorSheet extends ActorSheet {
activateListeners(html) {
super.activateListeners(html);
- HtmlUtility._showControlWhen(".gm-only", game.user.isGM);
+ HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM);
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
diff --git a/module/html-utility.js b/module/html-utility.js
index 28f3551d..1566039c 100644
--- a/module/html-utility.js
+++ b/module/html-utility.js
@@ -1,10 +1,10 @@
export class HtmlUtility{
static _showControlWhen(control, condition) {
if (condition) {
- $(control).show();
+ control.show();
}
else {
- $(control).hide();
+ control.hide();
}
}
}
\ No newline at end of file
diff --git a/module/rdd-calendrier.js b/module/rdd-calendrier.js
index bd9d0dda..4d2fcaf7 100644
--- a/module/rdd-calendrier.js
+++ b/module/rdd-calendrier.js
@@ -387,7 +387,7 @@ export class RdDCalendrier extends Application {
activateListeners(html) {
super.activateListeners(html);
- HtmlUtility._showControlWhen(".gm-only", game.user.isGM);
+ HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM);
this.updateDisplay();
diff --git a/module/rdd-combat.js b/module/rdd-combat.js
index f9d3dae6..c3fb55e0 100644
--- a/module/rdd-combat.js
+++ b/module/rdd-combat.js
@@ -238,35 +238,35 @@ export class RdDCombat {
/* -------------------------------------------- */
async _onAttaqueNormale(rollData) {
console.log("RdDCombat.onAttaqueNormale >>>", rollData);
- if (!await this.accorderEntite('avant-defense')) {
- return;
- }
-
let explications = "";
-
+
rollData.dmg = RdDBonus.dmg(rollData, this.attacker.getBonusDegat(), this.defender.isEntiteCauchemar());
-
+
if (this.target) {
explications += "
Cible : " + this.defender.data.name;
}
explications += "
Encaissement à " + Misc.toSignedString(rollData.dmg.total) + " (" + rollData.dmg.loc.label + ")";
-
+
// Save rollData for defender
game.system.rdd.rollDataHandler[this.attackerId] = duplicate(rollData);
-
+
// Message spécial pour la rapidité, qui reste difficile à gérer automatiquement
if (rollData.particuliereAttaque == 'rapidite') {
explications += "
Vous avez attaqué en Rapidité. Vous pourrez faire une deuxième attaque, ou utiliser votre arme pour vous défendre.";
}
-
+
// Final chat message
let chatOptions = {
content: "Test : " + rollData.selectedCarac.label + " / " + rollData.competence.name + ""
- + RdDResolutionTable.explainRollData(rollData)
- + explications
+ + RdDResolutionTable.explainRollData(rollData)
+ + explications
}
ChatUtility.chatWithRollMode(chatOptions, this.attacker.name)
-
+
+ if (!await this.accorderEntite('avant-defense')) {
+ return;
+ }
+
if (this.target) {
this._sendMessageDefense(rollData);
}
diff --git a/module/rdd-roll.js b/module/rdd-roll.js
index 3a22fc1f..156818a5 100644
--- a/module/rdd-roll.js
+++ b/module/rdd-roll.js
@@ -118,15 +118,15 @@ export class RdDRoll extends Dialog {
dmgText = '(' + dmgText + ')';
}
- HtmlUtility._showControlWhen(".diffMoral", rollData.selectedCarac == actor.data.data.carac.volonte);
- HtmlUtility._showControlWhen(".etat-general", !dialog._isIgnoreEtatGeneral(rollData));
+ HtmlUtility._showControlWhen($(".diffMoral"), rollData.selectedCarac == actor.data.data.carac.volonte);
+ HtmlUtility._showControlWhen($(".etat-general"), !dialog._isIgnoreEtatGeneral(rollData));
// Sort management
if (rollData.selectedSort) {
rollData.bonus = RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.coord),
//console.log("Toggle show/hide", rollData.selectedSort);
- HtmlUtility._showControlWhen("#div-sort-difficulte", RdDItemSort.isDifficulteVariable(rollData.selectedSort))
- HtmlUtility._showControlWhen("#div-sort-ptreve", RdDItemSort.isCoutVariable(rollData.selectedSort))
+ HtmlUtility._showControlWhen($("#div-sort-difficulte"), RdDItemSort.isDifficulteVariable(rollData.selectedSort))
+ HtmlUtility._showControlWhen($("#div-sort-ptreve"), RdDItemSort.isCoutVariable(rollData.selectedSort))
}
// Mise à jour valeurs
diff --git a/module/rdd-token-hud.js b/module/rdd-token-hud.js
index 12aefdc4..d0966b44 100644
--- a/module/rdd-token-hud.js
+++ b/module/rdd-token-hud.js
@@ -1,62 +1,66 @@
/* -------------------------------------------- */
+import { HtmlUtility } from "./html-utility.js";
import { RdDUtility } from "./rdd-utility.js";
/* -------------------------------------------- */
export class RdDTokenHud {
-
- /* -------------------------------------------- */
- static addTokenHudExtensions( app, html, data ) {
- let token = canvas.tokens.get(data._id);
-
- // Affichage seulement si le token est un combat
- if ( token.inCombat) {
- this.addInitiativeTokenTip(html, token);
- }
- }
+
/* -------------------------------------------- */
- static async addInitiativeTokenTip(html, token ) {
- // Helper actor and sanity check
- let actor = token.actor;
- if (actor === undefined) return;
-
- // Get combatant stuff
- let combatant = game.combat.data.combatants.find(c => c.tokenId == token.data._id );
- if ( combatant ) {
- let armesList = RdDUtility.buildArmeList( combatant );
- // Create space for Hud Extensions next to combat icon
- let htmlInit = '