From 1d96374b31d1cfb1c324f9881f715ea0e09ac249 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Mon, 22 Feb 2021 21:15:10 +0100 Subject: [PATCH] #160 Afficher les totaux d'archetypes --- module/actor-sheet.js | 3 +++ module/rdd-utility.js | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index b9d67299..22abd450 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -41,11 +41,14 @@ export class RdDActorSheet extends ActorSheet { data.itemsByType = Misc.classify(data.items); // Competence per category + data.data.comptageArchetype = RdDUtility.getLimitesArchetypes(); data.data.competenceXPTotal = 0; data.competenceByCategory = Misc.classify( data.itemsByType.competence, item => item.data.categorie, item => { + let archetypeKey = (item.data.niveau_archetype < 0) ? 0 : item.data.niveau_archetype; + data.data.comptageArchetype[archetypeKey].nombre = data.data.comptageArchetype[archetypeKey].nombre + 1; //Comptage archetype item.data.xpNext = RdDItemCompetence.getCompetenceNextXp(item.data.niveau); item.data.isLevelUp = item.data.xp >= item.data.xpNext; // Flag de niveau à MAJ //this.actor.checkCompetenceXP(item.name); // Petite vérification experience diff --git a/module/rdd-utility.js b/module/rdd-utility.js index de605b65..9f8340c6 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -22,6 +22,22 @@ const categorieCompetences = { "lancer": { level: "-8", label: "Lancer" } } +/* -------------------------------------------- */ +const limitesArchetypes = [ + { "niveau": 0, "nombreMax": 100, "nombre":0}, + { "niveau": 1, "nombreMax": 10, "nombre":0}, + { "niveau": 2, "nombreMax": 9, "nombre":0}, + { "niveau": 3, "nombreMax": 8, "nombre":0}, + { "niveau": 4, "nombreMax": 7, "nombre":0}, + { "niveau": 5, "nombreMax": 6, "nombre":0}, + { "niveau": 6, "nombreMax": 5, "nombre":0}, + { "niveau": 7, "nombreMax": 4, "nombre":0}, + { "niveau": 8, "nombreMax": 3, "nombre":0}, + { "niveau": 9, "nombreMax": 2, "nombre":0}, + { "niveau": 10, "nombreMax": 1, "nombre":0}, + { "niveau": 11, "nombreMax": 1, "nombre":0} +]; + /* -------------------------------------------- */ // This table starts at 0 -> niveau -10 const carac_array = ["taille", "apparence", "constitution", "force", "agilite", "dexterite", "vue", "ouie", "odoratgout", "volonte", "intellect", "empathie", "reve", "chance", "melee", "tir", "lancer", "derobee"]; @@ -262,6 +278,11 @@ export class RdDUtility { return loadTemplates(templatePaths); } + /* -------------------------------------------- */ + static getLimitesArchetypes( ) { + return duplicate(limitesArchetypes); + } + /* -------------------------------------------- */ static checkNull(items) { if (items && items.length) {