checklists: grant GP bonus for CLIs on To-Dos

This commit is contained in:
Tyler Renelle 2013-12-30 14:51:49 -07:00
parent 85c96886a3
commit eb016649e1
2 changed files with 6 additions and 4 deletions

View file

@ -11662,7 +11662,7 @@ var process=require("__browserify_process");(function() {
return typeof cb === "function" ? cb(null, _.pick(user, $w('stats'))) : void 0;
},
score: function(req, cb) {
var addPoints, calculateDelta, delta, direction, id, num, options, stats, subtractPoints, task, th, _ref;
var addPoints, calculateDelta, delta, direction, id, num, options, stats, subtractPoints, task, th, _ref, _ref1;
_ref = req.params, id = _ref.id, direction = _ref.direction;
task = user.tasks[id];
options = req.query || {};
@ -11784,8 +11784,9 @@ var process=require("__browserify_process");(function() {
} else {
calculateDelta();
addPoints();
if (!(user.stats.mp >= user._statsComputed.maxMP)) {
user.stats.mp++;
user.stats.mp += 1 + (((_ref1 = task.checklist) != null ? _ref1.length : void 0) || 0);
if (user.stats.mp >= user._statsComputed.maxMP) {
user.stats.mp = user._statsComputed.maxMP;
}
}
break;

View file

@ -782,7 +782,8 @@ api.wrap = (user) ->
else
calculateDelta()
addPoints() # obviously for delta>0, but also a trick to undo accidental checkboxes
user.stats.mp++ unless user.stats.mp >= user._statsComputed.maxMP
user.stats.mp += (1 + (task.checklist?.length or 0)) # MP++ per ToDo, bonus per CLI
user.stats.mp = user._statsComputed.maxMP if user.stats.mp >= user._statsComputed.maxMP
when 'reward'
# Don't adjust values for rewards