Fix: rollCarac pour odorat-goût

Recherche d'abord par clé (name)
This commit is contained in:
Vincent Vandemeulebrouck 2022-10-27 22:37:55 +02:00
parent ea7132468d
commit f2d1879135
1 changed files with 5 additions and 1 deletions

View File

@ -3164,7 +3164,11 @@ export class RdDActor extends Actor {
case 'chance-actuelle': case 'chance actuelle':
return carac.chance;
}
let entry = Misc.findFirstLike(name, Object.entries(carac), { mapper: it => it[1].label, description: 'caractéristique' });
const caracList = Object.entries(carac);
let entry = Misc.findFirstLike(name, caracList, { mapper: it => it[0], description: 'caractéristique' });
if (!entry || entry.length ==0) {
entry = Misc.findFirstLike(name, caracList, { mapper: it => it[1].label, description: 'caractéristique' });
}
return entry && entry.length > 0 ? carac[entry[0]] : undefined;
}