Fix: recherche carac plus lisible

This commit is contained in:
Vincent Vandemeulebrouck 2022-10-27 22:37:20 +02:00
parent 5d32f7e493
commit f388d6550c

View File

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