Ajustement dommages créatures
Les bonus aux dommages des créatures et entitées sont intégrés dans les données importées, il faut donc retirer le plusdom de l'acteur après création
This commit is contained in:
parent
f90dddfbf8
commit
5a5b5cdbb3
@ -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 = {
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user