diff --git a/module/apps/rdd-import-stats.js b/module/apps/rdd-import-stats.js index 5c1b69a2..c501d06c 100644 --- a/module/apps/rdd-import-stats.js +++ b/module/apps/rdd-import-stats.js @@ -6,6 +6,7 @@ import { Grammar } from "../grammar.js"; import { Misc } from "../misc.js"; import { ENTITE_INCARNE, ENTITE_NONINCARNE } from "../constants.js"; import { RdDItemTete } from "../item/tete.js"; +import { ITEM_TYPES } from "../item.js"; const WHITESPACES = "\\s+" const NUMERIC = "[\\+\\-]?\\d+" @@ -193,6 +194,7 @@ export class RdDStatBlockParser { let newActor = await RdDBaseActorReve.create({ name, type, system: actorData, items }); await newActor.remiseANeuf() + await RdDStatBlockParser.adjustAttacks(newActor) await RdDStatBlockParser.setValeursActuelles(newActor, statString) await newActor?.sheet.render(true) } @@ -296,6 +298,21 @@ export class RdDStatBlockParser { } } + static async adjustAttacks(newActor) { + if (["creature", "entite"].includes(newActor.type)) { + const bonusDommages = newActor.getBonusDegat() + const ajustementAttaques = newActor.itemTypes[ITEM_TYPES.competencecreature].filter(it => it.system.iscombat) + .map(it => { + return { + _id: it.id, + 'system.categorie': 'melee', + 'system.dommages': it.system.dommages - bonusDommages + } + }) + await newActor.updateEmbeddedDocuments('Item', ajustementAttaques) + } + } + static async setValeursActuelles(newActor, statString) { const updates = { }