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:
@@ -153,7 +153,8 @@ export default class CombatDialog extends HandlebarsApplicationMixin(foundry.app
|
|||||||
lockedDifficulty,
|
lockedDifficulty,
|
||||||
defaultDifficulty,
|
defaultDifficulty,
|
||||||
hasAmmo: this.mode === "ranged" && (this.weapon?.system?.ammo ?? 0) > 0,
|
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"),
|
availableItems: actor.items.filter(i => i.type === "item"),
|
||||||
targets,
|
targets,
|
||||||
lourdMalus: VermineTraits.lourdMalus(actor),
|
lourdMalus: VermineTraits.lourdMalus(actor),
|
||||||
@@ -330,6 +331,14 @@ export default class CombatDialog extends HandlebarsApplicationMixin(foundry.app
|
|||||||
if (handSel && handEl) {
|
if (handSel && handEl) {
|
||||||
handEl.textContent = handSel.options[handSel.selectedIndex]?.text ?? "";
|
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() {
|
#onInputChange() {
|
||||||
|
|||||||
@@ -66,6 +66,42 @@
|
|||||||
</div>
|
</div>
|
||||||
</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 -->
|
<!-- DIFFICULTY -->
|
||||||
<details class="difficulty-section" open>
|
<details class="difficulty-section" open>
|
||||||
<summary class="flexrow">
|
<summary class="flexrow">
|
||||||
|
|||||||
Reference in New Issue
Block a user