From b7cb0f0752433e64b66ef563718f6f3c8919757a Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 26 Nov 2024 22:35:05 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20recherche=20comp=C3=A9tence=20sans=20acce?= =?UTF-8?q?nts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- module/item-arme.js | 5 +++-- module/rdd-combat.js | 2 +- module/rdd-roll.js | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/module/item-arme.js b/module/item-arme.js index 0ce786e2..1d860dd4 100644 --- a/module/item-arme.js +++ b/module/item-arme.js @@ -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 } /* -------------------------------------------- */ diff --git a/module/rdd-combat.js b/module/rdd-combat.js index c64a0b4e..fb0a7c09 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -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'; diff --git a/module/rdd-roll.js b/module/rdd-roll.js index 296e9ca1..c7c69271 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -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) => {