Added Max Stat Points constant

This commit is contained in:
Keith Holliday
2015-12-15 18:48:47 -06:00
parent 5573689d4e
commit ad196ecafb
2 changed files with 17 additions and 8 deletions

View File

@@ -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;
} }

View File

@@ -14,6 +14,14 @@ export function capByLevel (lvl) {
} }
} }
/*
------------------------------------------------------
Stats cap
------------------------------------------------------
*/
export const MAX_STAT_POINTS = MAX_LEVEL;
/* /*
------------------------------------------------------ ------------------------------------------------------
Health cap Health cap