diff --git a/module/actor-sheet.js b/module/actor-sheet.js index bf904505..97519218 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -14,7 +14,7 @@ export class RdDActorSheet extends ActorSheet { template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html", width: 640, height: 720, - tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description"}], + tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac"}], dragDrop: [{dragSelector: ".item-list .item", dropSelector: null}] }); } @@ -53,10 +53,12 @@ export class RdDActorSheet extends ActorSheet { list = []; data.competenceByCategory[item.data.categorie] = list; } - competenceXPTotal += RdDUtility.computeCompetenceXPCost(item) + if (!RdDUtility.isTronc( item.name ) ) // Ignorer les compétences 'troncs' à ce stade + competenceXPTotal += RdDUtility.computeCompetenceXPCost(item) list.push(item); } } + competenceXPTotal += RdDUtility.computeCompetenceTroncXP(data.itemsByType.competence); data.data.competenceXPTotal = competenceXPTotal; //console.log("XP competence : ", competenceXPTotal); diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 09ef92fe..a55a7bd2 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -252,6 +252,27 @@ export class RdDUtility { return xp; } + /* -------------------------------------------- */ + static computeCompetenceTroncXP( competenceList ) + { + let xp = 0; + for (let troncList of competenceTroncs) { + let minNiveau = 15; + for (let troncName of troncList) { + let comp = RdDUtility.findCompetence( competenceList, troncName); + minNiveau = (comp.data.niveau < minNiveau) ? comp.data.niveau : minNiveau; + } + if ( minNiveau > 0 ) minNiveau = 0; // Clamp à 0, pour le tronc commun + let minNiveauXP = competence_xp_par_niveau[minNiveau+10]; + xp += minNiveauXP; + for (let troncName of troncList) { + let comp = RdDUtility.findCompetence( competenceList, troncName); + xp += competence_xp_par_niveau[comp.data.niveau+10] - minNiveauXP; + } + } + return xp; + } + /* -------------------------------------------- */ static computeCarac( data) { diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 7e48578b..01d37531 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -17,7 +17,7 @@
Sonné : - +
@@ -32,13 +32,6 @@
Blessure critique : {{data.nbCritiques}}
-
- {{#each data.compteurs as |compteur key|}} -
- {{compteur.label}} : {{compteur.value}} -
- {{/each}} -
@@ -47,6 +40,7 @@ Caractéristiques Compétences Combat + Compteurs Blessures Haut-Rêve Equipement @@ -280,6 +274,18 @@ + {{!-- Compteurs Tab --}} +
+
    + {{#each data.compteurs as |compteur key|}} +
  1. + {{compteur.label}} + {{compteur.value}} +
  2. + {{/each}} +
+ + {{!-- blessures Tab --}}
Blessures Légeres :