Merge pull request '10.6.18 - Les insomnies de Pralinor' (#629) from VincentVk/foundryvtt-reve-de-dragon:v10 into v10

Reviewed-on: public/foundryvtt-reve-de-dragon#629
This commit is contained in:
uberwald 2023-02-17 10:16:29 +01:00
commit 26967fe1cd
3 changed files with 30 additions and 28 deletions

View File

@ -651,7 +651,7 @@ export class RdDActor extends RdDBaseActor {
if (dormi.etat == 'eveil') { if (dormi.etat == 'eveil') {
message.content += 'Vous êtes réveillé par un Rêve de Dragon.' 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) { if (!options.grisReve) {
@ -666,8 +666,8 @@ export class RdDActor extends RdDBaseActor {
} }
async dormirDesHeures(jetsReve, message, heures, options) { async dormirDesHeures(jetsReve, message, heures, options) {
const dormi = { heures: 1, etat: 'dort' }; const dormi = { heures: 0, etat: 'dort' };
for (; dormi.heures <= heures && dormi.etat == 'dort'; dormi.heures++) { for (; dormi.heures < heures && dormi.etat == 'dort'; dormi.heures++) {
await this._recupererEthylisme(message); await this._recupererEthylisme(message);
if (options.grisReve) { if (options.grisReve) {
await this.recupererFatigue(message); await this.recupererFatigue(message);

View File

@ -1,4 +1,3 @@
import { EffetsDraconiques } from "../tmr/effets-draconiques.js";
export class DialogChateauDormant extends Dialog { export class DialogChateauDormant extends Dialog {
@ -76,8 +75,14 @@ export class DialogChateauDormant extends Dialog {
async onChateauDormant() { async onChateauDormant() {
const motifStress = this.html.find("form input[name='motifStress']").val(); const motifStress = this.html.find("form input[name='motifStress']").val();
const consignesChateauDormant = jQuery.map(this.html.find('li.set-sommeil-actor'), it => { jQuery.map(
const actorRow = this.html.find(it); 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 actorId = actorRow.data('actor-id');
const actor = this.getActor(actorId); const actor = this.getActor(actorId);
const insomnie = actorRow.find('input.sommeil-insomnie').is(':checked'); const insomnie = actorRow.find('input.sommeil-insomnie').is(':checked');
@ -93,11 +98,8 @@ export class DialogChateauDormant extends Dialog {
date: this.dialogData.finChateauDormant, date: this.dialogData.finChateauDormant,
insomnie: insomnie, insomnie: insomnie,
heures: insomnie ? 0 : Number.parseInt(actorRow.find('input.sommeil-heures').val()), heures: insomnie ? 0 : Number.parseInt(actorRow.find('input.sommeil-heures').val()),
moral: actor.moral, moral: actor.system.sommeil.moral ?? 'neutre',
} }
};
} }
});
consignesChateauDormant.forEach(async consigne => await consigne.actor.prepareChateauDormant(consigne))
}
} }

View File

@ -1,8 +1,8 @@
{ {
"id": "foundryvtt-reve-de-dragon", "id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"version": "10.6.17", "version": "10.6.18",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.17.zip", "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", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",