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);