prevent user.stats.points from being negative e.g., after dropping level with Fix Character Values (still need to remove allocated points then)

This commit is contained in:
Alys
2015-04-05 09:03:39 +10:00
parent 3c07a8ee6b
commit e134c36ca2
2 changed files with 19 additions and 4 deletions
+4
View File
@@ -1384,6 +1384,10 @@ api.wrap = (user, main=true) ->
else
# add new allocatable points. We could do user.stats.points++, but this does a fail-safe just in case
user.stats.points = user.stats.lvl - (user.stats.con + user.stats.str + user.stats.per + user.stats.int);
if user.stats.points < 0
user.stats.points = 0
# This happens after dropping level with Fix Character Values and perhaps from other causes.
# TODO: Subtract points from attributes in the same manner as on death.
user.stats.hp = 50
user.stats.exp = stats.exp