#68 détérioration des armures

Si une armure n'est pas détériorée, elle a une détérioration de 0
Ceci permet de fixer la mise à jour automatique.

La détérioration ne prends pas en compte les bonus de
tactiques / conditions/ particulières en force.
This commit is contained in:
Vincent Vandemeulebrouck 2020-12-15 18:13:15 +01:00
parent e64c350632
commit 1197c4fa79

View File

@ -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 // TODO: arc ignore armure
let protection = 0; let protection = 0;
for (const item of this.data.items) { for (const item of this.data.items) {
if (item.type == "armure" && item.data.equipe) { if (item.type == "armure" && item.data.equipe) {
let update = duplicate(item); let update = duplicate(item);
protection += new Roll(update.data.protection.toString()).roll().total; protection += new Roll(update.data.protection.toString()).roll().total;
update.data.deterioration += domArmePlusDom; update.data.deterioration = Misc.toInt(update.data.deterioration) + dmg;
domArmePlusDom = 0; // Reset it dmg = 0; // Reset it
if ( update.data.deterioration >= 10) { if ( update.data.deterioration >= 10) {
update.data.deterioration = 0; update.data.deterioration = 0;
if ( update.data.protection.toString().length == 1 ) if ( update.data.protection.toString().length == 1 )
@ -1917,7 +1920,7 @@ export class RdDActor extends Actor {
} }
console.log("encaisserDommages", attackerRoll ) 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",{ const rollEncaissement = new Roll("2d10 + @dmg - @armure",{
dmg: attackerRoll.dmg.total, dmg: attackerRoll.dmg.total,