Remise à zéro du refoulement après souffle

This commit is contained in:
2026-05-01 23:56:17 +02:00
parent 704c99e418
commit d15d0989a3
2 changed files with 10 additions and 7 deletions

View File

@@ -4,6 +4,7 @@
- Les bon moments sont affichés en tooltip sur le moral - Les bon moments sont affichés en tooltip sur le moral
- Les modifications de coeurs fonctionnent de nouveau - 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 ## 13.0.36 - Les rêveries d'Illisys

View File

@@ -972,7 +972,7 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */ /* -------------------------------------------- */
async actionRefoulement(item) { async actionRefoulement(item) {
const refoulement = item?.system.refoulement ?? 0; const refoulement = item?.system.refoulement ?? 0
if (refoulement > 0) { if (refoulement > 0) {
RdDConfirm.confirmer({ RdDConfirm.confirmer({
settingConfirmer: "confirmation-refouler", settingConfirmer: "confirmation-refouler",
@@ -980,8 +980,8 @@ export class RdDActor extends RdDBaseActorSang {
title: 'Confirmer la refoulement', title: 'Confirmer la refoulement',
buttonLabel: 'Refouler', buttonLabel: 'Refouler',
onAction: async () => { onAction: async () => {
await this.ajouterRefoulement(refoulement, `une queue ${item.name}`); await this.ajouterRefoulement(refoulement, `une queue ${item.name}`)
await item.delete(); await item.delete()
} }
}); });
} }
@@ -989,16 +989,18 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */ /* -------------------------------------------- */
async ajouterRefoulement(value = 1, refouler) { 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") const roll = new Roll("1d20")
await roll.evaluate() await roll.evaluate()
await roll.toMessage({ flavor: `${this.name} refoule ${refouler} pour ${value} points de refoulement (total: ${refoulement})` }) await roll.toMessage({ flavor: `${this.name} refoule ${refouler} pour ${value} points de refoulement (total: ${refoulement})` })
if (roll.total <= refoulement) { if (roll.total <= refoulement) {
refoulement = 0 await this.update({ "system.reve.refoulement.value": 0 })
await this.ajouterSouffle({ chat: true }) await this.ajouterSouffle({ chat: true })
} }
await this.update({ "system.reve.refoulement.value": refoulement }) else{
return roll; await this.update({ "system.reve.refoulement.value": refoulement })
}
return roll
} }
/* -------------------------------------------- */ /* -------------------------------------------- */