From 3a84ef09f632f66e8424100d4e401b58d217d547 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnier Date: Sun, 9 Aug 2026 08:54:08 +0200 Subject: [PATCH] =?UTF-8?q?feat(combat):=20s=C3=A9lecteur=20de=20sp=C3=A9c?= =?UTF-8?q?ialit=C3=A9=20dans=20le=20dialogue=20d'attaque?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Le template combat-dialog.hbs n'affichait pas les spécialités alors que combatDialog.mjs les préparait : #hasSpecialtySelected() ne pouvait jamais être vrai, le +1D spécialité n'était jamais appliqué aux attaques - Affichage de la section spécialités (radio buttons) limitée aux spécialités de la compétence de l'arme (skillKey) - Affichage de la spécialité sélectionnée dans le résumé du dialogue (.current-specialty) et propagation du nom dans le message de jet --- module/system/dialogs/combatDialog.mjs | 11 +++++++- templates/dialogs/combat-dialog.hbs | 36 ++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/module/system/dialogs/combatDialog.mjs b/module/system/dialogs/combatDialog.mjs index e35d2ed..f9ffd93 100644 --- a/module/system/dialogs/combatDialog.mjs +++ b/module/system/dialogs/combatDialog.mjs @@ -153,7 +153,8 @@ export default class CombatDialog extends HandlebarsApplicationMixin(foundry.app lockedDifficulty, defaultDifficulty, hasAmmo: this.mode === "ranged" && (this.weapon?.system?.ammo ?? 0) > 0, - availableSpecialties: actor.items.filter(i => i.type === "specialty"), + // Specialties are only usable when they match the attack skill. + availableSpecialties: actor.items.filter(i => i.type === "specialty" && i.system?.skill === this.skillKey), availableItems: actor.items.filter(i => i.type === "item"), targets, lourdMalus: VermineTraits.lourdMalus(actor), @@ -330,6 +331,14 @@ export default class CombatDialog extends HandlebarsApplicationMixin(foundry.app if (handSel && handEl) { handEl.textContent = handSel.options[handSel.selectedIndex]?.text ?? ""; } + + const specChecked = this.#el.querySelector("input[name='usingSpecialization']:checked"); + const specEl = this.#el.querySelector(".current-specialty"); + if (specEl && specChecked) { + specEl.textContent = specChecked.value === "aucune" + ? game.i18n.localize("VERMINE.none") + : specChecked.value; + } } #onInputChange() { diff --git a/templates/dialogs/combat-dialog.hbs b/templates/dialogs/combat-dialog.hbs index 7801e2d..24520a2 100644 --- a/templates/dialogs/combat-dialog.hbs +++ b/templates/dialogs/combat-dialog.hbs @@ -66,6 +66,42 @@ + + {{#if availableSpecialties.length}} +
+ + {{localize 'VERMINE.specialty'}} (+1D) + {{localize 'VERMINE.none'}} + +
+ + {{#each availableSpecialties as |spec ind|}} + + {{/each}} +
+
+ {{/if}} +