Fix sur armes et affichage

This commit is contained in:
LeRatierBretonnien 2023-03-09 00:26:52 +01:00
parent 2f3a8e91bd
commit b0a3cb08cb
5 changed files with 65 additions and 44 deletions

View File

@ -141,6 +141,11 @@ export class HeritiersActorSheet extends ActorSheet {
let compId = li.data("item-id")
this.actor.rollCompetence(compId)
})
html.find('.roll-attaque-arme').click((event) => {
const li = $(event.currentTarget).parents(".item")
let armeId = li.data("item-id")
this.actor.rollAttaqueArme(armeId)
})
html.find('.item-add').click((event) => {
const itemType = $(event.currentTarget).data("type")

View File

@ -142,7 +142,7 @@ export class HeritiersActor extends Actor {
return this.items.filter(item => item.type == "profil")
}
getPouvoirs() {
let pouvoirs = this.items.filter(item => item.type == "pouvoir")
let pouvoirs = this.items.filter(item => item.type == "pouvoir") || []
HeritiersUtility.sortArrayObjectsByName(pouvoirs)
return pouvoirs
}
@ -184,7 +184,9 @@ export class HeritiersActor extends Actor {
}
}
}
HeritiersUtility.sortArrayObjectsByName(comp)
for (let key in comp) {
HeritiersUtility.sortArrayObjectsByName(comp[key])
}
return comp
}
/* -------------------------------------------- */
@ -551,7 +553,24 @@ export class HeritiersActor extends Actor {
let rollDialog = await HeritiersRollDialog.create(this, rollData)
rollDialog.render(true)
}
/* -------------------------------------------- */
async rollAttaqueArme(armeId) {
let arme = this.items.get(armeId)
if (arme) {
let competenceName = "Tir"
let key = "prec"
if (arme.system.categorie == "blanche" || arme.system.categorie == "improvise") {
competenceName = "Mêlée"
key = "agi"
}
let rollData = this.getCommonRollData(undefined, competenceName )
rollData.carac = this.system.caracteristiques[key]
rollData.caracKey = key
rollData.mode = "arme"
let rollDialog = await HeritiersRollDialog.create(this, rollData)
rollDialog.render(true)
}
}
/* -------------------------------------------- */
async rollArmeOffensif(armeId) {
let arme = this.items.get(armeId)

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
{
"id": "fvtt-les-heritiers",
"description": "Les Héritiers pour FoundryVTT",
"version": "10.0.20",
"version": "10.0.21",
"authors": [
{
"name": "Uberwald/LeRatierBretonnien",
@ -19,7 +19,7 @@
"gridUnits": "m",
"license": "LICENSE.txt",
"manifest": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/raw/branch/master/system.json",
"download": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/archive/fvtt-les-heritiers-10.0.20.zip",
"download": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/archive/fvtt-les-heritiers-10.0.21.zip",
"languages": [
{
"lang": "fr",

View File

@ -208,9 +208,6 @@
<span class="item-field-label-short">
<label class="short-label">Attaque</label>
</span>
<span class="item-field-label-short">
<label class="short-label">Défense</label>
</span>
<span class="item-field-label-short">
<label class="short-label">Dégats</label>
</span>
@ -226,7 +223,7 @@
<span class="item-name-label competence-name">{{arme.name}}</span>
<span class="item-field-label-short">
<button class="roll-arme-offensif button-sheet-roll">Attaquer</button>
<button class="roll-attaque-arme button-sheet-roll">Attaquer</button>
</span>
<span class="item-field-label-short">