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