From c9cc1de16eb9cbb956d4bbaab91dbfe06b6cbc87 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 8 Jan 2021 22:55:00 +0100 Subject: [PATCH] =?UTF-8?q?Destin=C3=A9e=20et=20Appel=20=C3=A0=20la=20chan?= =?UTF-8?q?ce=20exclusifs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/rdd-combat.js | 27 ++++++++++++++++----------- templates/chat-demande-defense.html | 9 ++++----- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 9616299a..c5317551 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -136,7 +136,6 @@ export class RdDCombat { } const defenderTokenId = event.currentTarget.attributes['data-defenderTokenId'].value; - let defenderRoll = this._getDefense(attackerRoll.passeArme); const armeParadeId = event.currentTarget.attributes['data-armeid']?.value; switch (button) { @@ -150,13 +149,13 @@ export class RdDCombat { () => this.attaqueChanceuse(attackerRoll), () => this._onEchecTotal(attackerRoll)); case '#appel-chance-defense': return this.defender.rollAppelChance( - () => this.defenseChanceuse(attackerRoll, defenderRoll), + () => this.defenseChanceuse(attackerRoll), () => this.afficherOptionsDefense(attackerRoll, { defenseChance: true })); case '#appel-destinee-attaque': return this.attacker.appelDestinee( () => this.attaqueSignificative(attackerRoll), () => { }); case '#appel-destinee-defense': return this.defender.appelDestinee( - () => this.defenseDestinee(defenderRoll), + () => this.defenseDestinee(attackerRoll), () => { }); } } @@ -194,7 +193,7 @@ export class RdDCombat { } /* -------------------------------------------- */ - defenseChanceuse(attackerRoll, defenderRoll) { + defenseChanceuse(attackerRoll) { ui.notifications.info("La défense est rejouée grâce à la chance") attackerRoll.essais.defenseChance = true; attackerRoll.essais.defense = false; @@ -203,15 +202,21 @@ export class RdDCombat { } /* -------------------------------------------- */ - defenseDestinee(defenderRoll) { - ui.notifications.info('Défense significative grâce à la destinée') - RdDResolutionTable.forceSignificative(defenderRoll.rolled); - this.removeChatMessageActionsPasseArme(defenderRoll.passeArme); - if (defenderRoll.arme) { - this._onParadeNormale(defenderRoll); + defenseDestinee(attackerRoll) { + let defenderRoll = this._getDefense(attackerRoll.passeArme); + if (defenderRoll) { + ui.notifications.info('Défense significative grâce à la destinée') + RdDResolutionTable.forceSignificative(defenderRoll.rolled); + this.removeChatMessageActionsPasseArme(defenderRoll.passeArme); + if (defenderRoll.arme) { + this._onParadeNormale(defenderRoll); + } + else { + this._onEsquiveNormale(defenderRoll); + } } else { - this._onEsquiveNormale(defenderRoll); + ui.notifications.warn("Appel à la destinée impossible, la passe d'armes est déjà terminée!") } } diff --git a/templates/chat-demande-defense.html b/templates/chat-demande-defense.html index 2fdfdd8d..b3117441 100644 --- a/templates/chat-demande-defense.html +++ b/templates/chat-demande-defense.html @@ -2,7 +2,7 @@ {{#if (eq surprise 'totale')}} {{defender.name}} est totalement surpris {{else if essais.defense}} - {{defender.name}} doit + {{defender.name}} doit : {{else}} {{defender.name}} doit se défendre {{#if (eq surprise 'demi')}} avec une significative {{/if}} : @@ -12,7 +12,6 @@
{{#unless (eq surprise 'totale')}} {{#if essais.defense}} -
{{#unless essais.defenseChance}} {{#if (eq defender.data.type 'personnage')}}
{{/if}} - {{/unless}} - {{#if (eq defender.data.type 'personnage')}} + {{#if (eq defender.data.type 'personnage')}} {{#if (gt defender.data.data.compteurs.destinee.value 0)}}
Utiliser la destinée
{{/if}} - {{/if}} + {{/if}} + {{/unless}} {{else}} {{#each armes as |arme key|}}