Fix moral sur dissolution

This commit is contained in:
Vincent Vandemeulebrouck
2021-03-18 00:41:26 +01:00
parent a86ac0ffa2
commit a44904ebc0
4 changed files with 12 additions and 8 deletions

View File

@ -1535,6 +1535,7 @@ export class RdDActor extends Actor {
}
await this.update({ 'data.compteurs': compteurs });
}
return compteurs.moral.value;
}
/* -------------------------------------------- */
@ -1625,7 +1626,7 @@ export class RdDActor extends Actor {
content: "Décidément, vous avez l'alcool triste, vous perdez finalement un point de moral!",
whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name)
});
this.moralIncDec(-1);
await this.moralIncDec(-1);
}
}
}
@ -1789,9 +1790,11 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
async _appliquerAppelMoral(rollData, display = true) {
if (!this.isPersonnage()) return;
if (rollData.rolled.isEchec || (rollData.rolled.roll * rollData.ajustements.diviseurSignificative > rollData.score)) {
this.moralIncDec(-1); /* L'appel au moral a échoué. Le personnage perd un point de moral */
rollData.perteMoralEchec = true;
if (!rollData.useMoral) return;
if (rollData.rolled.isEchec ||
(rollData.ajustements.diviseurSignificative && (rollData.rolled.roll * rollData.ajustements.diviseurSignificative > rollData.score))) {
rollData.perteMoralEchec = rollData.moral<=-3? 'dissolution' : 'perte';
rollData.moral = await this.moralIncDec(-1); /* L'appel au moral a échoué. Le personnage perd un point de moral */
}
}

View File

@ -125,7 +125,7 @@ export class RdDRoll extends Dialog {
if (action.callbacks)
for (let callback of action.callbacks) {
if (callback.condition == undefined || callback.condition(this.rollData)) {
callback.action(this.rollData);
await callback.action(this.rollData);
}
}
}