From fedf8f3b2920bd9bc3c079282ac2192867f1c26d Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 12 May 2024 21:37:12 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20accorder=20entit=C3=A9s=20x2=20si=20vali?= =?UTF-8?q?dation=20GR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les entités pouvaient être accordées 2 fois en cas de validation par le GR --- module/actor/base-actor-reve.js | 37 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/module/actor/base-actor-reve.js b/module/actor/base-actor-reve.js index ad26f6bf..cd9640c3 100644 --- a/module/actor/base-actor-reve.js +++ b/module/actor/base-actor-reve.js @@ -421,36 +421,35 @@ export class RdDBaseActorReve extends RdDBaseActor { /* -------------------------------------------- */ async encaisser() { await RdDEncaisser.encaisser(this) } - async encaisserDommagesRemote(rollData, attackerId, show) { - const attacker = game.actors.get(attackerId); - await this.encaisserDommages(rollData, attacker, show) - } async encaisserDommages(rollData, attacker = undefined, show = undefined) { if (attacker && !await attacker.accorder(this, 'avant-encaissement')) { return; } - const attackerId = attacker?.id; - if (ReglesOptionnelles.isUsing('validation-encaissement-gr') && !game.user.isGM) { - RdDBaseActor.remoteActorCall({ - tokenId: this.token?.id, - actorId: this.id, - method: 'encaisserDommagesRemote', - args: [rollData, attackerId, show] - }); - return; - } - const armure = await this.computeArmure(rollData); - if (ReglesOptionnelles.isUsing('validation-encaissement-gr')) { - DialogValidationEncaissement.validerEncaissement(this, rollData, armure, - jet => this.$onEncaissement(jet, show, attacker)); - } + if (ReglesOptionnelles.isUsing('validation-encaissement-gr')){ + await this.encaisserDommagesValidationGR(rollData, armure, attacker?.id, show); + } else { const jet = await RdDUtility.jetEncaissement(rollData, armure, { showDice: SHOW_DICE }); await this.$onEncaissement(jet, show, attacker); } } + async encaisserDommagesValidationGR(rollData, armure, attackerId, show) { + if (!game.user.isGM) { + RdDBaseActor.remoteActorCall({ + tokenId: this.token?.id, + actorId: this.id, + method: 'encaisserDommagesValidationGR', + args: [rollData, armure, attackerId, show] + }); + } else { + const attacker = game.actors.get(attackerId); + DialogValidationEncaissement.validerEncaissement(this, rollData, armure, + jet => this.$onEncaissement(jet, show, attacker)); + } + } + async $onEncaissement(jet, show, attacker) { await this.onAppliquerJetEncaissement(jet, attacker); await this.$afficherEncaissement(jet, show);