#64 compétences tronc manquantes

Fix des calculs d'expérience si les compétences tronc sont manquantes
This commit is contained in:
Vincent Vandemeulebrouck 2020-12-06 23:57:08 +01:00
parent d081dbf230
commit 8726ed3352

View File

@ -396,17 +396,21 @@ export class RdDUtility {
{ {
let xp = 0; let xp = 0;
for (let troncList of competenceTroncs) { for (let troncList of competenceTroncs) {
let minNiveau = 15; let minNiveau = 0;
for (let troncName of troncList) { for (let troncName of troncList) {
let comp = RdDUtility.findCompetence( competenceList, troncName); let comp = RdDUtility.findCompetence( competenceList, troncName);
minNiveau = (comp.data.niveau < minNiveau) ? comp.data.niveau : minNiveau; if (comp) {
minNiveau = Math.min(comp.data.niveau, minNiveau);
}
} }
if ( minNiveau > 0 ) minNiveau = 0; // Clamp à 0, pour le tronc commun minNiveau = Math.max(minNiveau, 0); // Clamp à 0, pour le tronc commun
let minNiveauXP = competence_xp_par_niveau[minNiveau+10]; let minNiveauXP = competence_xp_par_niveau[minNiveau+10];
xp += minNiveauXP; xp += minNiveauXP;
for (let troncName of troncList) { for (let troncName of troncList) {
let comp = RdDUtility.findCompetence( competenceList, troncName); let comp = RdDUtility.findCompetence( competenceList, troncName);
xp += competence_xp_par_niveau[comp.data.niveau+10] - minNiveauXP; if (comp){
xp += competence_xp_par_niveau[comp.data.niveau+10] - minNiveauXP;
}
} }
} }
return xp; return xp;