diff --git a/module/item-competence.js b/module/item-competence.js index dacf1b9f..3c735cdd 100644 --- a/module/item-competence.js +++ b/module/item-competence.js @@ -55,29 +55,34 @@ const competence_xp_cumul = _buildCumulXP(); export class RdDItemCompetence extends Item { + /* -------------------------------------------- */ static actorCompendium(actorType) { return compendiumCompetences[actorType]; } + /* -------------------------------------------- */ static getCategorieCompetences() { return categorieCompetences; } + /* -------------------------------------------- */ static getNiveauBase(category) { - return categorieCompetences[category].level; + return categorieCompetences[category].base; } + /* -------------------------------------------- */ static getLabelCategorie(category) { return categorieCompetences[category].label; } + /* -------------------------------------------- */ static getEsquive(competences) { return { name: 'Esquive', niveau: RdDItemCompetence.findCompetence(competences, 'Esquive')?.data.niveau ?? -6 }; } /* -------------------------------------------- */ static isCompetenceArme(competence) { - switch (competence.data.categorie) { + switch (competence.data.data.categorie) { case 'melee': - return competence.name != 'Esquive'; + return competence.data.name != 'Esquive'; case 'tir': case 'lancer': return true; @@ -169,11 +174,13 @@ export class RdDItemCompetence extends Item { return economie; } + /* -------------------------------------------- */ static levelUp(itemData) { itemData.data.xpNext = RdDItemCompetence.getCompetenceNextXp(itemData.data.niveau); itemData.data.isLevelUp = itemData.data.xp >= itemData.data.xpNext; } + /* -------------------------------------------- */ static isVisible(itemData) { return Number(itemData.data.niveau) != RdDItemCompetence.getNiveauBase(itemData.data.categorie); } diff --git a/module/item-sheet.js b/module/item-sheet.js index cd298a3f..5803f4b6 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -65,8 +65,9 @@ export class RdDItemSheet extends ItemSheet { formData.caracList = duplicate(game.system.model.Actor.personnage.carac); formData.competences = await RdDUtility.loadCompendium( 'foundryvtt-reve-de-dragon.competences' ); } - if (formData.type == 'arme') { + if (formData.type == 'arme') { formData.competences = await RdDUtility.loadCompendium( 'foundryvtt-reve-de-dragon.competences', it => RdDItemCompetence.isCompetenceArme(it)); + console.log(formData.competences); } if ( formData.type == 'recettealchimique' ) { RdDAlchimie.processManipulation(formData.item, this.actor && this.actor.id ); diff --git a/templates/item-arme-sheet.html b/templates/item-arme-sheet.html index e7ee4b32..b39d65e5 100644 --- a/templates/item-arme-sheet.html +++ b/templates/item-arme-sheet.html @@ -11,7 +11,7 @@
diff --git a/templates/item-competence-sheet.html b/templates/item-competence-sheet.html index cd31eb19..933f9ace 100644 --- a/templates/item-competence-sheet.html +++ b/templates/item-competence-sheet.html @@ -17,7 +17,7 @@
@@ -33,7 +33,7 @@
@@ -41,7 +41,7 @@
diff --git a/templates/item-sort-sheet.html b/templates/item-sort-sheet.html index a10a79ec..938bb0d2 100644 --- a/templates/item-sort-sheet.html +++ b/templates/item-sort-sheet.html @@ -11,7 +11,7 @@
@@ -19,7 +19,7 @@