Message XP

This commit is contained in:
sladecraven 2021-01-15 00:20:11 +01:00
parent f5cc5c2d51
commit 58b0a7b9c4

View File

@ -1450,7 +1450,7 @@ export class RdDActor extends Actor {
async checkCaracXP(caracName) { async checkCaracXP(caracName) {
let carac = this.data.data.carac[caracName]; let carac = this.data.data.carac[caracName];
if (carac && carac.xp > 0) { if (carac && carac.xp > 0) {
let xpNeeded = RdDUtility.getCaracNextXp(carac.value); let xpNeeded = RdDUtility.getCaracNextXp(carac.value+1);
if (carac.xp >= xpNeeded) { if (carac.xp >= xpNeeded) {
carac = duplicate(carac); carac = duplicate(carac);
carac.value = Number(carac.value) + 1; carac.value = Number(carac.value) + 1;
@ -1476,7 +1476,7 @@ export class RdDActor extends Actor {
} }
newXP = (newXP) ? newXP : competence.data.xp; newXP = (newXP) ? newXP : competence.data.xp;
if (competence && newXP > 0) { if (competence && newXP > 0) {
let xpNeeded = RdDItemCompetence.getCompetenceNextXp(competence.data.niveau); let xpNeeded = RdDItemCompetence.getCompetenceNextXp(competence.data.niveau+1);
if (newXP >= xpNeeded) { if (newXP >= xpNeeded) {
let newCompetence = duplicate(competence); let newCompetence = duplicate(competence);
newCompetence.data.niveau += 1; newCompetence.data.niveau += 1;