feat: lancer les armes via la boîte de dialogue avec compétence
Ajoute un champ compétence au modèle arme, un sélecteur dans la fiche d'arme et ouvre la boîte de dialogue de jet pré-remplie au clic sur l'icône dé (réservé aux acteurs disposant d'aptitudes/compétences).
This commit is contained in:
@@ -230,6 +230,17 @@ export default class VermineBaseActorSheet extends HandlebarsApplicationMixin(fo
|
||||
const id = target.closest("[data-item-id]")?.dataset?.itemId
|
||||
if (!id) return
|
||||
const item = this.document.items.get(id)
|
||||
if (!item) return
|
||||
if (item.type === "weapon" && this.document.system.abilities && this.document.system.skills) {
|
||||
const { default: RollDialog } = await import("../../system/dialogs/rollDialog.mjs")
|
||||
const dialog = await RollDialog.create({
|
||||
actorId: this.document.id,
|
||||
rolltype: "skill",
|
||||
label: item.system.skill
|
||||
})
|
||||
if (dialog) dialog.render(true)
|
||||
return
|
||||
}
|
||||
item?.roll()
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ export default class VermineWeaponData extends foundry.abstract.TypeDataModel {
|
||||
const reqInt = { required: true, nullable: false, integer: true }
|
||||
return {
|
||||
...baseItemSchema(),
|
||||
skill: new fields.StringField({ required: true, nullable: false, initial: "" }),
|
||||
min_range: new fields.NumberField({ ...reqInt, initial: 0, min: 0 }),
|
||||
max_range: new fields.NumberField({ ...reqInt, initial: 0, min: 0 }),
|
||||
damage: new fields.SchemaField({
|
||||
|
||||
@@ -3,6 +3,29 @@
|
||||
|
||||
|
||||
<section class="sheet-body">
|
||||
<div class="flexrow">
|
||||
<label class="resource-label" for="system.skill">{{ localize 'VERMINE.skill_title'}}</label>
|
||||
<select
|
||||
name="system.skill"
|
||||
class="skill-select"
|
||||
>
|
||||
{{#each @root.config.skillCategories as |skillCategory sckey|}}
|
||||
<optgroup label="{{ smarttlk 'SKILLS_CATEGORIES' sckey 'name' }}">
|
||||
{{#each @root.config.skills as |skill key|}}
|
||||
{{#ife skill.category sckey}}
|
||||
<option
|
||||
value="{{key}}"
|
||||
{{#ife key @root.system.skill}}
|
||||
selected
|
||||
{{/ife}}
|
||||
>{{ smarttlk 'SKILLS' key 'name' }}</option>
|
||||
{{/ife}}
|
||||
{{/each}}
|
||||
</optgroup>
|
||||
{{/each}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{> "systems/vermine2047/templates/item/partials/traits.hbs"}}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user