mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Added Max Stat Points constant
This commit is contained in:
@@ -21,6 +21,7 @@ api.i18n = i18n;
|
|||||||
api.shouldDo = shouldDo;
|
api.shouldDo = shouldDo;
|
||||||
|
|
||||||
api.maxLevel = statHelpers.MAX_LEVEL;
|
api.maxLevel = statHelpers.MAX_LEVEL;
|
||||||
|
api.maxStatPoints = statHelpers.MAX_STAT_POINTS;
|
||||||
api.capByLevel = statHelpers.capByLevel;
|
api.capByLevel = statHelpers.capByLevel;
|
||||||
api.maxHealth = statHelpers.MAX_HEALTH;
|
api.maxHealth = statHelpers.MAX_HEALTH;
|
||||||
api.tnl = statHelpers.toNextLevel;
|
api.tnl = statHelpers.toNextLevel;
|
||||||
@@ -2281,14 +2282,14 @@ api.wrap = function(user, main) {
|
|||||||
user.stats.lvl++;
|
user.stats.lvl++;
|
||||||
tnl = api.tnl(user.stats.lvl);
|
tnl = api.tnl(user.stats.lvl);
|
||||||
user.stats.hp = 50;
|
user.stats.hp = 50;
|
||||||
var totalStatPoints = user.stats.str + user.stats.int + user.stats.con + user.stats.per;
|
var userTotalStatPoints = user.stats.str + user.stats.int + user.stats.con + user.stats.per;
|
||||||
if (totalStatPoints >= api.maxLevel) {
|
if (userTotalStatPoints >= api.maxStatPoints) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (user.preferences.automaticAllocation) {
|
if (user.preferences.automaticAllocation) {
|
||||||
user.fns.autoAllocate();
|
user.fns.autoAllocate();
|
||||||
} else {
|
} else {
|
||||||
user.stats.points = user.stats.lvl - totalStatPoints;
|
user.stats.points = user.stats.lvl - userTotalStatPoints;
|
||||||
if (user.stats.points < 0) {
|
if (user.stats.points < 0) {
|
||||||
user.stats.points = 0;
|
user.stats.points = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,14 @@ export function capByLevel (lvl) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
------------------------------------------------------
|
||||||
|
Stats cap
|
||||||
|
------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const MAX_STAT_POINTS = MAX_LEVEL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
Health cap
|
Health cap
|
||||||
|
|||||||
Reference in New Issue
Block a user