diff --git a/changelog.md b/changelog.md index 5de3a264..037737e1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,8 @@ # 12.0 +## 12.0.39 - Les mains d'Astrobazzarh +- les armes à 1 ou 2 mains fonctionnent dans les liens de jets de dés +- commande `/jet` pour poster une demande de jet de dés + ## 12.0.38 - Les prévisions d'Astrobazzarh - Correction de modifications de personnages qui ne s'affichaient pas: - changements d'endurance/vie/fatigue, transformé, ... diff --git a/module/actor.js b/module/actor.js index 225c9c7c..c4f82a84 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1800,17 +1800,14 @@ export class RdDActor extends RdDBaseActorSang { }; RollDataAjustements.calcul(rollData, this); await RdDResolutionTable.rollData(rollData); - this._gererExperience(rollData); + this.gererExperience(rollData); await RdDRollResult.displayRollData(rollData, this) return rollData.rolled; } /* -------------------------------------------- */ gererExperience(rollData) { - const callback = this.createCallbackExperience(); - if (callback.condition(rollData)) { - callback.action(rollData); - } + this.createCallbackExperience().action(rollData); } /* -------------------------------------------- */ diff --git a/module/apps/textroll/text-roll-carac-competence.js b/module/apps/textroll/text-roll-carac-competence.js index 7c2f5572..aba13fa1 100644 --- a/module/apps/textroll/text-roll-carac-competence.js +++ b/module/apps/textroll/text-roll-carac-competence.js @@ -5,7 +5,7 @@ import { RdDUtility } from "../../rdd-utility.js"; import { TextRollManager } from "./text-roll-formatter.js"; const REGECP_CARAC = "(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)" -const REGEXP_COMP = "(\\/(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+))?" +const REGEXP_COMP = "(\\/(?[A-Za-z0-9À-ÖØ-öø-ÿ -]+))?" const REGEXP_DIFF = "(/(?[\\+\\-]?\\d+(d\\d+)?))?" const REGEXP_ROLL_CARAC_COMP = REGECP_CARAC + REGEXP_COMP + REGEXP_DIFF const XREGEXP_ROLL_CARAC_COMP = XRegExp("@roll\\[" + REGEXP_ROLL_CARAC_COMP + "\\]", 'giu') diff --git a/module/item/raretes.js b/module/item/raretes.js index eab72a12..851b50ae 100644 --- a/module/item/raretes.js +++ b/module/item/raretes.js @@ -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_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_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_FREQUENTE, RARETE_RARE, diff --git a/module/misc.js b/module/misc.js index 72530790..775dd2bc 100644 --- a/module/misc.js +++ b/module/misc.js @@ -238,7 +238,7 @@ export class Misc { /* -------------------------------------------- */ static findFirstLike(value, elements, options = {}) { 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) { console.log(`Aucune ${options.description} pour ${value}`); return undefined @@ -263,7 +263,8 @@ export class Misc { } value = Grammar.toLowerCaseNoAccent(value); 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(it))) if (subset.length == 0) { options.onMessage(`Pas de ${options.description} correspondant à ${value}`); } diff --git a/module/rdd-commands.js b/module/rdd-commands.js index 5345f9f0..158bc946 100644 --- a/module/rdd-commands.js +++ b/module/rdd-commands.js @@ -129,6 +129,16 @@ export class RdDCommands {
/rdd vol déser +2 effectue un jet de Volonté/Survie en désert à +2 pour les tokens sélectionnés ` }); + this.registerCommand({ + path: ["/jet"], func: (content, msg, params) => this.askRollRdd(msg, params), + descr: `Poste dans le tchat un jet de dés à effectuer. Exemples: +
/jet Vue Vigilance poste une demande de jet de VUE / Vigilance à 0 +
/jet Vue poste une demande de jet de VUE à 0 +
/jet Vue -2 poste une demande de jet de VUE à -2 +
/jet Vue Vigilance -2 poste une demande de jet de VUE / Vigilance à -2 +
/jet vol déser +2 poste une demande de jet de VOLONTÉ / Survie en désert à +2 + ` + }); this.registerCommand({ path: ["/ddr"], func: (content, msg, params) => this.rollDeDraconique(msg), descr: "Lance un Dé Draconique" }); this.registerCommand({ @@ -340,6 +350,25 @@ export class RdDCommands { } } } + async askRollRdd(msg, params) { + if (params.length == 0) { + return false + } + else { + let length = params.length; + let diff = Number(params[length - 1]); + if (Number.isInteger(Number(diff))) { + length--; + } + else { + diff = 0; + } + + const carac = params[0]; + const competence = length > 1 ? '/' + Misc.join(params.slice(1, length), ' ') : '' + ChatMessage.create({ content: `@roll[${carac}${competence}/${diff}]` }) + } + } /* -------------------------------------------- */ async rollRdDNumeric(msg, carac, diff, significative = false) {