Fix encTotal dans dialogues

This commit is contained in:
Vincent Vandemeulebrouck 2021-04-20 00:49:01 +02:00
parent b7c913ac50
commit a9d49d793c

View File

@ -167,7 +167,7 @@ export class RdDActor extends Actor {
// Initialize empty items
RdDCarac.computeCarac(actorData.data);
this.computeIsHautRevant();
this.computeEncombrementTotalEtMalusArmure();
await this.computeEncombrementTotalEtMalusArmure();
this.computePrixTotalEquipement();
this.computeEtatGeneral();
// Sanity check
@ -1083,11 +1083,10 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
computeEncombrement() {
const tplData = Misc.templateData(this);
tplData.encTotal = this.filterItemsData(it => it.data.encombrement != undefined)
this.encTotal = this.filterItemsData(it => it.data.encombrement != undefined)
.map(it => it.data.encTotal)
.reduce(Misc.sum(), 0);
return tplData.encTotal;
return this.encTotal;
}
/* -------------------------------------------- */
@ -1104,12 +1103,11 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
computePrixTotalEquipement() {
const tplData = Misc.templateData(this);
tplData.prixTotalEquipement = this.filterItemsData(it => it.data.prixTotal)
this.prixTotalEquipement = this.filterItemsData(it => it.data.prixTotal)
.map(it => it.data.prixTotal ?? 0)
.reduce(Misc.sum(), 0);
// Mise à jour valeur totale de l'équipement
return tplData.prixTotalEquipement;
return this.prixTotalEquipement;
}
/* -------------------------------------------- */