forked from public/foundryvtt-reve-de-dragon
Fix moral (cas ajustement 0)
Lors de Chateau Dormant, si le moral ne change pas, on utilise le retour de moralIncDec pour avoir la valeur courante du moral
This commit is contained in:
@ -1435,22 +1435,21 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async moralIncDec(ajustementMoral) {
|
||||
let actorData
|
||||
let tplData = Misc.templateData(this);
|
||||
if (ajustementMoral != 0) {
|
||||
actorData = Misc.data(this);
|
||||
let moral = Misc.toInt(actorData.data.compteurs.moral.value) + ajustementMoral
|
||||
let moral = Misc.toInt(tplData.compteurs.moral.value) + ajustementMoral
|
||||
if (moral > 3) { // exaltation
|
||||
const exaltation = Misc.toInt(actorData.data.compteurs.exaltation.value) + moral - 3;
|
||||
const exaltation = Misc.toInt(tplData.compteurs.exaltation.value) + moral - 3;
|
||||
await this.updateCompteurValue('exaltation', exaltation);
|
||||
}
|
||||
if (moral < -3) { // dissolution
|
||||
const dissolution = Misc.toInt(actorData.data.compteurs.dissolution.value) + 3 - moral;
|
||||
const dissolution = Misc.toInt(tplData.compteurs.dissolution.value) + 3 - moral;
|
||||
await this.updateCompteurValue('dissolution', dissolution);
|
||||
}
|
||||
moral = Math.max(-3, Math.min(moral, 3));
|
||||
await this.updateCompteurValue('moral', moral);
|
||||
}
|
||||
return actorData.data.compteurs.moral.value;
|
||||
return tplData.compteurs.moral.value;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user