From d87b1affd0ccb56e30517be7c90d02da22eec0d6 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 8 Dec 2021 23:22:37 +0100 Subject: [PATCH] Fix: boutons de parade MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Utiliser la compétence associée à l'arme pour la parade --- module/rdd-combat.js | 16 ++++++++++------ templates/partial-roll-ajustements.html | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 8d363432..308d1c72 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -631,7 +631,7 @@ export class RdDCombat { switch (button) { case '#particuliere-attaque': return await this.choixParticuliere(attackerRoll, event.currentTarget.attributes['data-mode'].value); - case '#parer-button': return this.parade(attackerRoll, armeParadeId, competence); + case '#parer-button': return this.parade(attackerRoll, armeParadeId); case '#esquiver-button': return this.esquive(attackerRoll, compId, competence); case '#encaisser-button': return this.encaisser(attackerRoll, defenderTokenId); case '#echec-total-attaque': return this._onEchecTotal(attackerRoll); @@ -1016,10 +1016,15 @@ export class RdDCombat { } /* -------------------------------------------- */ - async parade(attackerRoll, armeParadeId, competence) { - let arme = this.defender.getArmeParade(armeParadeId); - + async parade(attackerRoll, armeParadeId) { + const arme = this.defender.getArmeParade(armeParadeId); console.log("RdDCombat.parade >>>", attackerRoll, armeParadeId, arme); + const competence = Misc.templateData(arme)?.competence; + if (competence == undefined) + { + console.error("Pas de compétence de parade associée à ", arme) ; + return; + } let rollData = this._prepareParade(attackerRoll, arme, competence); @@ -1052,7 +1057,7 @@ export class RdDCombat { competence: Misc.data(this.defender.getCompetence(competenceParade)), arme: armeParade, surprise: this.defender.getSurprise(true), - needParadeSignificative: ReglesOptionelles.isUsing('categorieParade') && RdDItemArme.needParadeSignificative(armeAttaque, armeParade), + needParadeSignificative: ReglesOptionelles.isUsing('categorieParade') && RdDItemArme.needParadeSignificative(attackerRoll.arme, armeParade), needResist: RdDItemArme.needArmeResist(attackerRoll.arme, armeParade), carac: Misc.templateData(this.defender).carac, show: {} @@ -1185,7 +1190,6 @@ export class RdDCombat { const dmg = attackerRoll.dmg.dmgArme + attackerRoll.dmg.dmgActor; let arme = defenderRoll.arme; - let msg = ""; let resistance = Misc.toInt(arme.data.resistance); if (arme.data.magique) { defenderRoll.show.deteriorationArme = 'resiste'; // Par défaut diff --git a/templates/partial-roll-ajustements.html b/templates/partial-roll-ajustements.html index 238dcc5d..87f4b5e9 100644 --- a/templates/partial-roll-ajustements.html +++ b/templates/partial-roll-ajustements.html @@ -17,7 +17,7 @@ {{#if ajustements.facteurSign.used}} - +
Significative requise ×{{{ajustements.facteurSign.label}}}! {{/if}}