Merge pull request #76 from Alys/patch-3

subtract MP when unticking a todo (instead of add)
This commit is contained in:
Tyler Renelle 2014-01-05 14:52:50 -08:00
commit 01fae2a2f0

View file

@ -834,8 +834,11 @@ api.wrap = (user) ->
else
calculateDelta()
addPoints() # obviously for delta>0, but also a trick to undo accidental checkboxes
user.stats.mp += _.max([(1 + (task.checklist?.length or 0)), (.01 * user._statsComputed.maxMP * (1 + (task.checklist?.length or 0)))]) # MP++ per ToDo, bonus per CLI
mpDelta = _.max([(1 + (task.checklist?.length or 0)), (.01 * user._statsComputed.maxMP * (1 + (task.checklist?.length or 0)))]) # MP++ per ToDo, bonus per CLI
mpDelta *= -1 if direction is 'down' # unticking a todo
user.stats.mp += mpDelta
user.stats.mp = user._statsComputed.maxMP if user.stats.mp >= user._statsComputed.maxMP
user.stats.mp = 0 if user.stats.mp < 0 # BUT DO WE WANT THIS? SEE COMMIT DESCRIPTION
when 'reward'
# Don't adjust values for rewards