12.0.29 - L'indexation d'Astrobazzarh #732

Merged
uberwald merged 6 commits from VincentVk/foundryvtt-reve-de-dragon:v11 into v11 2024-12-17 07:12:00 +01:00
Showing only changes of commit 5a5b5cdbb3 - Show all commits

View File

@ -6,6 +6,7 @@ import { Grammar } from "../grammar.js";
import { Misc } from "../misc.js"; import { Misc } from "../misc.js";
import { ENTITE_INCARNE, ENTITE_NONINCARNE } from "../constants.js"; import { ENTITE_INCARNE, ENTITE_NONINCARNE } from "../constants.js";
import { RdDItemTete } from "../item/tete.js"; import { RdDItemTete } from "../item/tete.js";
import { ITEM_TYPES } from "../item.js";
const WHITESPACES = "\\s+" const WHITESPACES = "\\s+"
const NUMERIC = "[\\+\\-]?\\d+" const NUMERIC = "[\\+\\-]?\\d+"
@ -193,6 +194,7 @@ export class RdDStatBlockParser {
let newActor = await RdDBaseActorReve.create({ name, type, system: actorData, items }); let newActor = await RdDBaseActorReve.create({ name, type, system: actorData, items });
await newActor.remiseANeuf() await newActor.remiseANeuf()
await RdDStatBlockParser.adjustAttacks(newActor)
await RdDStatBlockParser.setValeursActuelles(newActor, statString) await RdDStatBlockParser.setValeursActuelles(newActor, statString)
await newActor?.sheet.render(true) 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) { static async setValeursActuelles(newActor, statString) {
const updates = { const updates = {
} }