Meilleure extraction du nom

- cas des entités non incarnées
This commit is contained in:
Vincent Vandemeulebrouck 2024-12-17 01:51:23 +01:00
parent ab61d5991d
commit 1f564e0d89

View File

@ -491,8 +491,7 @@ export class RdDStatBlockParser {
} }
static extractName(actorType, statString) { static extractName(actorType, statString) {
switch (actorType) { if (actorType == "personnage") {
case "personnage":
// Check if ',né le' is present // Check if ',né le' is present
let namePersonnage = "Importé" let namePersonnage = "Importé"
if (statString.includes(", né")) { if (statString.includes(", né")) {
@ -505,7 +504,14 @@ export class RdDStatBlockParser {
return Misc.upperFirst(namePersonnage?.value.toLowerCase()); return Misc.upperFirst(namePersonnage?.value.toLowerCase());
} }
} }
const name = XRegExp.exec(statString, XRegExp("(?<value>.+)\\s+taille", 'giu')); const name = XRegExp.exec(statString, XRegExp("(?<value>.+)\\s+taille", 'giu'));
if (actorType == "entite") {
if (!(name?.value)) {
const nameEntiteReve = XRegExp.exec(statString, XRegExp("(?<value>.+)\\s+rêve", 'giu'));
return Misc.upperFirst(nameEntiteReve?.value || "Importé");
}
}
return Misc.upperFirst(name?.value || "Importé"); return Misc.upperFirst(name?.value || "Importé");
} }