Fix recherche compétence sans accents

La recherche était case-sensitive, du coup corriger le nom de la
compétence 'Epées' dans le compendium des compétences rend
les Épées inutilisable (et échec au chargement de la fiche)
This commit is contained in:
Vincent Vandemeulebrouck 2024-11-26 22:35:05 +01:00
parent 9b31f25640
commit b7cb0f0752
3 changed files with 7 additions and 5 deletions

View File

@ -1,3 +1,4 @@
import { Grammar } from "./grammar.js";
import { RdDItemCompetenceCreature } from "./item-competencecreature.js"
import { ITEM_TYPES } from "./item.js";
import { RdDCombatManager } from "./rdd-combat.js";
@ -56,8 +57,8 @@ export class RdDItemArme extends Item {
}
static niveauCompetenceArme(arme, competences) {
const compArme = competences.find(it => it.name == arme.system.competence);
return compArme?.system.niveau ?? -8;
const compArme = competences.find(it => Grammar.equalsInsensitive(it.name, arme.system.competence))
return compArme?.system.niveau ?? -8
}
/* -------------------------------------------- */

View File

@ -226,7 +226,7 @@ export class RdDCombatManager extends Combat {
}
static $prepareAttaqueArme(infoAttaque) {
const comp = infoAttaque.competences.find(c => c.name == infoAttaque.competence);
const comp = infoAttaque.competences.find(it => Grammar.equalsInsensitive(it.name, infoAttaque.competence))
const arme = infoAttaque.arme;
const attaque = foundry.utils.duplicate(arme);
attaque.action = 'attaque';

View File

@ -7,6 +7,7 @@ import { RdDBonus } from "./rdd-bonus.js";
import { RdDCarac } from "./rdd-carac.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";
import { Grammar } from "./grammar.js";
/**
* Extend the base Dialog entity to select roll parameters
@ -173,8 +174,8 @@ export class RdDRoll extends Dialog {
this.html.find("[name='diffLibre']").val(this.rollData.diffLibre);
});
this.html.find('.roll-carac-competence').change((event) => {
const competence = event.currentTarget.value;
this.rollData.competence = this.rollData.competences.find(it => it.name == competence);
const competence = event.currentTarget.value
this.rollData.competence = this.rollData.competences.find(it => Grammar.equalsInsensitive(it.name, competence))
this.updateRollResult(html);
});
this.html.find('.select-suivant-coeur').change((event) => {