From 7fed3844b5c561cbe37c4e077432edc5b154abc7 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 17 Feb 2023 01:28:30 +0100 Subject: [PATCH 1/3] Fix: calcul du nombre d'heures dormi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le calcul était incorrect (5 au lieu de 4), du coup Chateau Dormant ne se déclenchait pas. --- module/actor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/actor.js b/module/actor.js index 0e130098..f6b1cee3 100644 --- a/module/actor.js +++ b/module/actor.js @@ -651,7 +651,7 @@ export class RdDActor extends RdDBaseActor { if (dormi.etat == 'eveil') { message.content += 'Vous êtes réveillé par un Rêve de Dragon.' } - options.chateauDormant = options.chateauDormant && dormi.heures == heures; + options.chateauDormant = options.chateauDormant && dormi.heures >= heures; } if (!options.grisReve) { @@ -666,8 +666,8 @@ export class RdDActor extends RdDBaseActor { } async dormirDesHeures(jetsReve, message, heures, options) { - const dormi = { heures: 1, etat: 'dort' }; - for (; dormi.heures <= heures && dormi.etat == 'dort'; dormi.heures++) { + const dormi = { heures: 0, etat: 'dort' }; + for (; dormi.heures < heures && dormi.etat == 'dort'; dormi.heures++) { await this._recupererEthylisme(message); if (options.grisReve) { await this.recupererFatigue(message); -- 2.35.3 From 045ee76013a37f8979d628e774df4ed2016ff242 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 17 Feb 2023 01:29:21 +0100 Subject: [PATCH 2/3] =?UTF-8?q?Fix:=20transfert=20du=20moral=20=C3=A0=20ch?= =?UTF-8?q?ateau=20dormant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/sommeil/dialog-chateau-dormant.js | 48 ++++++++++++------------ 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/module/sommeil/dialog-chateau-dormant.js b/module/sommeil/dialog-chateau-dormant.js index 33ce5a28..49faa706 100644 --- a/module/sommeil/dialog-chateau-dormant.js +++ b/module/sommeil/dialog-chateau-dormant.js @@ -1,4 +1,3 @@ -import { EffetsDraconiques } from "../tmr/effets-draconiques.js"; export class DialogChateauDormant extends Dialog { @@ -76,28 +75,31 @@ export class DialogChateauDormant extends Dialog { async onChateauDormant() { const motifStress = this.html.find("form input[name='motifStress']").val(); - const consignesChateauDormant = jQuery.map(this.html.find('li.set-sommeil-actor'), it => { - const actorRow = this.html.find(it); - const actorId = actorRow.data('actor-id'); - const actor = this.getActor(actorId); - const insomnie = actorRow.find('input.sommeil-insomnie').is(':checked'); - return { - actor, - ignorer: actorRow.find('input.sommeil-ignorer').is(':checked'), - stress: { - motif: motifStress, - valeur: Number.parseInt(actorRow.find('input.sommeil-stress').val()), - }, - sommeil: { - nouveaujour: true, - date: this.dialogData.finChateauDormant, - insomnie: insomnie, - heures: insomnie ? 0 : Number.parseInt(actorRow.find('input.sommeil-heures').val()), - moral: actor.moral, - } - } - }); - consignesChateauDormant.forEach(async consigne => await consigne.actor.prepareChateauDormant(consigne)) + jQuery.map( + this.html.find('li.set-sommeil-actor'), + it => this.extractConsigneActor(this.html.find(it), motifStress) + ).forEach(async consigne => await consigne.actor.prepareChateauDormant(consigne)) } + + extractConsigneActor(actorRow, motifStress) { + const actorId = actorRow.data('actor-id'); + const actor = this.getActor(actorId); + const insomnie = actorRow.find('input.sommeil-insomnie').is(':checked'); + return { + actor, + ignorer: actorRow.find('input.sommeil-ignorer').is(':checked'), + stress: { + motif: motifStress, + valeur: Number.parseInt(actorRow.find('input.sommeil-stress').val()), + }, + sommeil: { + nouveaujour: true, + date: this.dialogData.finChateauDormant, + insomnie: insomnie, + heures: insomnie ? 0 : Number.parseInt(actorRow.find('input.sommeil-heures').val()), + moral: actor.system.sommeil.moral ?? 'neutre', + } + }; + } } \ No newline at end of file -- 2.35.3 From b23dcaace5a092cd4fdcc136f848c5b6ef39d654 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 17 Feb 2023 01:30:20 +0100 Subject: [PATCH 3/3] Version 10.6.18 Les insomnies de Pralinor --- system.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system.json b/system.json index 90ba7fe9..cb06707d 100644 --- a/system.json +++ b/system.json @@ -1,8 +1,8 @@ { "id": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", - "version": "10.6.17", - "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.17.zip", + "version": "10.6.18", + "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.18.zip", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json", "compatibility": { "minimum": "10", -- 2.35.3