feat(combat): sélecteur de spécialité dans le dialogue d'attaque

- 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
This commit is contained in:
2026-08-09 08:54:08 +02:00
parent edd1819c86
commit 3a84ef09f6
2 changed files with 46 additions and 1 deletions
+10 -1
View File
@@ -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() {
+36
View File
@@ -66,6 +66,42 @@
</div>
</div>
<!-- SPECIALTIES (limited to the attack skill) -->
{{#if availableSpecialties.length}}
<details class="specialties-section">
<summary class="flexrow">
<span class="label">{{localize 'VERMINE.specialty'}} (+1D)</span>
<span class="current-specialty">{{localize 'VERMINE.none'}}</span>
</summary>
<div class="flexrow specialty-options">
<label class="flexrow">
<input
type="radio"
data-roll="true"
name="usingSpecialization"
id="usingSpecialization"
value="aucune"
checked
/>
<span>{{localize 'VERMINE.none'}}</span>
</label>
{{#each availableSpecialties as |spec ind|}}
<label class="flexrow">
<input
type="radio"
data-roll="true"
name="usingSpecialization"
id="usingSpecialization"
value="{{spec.name}}"
data-spec-skill="{{spec.system.skill}}"
/>
<span>{{spec.name}}</span>
</label>
{{/each}}
</div>
</details>
{{/if}}
<!-- DIFFICULTY -->
<details class="difficulty-section" open>
<summary class="flexrow">