Calculs des informations dérivées

Calcul automatique des informations dérivées:
- vie max
- endurance max
- bonus dommages

Ces informations ne peuvent plus être saisies.

L'endurance max des animaux est vie+constitution.
Les entités non-incarnées n'ont pas de +dom
This commit is contained in:
2024-12-04 15:55:09 +01:00
parent e98a793506
commit f13677106e
16 changed files with 119 additions and 92 deletions

View File

@ -18,6 +18,7 @@ export class RdDBaseActor extends Actor {
.map(it => it[0])
.find(it => it)
}
static $findCaracByName(carac, name) {
const caracList = Object.entries(carac);
let entry = Misc.findFirstLike(name, caracList, { mapper: it => it[0], description: 'caractéristique' });
@ -26,6 +27,16 @@ export class RdDBaseActor extends Actor {
}
return entry && entry.length > 0 ? carac[entry[0]] : undefined;
}
static getDefaultValue(actorType, path) {
if (path.includes('.')) {
path = path.split('.')
}
let obj = game.model.Actor[actorType]
for (let p of path) {
obj = obj ? obj[p] : undefined
}
return obj
}
static getDefaultImg(itemType) {
return game.system.rdd.actorClasses[itemType]?.defaultIcon ?? defaultItemImg[itemType];
@ -178,7 +189,8 @@ export class RdDBaseActor extends Actor {
this.computeEncTotal()
}
async prepareActorData() { }
prepareActorData() { }
async computeEtatGeneral() { }
/* -------------------------------------------- */
findPlayer() {
@ -210,6 +222,9 @@ export class RdDBaseActor extends Actor {
getMonnaie(id) { return this.findItemLike(id, 'monnaie'); }
getEncombrementMax() { return 0 }
/* -------------------------------------------- */
async updateCarac(caracName, to) {
}
/* -------------------------------------------- */
async onPreUpdateItem(item, change, options, id) { }
async onCreateItem(item, options, id) { }