Fix: accorder entités x2 si validation GR
Les entités pouvaient être accordées 2 fois en cas de validation par le GR
This commit is contained in:
parent
d1ec67e485
commit
fedf8f3b29
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user