Fix: Surencombrement toujours calculé

Sur de vieux personnages, le sur-encombrement stocké pouvait
être affiché (et incorrect).
This commit is contained in:
Vincent Vandemeulebrouck 2022-12-17 17:49:11 +01:00
parent c9dc847440
commit 80a904e533
4 changed files with 2 additions and 16 deletions

View File

@ -59,6 +59,7 @@ export class RdDActorSheet extends ActorSheet {
calc: { calc: {
fortune: Monnaie.getFortune(this.actor), fortune: Monnaie.getFortune(this.actor),
encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(), encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(),
surenc: this.actor.computeMalusSurEncombrement(),
prixTotalEquipement: this.actor.computePrixTotalEquipement(), prixTotalEquipement: this.actor.computePrixTotalEquipement(),
surprise: RdDBonus.find(this.actor.getSurprise(false)).descr, surprise: RdDBonus.find(this.actor.getSurprise(false)).descr,
resumeBlessures: this.actor.computeResumeBlessure(this.actor.system.blessures), resumeBlessures: this.actor.computeResumeBlessure(this.actor.system.blessures),

View File

@ -1385,9 +1385,6 @@ export class RdDActor extends Actor {
if (!this.pack) { if (!this.pack) {
await this.computeMalusArmure(); await this.computeMalusArmure();
this.encTotal = this.items.map(it => it.getEncTotal()).reduce(Misc.sum(), 0); this.encTotal = this.items.map(it => it.getEncTotal()).reduce(Misc.sum(), 0);
if (!this.isVehicule()) {
this.system.compteurs.surenc.value = this.computeMalusSurEncombrement();
}
return this.encTotal; return this.encTotal;
} }
return 0; return 0;

View File

@ -97,10 +97,6 @@
"etat": { "etat": {
"value": 0, "value": 0,
"label": "Etat général" "label": "Etat général"
},
"surenc": {
"value": 0,
"label": "Sur-encombrement"
} }
}, },
"attributs": { "attributs": {
@ -231,10 +227,6 @@
"etat": { "etat": {
"value": 0, "value": 0,
"label": "Etat général" "label": "Etat général"
},
"surenc": {
"value": 0,
"label": "Sur-encombrement"
} }
} }
}, },
@ -530,10 +522,6 @@
"value": 0, "value": 0,
"label": "Etat général" "label": "Etat général"
}, },
"surenc": {
"value": 0,
"label": "Sur-encombrement"
},
"ethylisme": { "ethylisme": {
"value": 1, "value": 1,
"label": "Ethylisme", "label": "Ethylisme",

View File

@ -1,7 +1,7 @@
<div class="flex-group-left header-etats"> <div class="flex-group-left header-etats">
<div class="flexcol"> <div class="flexcol">
<span>{{system.compteurs.etat.label}}: {{system.compteurs.etat.value}}</span> <span>{{system.compteurs.etat.label}}: {{system.compteurs.etat.value}}</span>
<span>{{system.compteurs.surenc.label}}: {{system.compteurs.surenc.value}}</span> <span>Sur-encombrement: {{calc.surenc}}</span>
<span>{{calc.resumeBlessures}}</span> <span>{{calc.resumeBlessures}}</span>
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-effects.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-effects.html"}}
</div> </div>