From 6661805f6f8491a0cdedb83571a897941bbe6ad8 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 4 May 2025 18:23:08 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20fatigue=20=C3=A0=20la=20descente=20des=20?= =?UTF-8?q?TMR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit La modification d'un activeEffect déclenche un render, qui utilise les valeurs courante de l'actor. Du coup, si l'update de l'actor est fait après: - le render en cours utilise les anciennes valeurs - comme un render est en cours, le nouveau render est ignoré En faisant les changements d'active effect après ceux de l'actor, l'affichage se fait correctement., --- changelog.md | 1 + module/rdd-tmr-dialog.js | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/changelog.md b/changelog.md index 517c57e0..974e3936 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,7 @@ # 12.0 ## 12.0.50 - Le sommeil d'Astrobazzarh - Le don de double rêve n'interrompt plus le sommeil toutes les heures +- la perte de fatigue à la descente des TMR est visible immédiatement ## 12.0.49 - La deuxième lame d'Astrobazzarh - Corrections diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index af82d87c..ffa45292 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -345,15 +345,16 @@ export class RdDTMRDialog extends Dialog { } this.descenteTMR = true; if (this.actor.tmrApp) { - this.actor.tmrApp = undefined; // Cleanup reference - if (!this.viewOnly) { - await this.actor.setEffect(STATUSES.StatusDemiReve, false); - this.$tellToUserAndGM(message) - } - const appliquerFatigue = ReglesOptionnelles.isUsing("appliquer-fatigue"); + this.actor.tmrApp = undefined // Cleanup reference + const appliquerFatigue = ReglesOptionnelles.isUsing("appliquer-fatigue") await this.actor.santeIncDec( appliquerFatigue ? "fatigue" : "endurance", - (appliquerFatigue ? 1 : -1) * this.cumulFatigue); + (appliquerFatigue ? 1 : -1) * this.cumulFatigue) + if (!this.viewOnly) { + await this.actor.setEffect(STATUSES.StatusDemiReve, false) + this.$tellToUserAndGM(message) + } + } this.pixiTMR.close(); this.pixiTMR = undefined