#160 Afficher les totaux d'archetypes

This commit is contained in:
sladecraven 2021-02-22 21:15:10 +01:00
parent e5738aaca3
commit 1d96374b31
2 changed files with 24 additions and 0 deletions

View File

@ -41,11 +41,14 @@ export class RdDActorSheet extends ActorSheet {
data.itemsByType = Misc.classify(data.items); data.itemsByType = Misc.classify(data.items);
// Competence per category // Competence per category
data.data.comptageArchetype = RdDUtility.getLimitesArchetypes();
data.data.competenceXPTotal = 0; data.data.competenceXPTotal = 0;
data.competenceByCategory = Misc.classify( data.competenceByCategory = Misc.classify(
data.itemsByType.competence, data.itemsByType.competence,
item => item.data.categorie, item => item.data.categorie,
item => { 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.xpNext = RdDItemCompetence.getCompetenceNextXp(item.data.niveau);
item.data.isLevelUp = item.data.xp >= item.data.xpNext; // Flag de niveau à MAJ item.data.isLevelUp = item.data.xp >= item.data.xpNext; // Flag de niveau à MAJ
//this.actor.checkCompetenceXP(item.name); // Petite vérification experience //this.actor.checkCompetenceXP(item.name); // Petite vérification experience

View File

@ -22,6 +22,22 @@ const categorieCompetences = {
"lancer": { level: "-8", label: "Lancer" } "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 // 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"]; 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); return loadTemplates(templatePaths);
} }
/* -------------------------------------------- */
static getLimitesArchetypes( ) {
return duplicate(limitesArchetypes);
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static checkNull(items) { static checkNull(items) {
if (items && items.length) { if (items && items.length) {