diff --git a/changelog.md b/changelog.md index 9c75d290..029e6826 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ - Les bon moments sont affichés en tooltip sur le moral - Les modifications de coeurs fonctionnent de nouveau +- Le refoulement est remis à zéro après avoir refoulé et reçu un souffle ## 13.0.36 - Les rêveries d'Illisys diff --git a/module/actor.js b/module/actor.js index 3b0a1d15..7858b80c 100644 --- a/module/actor.js +++ b/module/actor.js @@ -972,7 +972,7 @@ export class RdDActor extends RdDBaseActorSang { /* -------------------------------------------- */ async actionRefoulement(item) { - const refoulement = item?.system.refoulement ?? 0; + const refoulement = item?.system.refoulement ?? 0 if (refoulement > 0) { RdDConfirm.confirmer({ settingConfirmer: "confirmation-refouler", @@ -980,8 +980,8 @@ export class RdDActor extends RdDBaseActorSang { title: 'Confirmer la refoulement', buttonLabel: 'Refouler', onAction: async () => { - await this.ajouterRefoulement(refoulement, `une queue ${item.name}`); - await item.delete(); + await this.ajouterRefoulement(refoulement, `une queue ${item.name}`) + await item.delete() } }); } @@ -989,16 +989,18 @@ export class RdDActor extends RdDBaseActorSang { /* -------------------------------------------- */ async ajouterRefoulement(value = 1, refouler) { - let refoulement = this.system.reve.refoulement.value + value + const refoulement = this.system.reve.refoulement.value + value const roll = new Roll("1d20") await roll.evaluate() await roll.toMessage({ flavor: `${this.name} refoule ${refouler} pour ${value} points de refoulement (total: ${refoulement})` }) if (roll.total <= refoulement) { - refoulement = 0 + await this.update({ "system.reve.refoulement.value": 0 }) await this.ajouterSouffle({ chat: true }) } - await this.update({ "system.reve.refoulement.value": refoulement }) - return roll; + else{ + await this.update({ "system.reve.refoulement.value": refoulement }) + } + return roll } /* -------------------------------------------- */