Fix protection armure

This commit is contained in:
Vincent Vandemeulebrouck 2021-03-30 22:27:03 +02:00
parent 2efb942bea
commit 5e654bdfa4

View File

@ -2566,7 +2566,8 @@ export class RdDActor extends Actor {
let dmg = (attackerRoll.dmg.dmgArme ?? 0) + (attackerRoll.dmg.dmgActor ?? 0); let dmg = (attackerRoll.dmg.dmgArme ?? 0) + (attackerRoll.dmg.dmgActor ?? 0);
let armeData = attackerRoll.arme; let armeData = attackerRoll.arme;
let protection = 0; let protection = 0;
const armures = this.data.items.filter(it => it.type == "armure" && it.data.equipe); const armures = this.items.map(it => Misc.data(it))
.filter(it => it.type == "armure" && it.data.equipe);
for (const itemData of armures) { for (const itemData of armures) {
protection += new Roll(itemData.data.protection.toString()).roll().total; protection += new Roll(itemData.data.protection.toString()).roll().total;
if (dmg > 0) { if (dmg > 0) {
@ -2574,7 +2575,7 @@ export class RdDActor extends Actor {
dmg = 0; dmg = 0;
} }
} }
const penetration = armeData ? Misc.toInt(armeData.data.penetration) : 0; const penetration = Misc.toInt(armeData?.data.penetration ?? 0);
protection = Math.max(protection - penetration, 0); protection = Math.max(protection - penetration, 0);
protection += this.getProtectionNaturelle(); protection += this.getProtectionNaturelle();
// Gestion des cas particuliers sur la fenêtre d'encaissement // Gestion des cas particuliers sur la fenêtre d'encaissement