Fix: transfert du moral à chateau dormant
This commit is contained in:
parent
7fed3844b5
commit
045ee76013
@ -1,4 +1,3 @@
|
|||||||
import { EffetsDraconiques } from "../tmr/effets-draconiques.js";
|
|
||||||
|
|
||||||
export class DialogChateauDormant extends Dialog {
|
export class DialogChateauDormant extends Dialog {
|
||||||
|
|
||||||
@ -76,28 +75,31 @@ 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'),
|
||||||
const actorId = actorRow.data('actor-id');
|
it => this.extractConsigneActor(this.html.find(it), motifStress)
|
||||||
const actor = this.getActor(actorId);
|
).forEach(async consigne => await consigne.actor.prepareChateauDormant(consigne))
|
||||||
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))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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',
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user