Compare commits

...

3 Commits

Author SHA1 Message Date
a7666ec307 Tri alphabétique des choix
Permet d'avoir un choix prévisible quand plusieurs choix
s'appliquent (par exemple plusieurs compétences)
2025-01-31 20:23:18 +01:00
0773493851 Fix type rareté 'egal' 2025-01-31 20:21:52 +01:00
da982678b7 Fix: appel expérience sur /rdd 2025-01-31 20:20:55 +01:00
3 changed files with 7 additions and 9 deletions

View File

@ -1800,17 +1800,14 @@ export class RdDActor extends RdDBaseActorSang {
}; };
RollDataAjustements.calcul(rollData, this); RollDataAjustements.calcul(rollData, this);
await RdDResolutionTable.rollData(rollData); await RdDResolutionTable.rollData(rollData);
this._gererExperience(rollData); this.gererExperience(rollData);
await RdDRollResult.displayRollData(rollData, this) await RdDRollResult.displayRollData(rollData, this)
return rollData.rolled; return rollData.rolled;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
gererExperience(rollData) { gererExperience(rollData) {
const callback = this.createCallbackExperience(); this.createCallbackExperience().action(rollData);
if (callback.condition(rollData)) {
callback.action(rollData);
}
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -4,9 +4,9 @@ const RARETE_FREQUENTE = { code: 'Frequente', label: 'Fréquente', frequence: 18
const RARETE_RARE = { code: 'Rare', label: 'Rare', frequence: 6, min: 3, max: 12 }; const RARETE_RARE = { code: 'Rare', label: 'Rare', frequence: 6, min: 3, max: 12 };
const RARETE_RARISSIME = { code: 'Rarissime', label: 'Rarissime', frequence: 2, min: 1, max: 4 }; const RARETE_RARISSIME = { code: 'Rarissime', label: 'Rarissime', frequence: 2, min: 1, max: 4 };
const RARETE_INEXISTANT = { code: 'Inexistant', label: 'Inexistant', frequence: 0, min: 0, max: 0 }; const RARETE_INEXISTANT = { code: 'Inexistant', label: 'Inexistant', frequence: 0, min: 0, max: 0 };
const RARETE_EGALE = { code: 'eqal', label: 'Egal', frequence: 1, min: 1, max: 1 }; const RARETE_EGALE = { code: 'egal', label: 'Egal', frequence: 1, min: 1, max: 1 };
const RARETES = [ export const RARETES = [
RARETE_COMMUNE, RARETE_COMMUNE,
RARETE_FREQUENTE, RARETE_FREQUENTE,
RARETE_RARE, RARETE_RARE,

View File

@ -238,7 +238,7 @@ export class Misc {
/* -------------------------------------------- */ /* -------------------------------------------- */
static findFirstLike(value, elements, options = {}) { static findFirstLike(value, elements, options = {}) {
options = foundry.utils.mergeObject(DEFAULT_FIND_OPTIONS, options, { overwrite: true, inplace: false }); options = foundry.utils.mergeObject(DEFAULT_FIND_OPTIONS, options, { overwrite: true, inplace: false });
const subset = this.findAllLike(value, elements, options); const subset = this.findAllLike(value, elements, options)
if (subset.length == 0) { if (subset.length == 0) {
console.log(`Aucune ${options.description} pour ${value}`); console.log(`Aucune ${options.description} pour ${value}`);
return undefined return undefined
@ -263,7 +263,8 @@ export class Misc {
} }
value = Grammar.toLowerCaseNoAccent(value); value = Grammar.toLowerCaseNoAccent(value);
const subset = elements.filter(options.preFilter) const subset = elements.filter(options.preFilter)
.filter(it => Grammar.toLowerCaseNoAccent(options.mapper(it))?.includes(value)); .filter(it => Grammar.toLowerCaseNoAccent(options.mapper(it))?.includes(value))
.sort(Misc.ascending(it => options.mapper? options.mapper(it) : it))
if (subset.length == 0) { if (subset.length == 0) {
options.onMessage(`Pas de ${options.description} correspondant à ${value}`); options.onMessage(`Pas de ${options.description} correspondant à ${value}`);
} }