diff --git a/module/actor.js b/module/actor.js index d91608ca..7f74625f 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1883,15 +1883,18 @@ export class RdDActor extends Actor { } /* -------------------------------------------- */ - computeArmure( locData, domArmePlusDom, arme = undefined ) { + computeArmure( attackerRoll ) { + let locData = attackerRoll.loc; + let dmg = attackerRoll.dmg.dmgArme + attackerRoll.dmg.dmgActor; + let arme = attackerRoll.arme; // TODO: arc ignore armure let protection = 0; for (const item of this.data.items) { if (item.type == "armure" && item.data.equipe) { let update = duplicate(item); protection += new Roll(update.data.protection.toString()).roll().total; - update.data.deterioration += domArmePlusDom; - domArmePlusDom = 0; // Reset it + update.data.deterioration = Misc.toInt(update.data.deterioration) + dmg; + dmg = 0; // Reset it if ( update.data.deterioration >= 10) { update.data.deterioration = 0; if ( update.data.protection.toString().length == 1 ) @@ -1917,7 +1920,7 @@ export class RdDActor extends Actor { } console.log("encaisserDommages", attackerRoll ) - const armure = this.computeArmure( attackerRoll.loc, attackerRoll.domArmePlusDom, attackerRoll.arme); + const armure = this.computeArmure( attackerRoll ); const rollEncaissement = new Roll("2d10 + @dmg - @armure",{ dmg: attackerRoll.dmg.total,