Recherche des caractéristiques de créature
La recherche des caractéristiques de créatures cherche aussi dans les caractéristiques de leurs compétences
This commit is contained in:
@@ -23,7 +23,7 @@ export class RdDBaseActor extends Actor {
|
||||
}
|
||||
|
||||
static $findCaracByName(carac, name) {
|
||||
const caracList = Object.entries(carac);
|
||||
const caracList = Object.entries(carac)
|
||||
let entry = Misc.findFirstLike(name, caracList, { mapper: it => it[0], description: 'caractéristique', onMessage: m => { } });
|
||||
if (!entry || entry.length == 0) {
|
||||
entry = Misc.findFirstLike(name, caracList, { mapper: it => it[1].label, description: 'caractéristique' });
|
||||
@@ -166,14 +166,22 @@ export class RdDBaseActor extends Actor {
|
||||
return this.system.sante.vie
|
||||
}
|
||||
|
||||
const carac = this.system.carac;
|
||||
const carac = {}
|
||||
foundry.utils.mergeObject(carac, this.system.carac, { overwrite: false })
|
||||
foundry.utils.mergeObject(carac, this.getCaracCompetenceCreature(), { overwrite: false })
|
||||
return RdDBaseActor.$findCaracByName(carac, name);
|
||||
}
|
||||
|
||||
getCaracCompetenceCreature() {
|
||||
return this.isCreatureOuEntite()
|
||||
? Object.fromEntries(this.itemTypes[ITEM_TYPES.competencecreature].map(it => [Grammar.toLowerCaseNoAccent(it.name), { label: it.name, value: it.system.carac_value }]))
|
||||
: {}
|
||||
}
|
||||
|
||||
mapCarac(caracCode) { return caracCode }
|
||||
|
||||
getCaracByName(name) {
|
||||
name = this.mapCarac(Grammar.toLowerCaseNoAccent(name))
|
||||
name = this.mapCarac(Grammar.toLowerCaseNoAccent(name)) ?? name
|
||||
switch (name) {
|
||||
case 'reve-actuel': case 'reve actuel':
|
||||
return this.getCaracReveActuel();
|
||||
|
||||
Reference in New Issue
Block a user