XP compute and sheet re-org

This commit is contained in:
sladecraven 2020-08-14 22:24:35 +02:00
parent 5fa82a5ee7
commit 5aaf1ca204
3 changed files with 39 additions and 10 deletions

View File

@ -14,7 +14,7 @@ export class RdDActorSheet extends ActorSheet {
template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html", template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html",
width: 640, width: 640,
height: 720, 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}] dragDrop: [{dragSelector: ".item-list .item", dropSelector: null}]
}); });
} }
@ -53,10 +53,12 @@ export class RdDActorSheet extends ActorSheet {
list = []; list = [];
data.competenceByCategory[item.data.categorie] = 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); list.push(item);
} }
} }
competenceXPTotal += RdDUtility.computeCompetenceTroncXP(data.itemsByType.competence);
data.data.competenceXPTotal = competenceXPTotal; data.data.competenceXPTotal = competenceXPTotal;
//console.log("XP competence : ", competenceXPTotal); //console.log("XP competence : ", competenceXPTotal);

View File

@ -252,6 +252,27 @@ export class RdDUtility {
return xp; 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) static computeCarac( data)
{ {

View File

@ -17,7 +17,7 @@
</div> </div>
<div> <div>
<span>Sonné :</span> <span>Sonné :</span>
<input class="resource-content" type="checkbox" name="data.sante.sonne.value" value="{{data.sante.sonne.value}} {{#if data.sante.sonne.value}}checked{{/if}}"/> <input class="resource-content" type="checkbox" name="data.sante.sonne.value" value="{{data.sante.sonne.value}}" {{#if data.sante.sonne.value}}checked{{/if}} />
</div> </div>
</div> </div>
<div class="flex-group-center flex-fatigue"> <div class="flex-group-center flex-fatigue">
@ -32,13 +32,6 @@
<div class="flex-group-center">Blessure critique : {{data.nbCritiques}}</div> <div class="flex-group-center">Blessure critique : {{data.nbCritiques}}</div>
</div> </div>
</div> </div>
<div class="flexrow">
{{#each data.compteurs as |compteur key|}}
<div class="flexcol flex-group-center">
{{compteur.label}} : {{compteur.value}}
</div>
{{/each}}
</div>
</div> </div>
</header> </header>
@ -47,6 +40,7 @@
<a class="item" data-tab="carac">Caractéristiques</a> <a class="item" data-tab="carac">Caractéristiques</a>
<a class="item" data-tab="competences">Compétences</a> <a class="item" data-tab="competences">Compétences</a>
<a class="item" data-tab="combat">Combat</a> <a class="item" data-tab="combat">Combat</a>
<a class="item" data-tab="compteur">Compteurs</a>
<a class="item" data-tab="blessures">Blessures</a> <a class="item" data-tab="blessures">Blessures</a>
<a class="item" data-tab="hautreve">Haut-Rêve</a> <a class="item" data-tab="hautreve">Haut-Rêve</a>
<a class="item" data-tab="items">Equipement</a> <a class="item" data-tab="items">Equipement</a>
@ -280,6 +274,18 @@
</ol> </ol>
</div> </div>
{{!-- Compteurs Tab --}}
<div class="tab compteur" data-group="primary" data-tab="compteur">
<ol class="item-list">
{{#each data.compteurs as |compteur key|}}
<li class="item flexrow"">
<span class="arme-label">{{compteur.label}}</span>
<span class="competence-label">{{compteur.value}}</span>
</li>
{{/each}}
</div>
</div>
{{!-- blessures Tab --}} {{!-- blessures Tab --}}
<div class="tab blessures" data-group="primary" data-tab="blessures" style="height:200px"> <div class="tab blessures" data-group="primary" data-tab="blessures" style="height:200px">
<span class="blessures-title">Blessures Légeres :</span> <span class="blessures-title">Blessures Légeres :</span>