Gestion des signes draconiques #455
@ -2566,7 +2566,8 @@ export class RdDActor extends Actor {
|
||||
let dmg = (attackerRoll.dmg.dmgArme ?? 0) + (attackerRoll.dmg.dmgActor ?? 0);
|
||||
let armeData = attackerRoll.arme;
|
||||
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) {
|
||||
protection += new Roll(itemData.data.protection.toString()).roll().total;
|
||||
if (dmg > 0) {
|
||||
@ -2574,7 +2575,7 @@ export class RdDActor extends Actor {
|
||||
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 += this.getProtectionNaturelle();
|
||||
// Gestion des cas particuliers sur la fenêtre d'encaissement
|
||||
@ -2864,7 +2865,7 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
let updates = []
|
||||
for (const [valeur, nombre] of Object.entries(fortune)) {
|
||||
updates.push( { _id: parValeur[valeur]._id, 'data.quantite': nombre });
|
||||
updates.push({ _id: parValeur[valeur]._id, 'data.quantite': nombre });
|
||||
}
|
||||
await this.updateEmbeddedDocuments('Item', updates);
|
||||
}
|
||||
@ -3148,7 +3149,7 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
async onPreUpdateItem(item, change, options, id) {
|
||||
async onPreUpdateItem(item, change, options, id) {
|
||||
const itemData = Misc.data(item);
|
||||
if (itemData.type == 'competence' && itemData.data.defaut_carac && itemData.data.xp) {
|
||||
await this.checkCompetenceXP(itemData.name, itemData.data.xp);
|
||||
|
Loading…
Reference in New Issue
Block a user