10.6.18 - Les insomnies de Pralinor #629

Merged
uberwald merged 3 commits from VincentVk/foundryvtt-reve-de-dragon:v10 into v10 2023-02-17 10:16:29 +01:00
Showing only changes of commit 045ee76013 - Show all commits

View File

@ -1,4 +1,3 @@
import { EffetsDraconiques } from "../tmr/effets-draconiques.js";
export class DialogChateauDormant extends Dialog {
@ -76,8 +75,14 @@ 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);
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');
@ -93,11 +98,8 @@ export class DialogChateauDormant extends Dialog {
date: this.dialogData.finChateauDormant,
insomnie: insomnie,
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))
}
}