diff --git a/module/item-competence.js b/module/item-competence.js index c2cdcb78..f61d1310 100644 --- a/module/item-competence.js +++ b/module/item-competence.js @@ -85,9 +85,9 @@ export class RdDItemCompetence extends Item { /* -------------------------------------------- */ static getVoieDraconic(competences, voie) { return RdDItemCompetence.findFirstItem(competences, voie, { - preFilter: it => it.isCompetence() && RdDItemCompetence.isDraconic(it), - description: 'Draconic', - }); + preFilter: it => it.isCompetence() && RdDItemCompetence.isDraconic(it), + description: 'Draconic', + }); } /* -------------------------------------------- */ @@ -199,7 +199,7 @@ export class RdDItemCompetence extends Item { item.system.isStressLevelUp = (xpManquant > 0 && stressTransforme >= xpManquant && item.system.niveau < item.system.niveau_archetype); item.system.stressXpMax = 0; if (xpManquant > 0 && stressTransforme > 0 && item.system.niveau < item.system.niveau_archetype) { - item.system.stressXpMax = Math.min(xpManquant , stressTransforme); + item.system.stressXpMax = Math.min(xpManquant, stressTransforme); } } @@ -219,10 +219,10 @@ export class RdDItemCompetence extends Item { /* -------------------------------------------- */ static findCompetence(list, idOrName, options = {}) { - if (idOrName == undefined) { - return undefined; + if (idOrName == undefined || idOrName == "") { + return RdDItemCompetence.sansCompetence(); } - options = mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence' }, {overwrite: false}); + options = mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence' }, { overwrite: false }); return RdDItemCompetence.findFirstItem(list, idOrName, options); } @@ -231,6 +231,23 @@ export class RdDItemCompetence extends Item { return Misc.findAllLike(name, list, { filter: it => it.isCompetence(), description: 'compétence' }); } + static sansCompetence() { + return { + name: "Sans compétence", + type: "competence", + img: "systems/foundryvtt-reve-de-dragon/icons/templates/icone_parchement_vierge.webp", + system: { + niveau: 0, + default_diffLibre: 0, + base: 0, + categorie: "Aucune", + description: "", + descriptionmj: "", + defaut_carac: "", + } + }; + } + static findFirstItem(list, idOrName, options) { return list.find(it => it.id == idOrName && options.preFilter(it)) ?? Misc.findFirstLike(idOrName, list, options); diff --git a/template.json b/template.json index 2f567bc6..d25dfcbd 100644 --- a/template.json +++ b/template.json @@ -746,9 +746,9 @@ "carac": "", "competence": "", "periodicite": "", - "fatigue": 0, + "fatigue": 1, "difficulte": 0, - "points_de_tache": 0, + "points_de_tache": 4, "points_de_tache_courant": 0, "nb_jet_echec": 0, "nb_jet_succes": 0, diff --git a/templates/item-tache-sheet.html b/templates/item-tache-sheet.html index cd64c489..880b7676 100644 --- a/templates/item-tache-sheet.html +++ b/templates/item-tache-sheet.html @@ -16,6 +16,7 @@