diff --git a/dist/habitrpg-shared.js b/dist/habitrpg-shared.js index e6970e572c..74d1428777 100644 --- a/dist/habitrpg-shared.js +++ b/dist/habitrpg-shared.js @@ -15509,7 +15509,7 @@ api.wrap = function(user, main) { return typeof cb === "function" ? cb(null, user.items.gear.owned) : void 0; }, score: function(req, cb) { - var addPoints, calculateDelta, calculateReverseDelta, changeTaskValue, delta, direction, id, mpDelta, multiplier, num, options, stats, subtractPoints, task, th, _ref; + var addPoints, calculateDelta, calculateReverseDelta, changeTaskValue, delta, direction, gainMP, id, multiplier, num, options, stats, subtractPoints, task, th, _ref; _ref = req.params, id = _ref.id, direction = _ref.direction; task = user.tasks[id]; options = req.query || {}; @@ -15588,11 +15588,14 @@ api.wrap = function(user, main) { if (user.preferences.automaticAllocation === true && user.preferences.allocationMode === 'taskbased' && !(task.type === 'todo' && direction === 'down')) { user.stats.training[task.attribute] += nextDelta; } - if (direction === 'up' && !(task.type === 'habit' && !task.down)) { + if (direction === 'up') { user.party.quest.progress.up = user.party.quest.progress.up || 0; if ((_ref1 = task.type) === 'daily' || _ref1 === 'todo') { user.party.quest.progress.up += nextDelta * (1 + (user._statsComputed.str / 200)); } + if (task.type === 'habit') { + user.party.quest.progress.up += nextDelta * (0.5 + (user._statsComputed.str / 400)); + } } task.value += nextDelta; } @@ -15620,9 +15623,20 @@ api.wrap = function(user, main) { hpMod = delta * conBonus * task.priority * 2; return stats.hp += Math.round(hpMod * 10) / 10; }; + gainMP = function(delta) { + delta *= user._tmp.crit || 1; + user.stats.mp += delta; + if (user.stats.mp >= user._statsComputed.maxMP) { + user.stats.mp = user._statsComputed.maxMP; + } + if (user.stats.mp < 0) { + return user.stats.mp = 0; + } + }; switch (task.type) { case 'habit': changeTaskValue(); + gainMP(_.max([0.25, .0025 * user._statsComputed.maxMP]) * (direction === 'down' ? -1 : 1)); if (delta > 0) { addPoints(); } else { @@ -15652,6 +15666,7 @@ api.wrap = function(user, main) { } } else { changeTaskValue(); + gainMP(_.max([1, .01 * user._statsComputed.maxMP]) * (direction === 'down' ? -1 : 1)); if (direction === 'down') { delta = calculateDelta(); } @@ -15684,18 +15699,7 @@ api.wrap = function(user, main) { return m + (i.completed ? 1 : 0); }), 1), 1 ]); - mpDelta = _.max([multiplier, .01 * user._statsComputed.maxMP * multiplier]); - mpDelta *= user._tmp.crit || 1; - if (direction === 'down') { - mpDelta *= -1; - } - user.stats.mp += mpDelta; - if (user.stats.mp >= user._statsComputed.maxMP) { - user.stats.mp = user._statsComputed.maxMP; - } - if (user.stats.mp < 0) { - user.stats.mp = 0; - } + gainMP(_.max([multiplier, .01 * user._statsComputed.maxMP * multiplier]) * (direction === 'down' ? -1 : 1)); } break; case 'reward': @@ -15771,14 +15775,16 @@ api.wrap = function(user, main) { return x - Math.floor(x); }, crit: function(stat, chance) { + var s; if (stat == null) { stat = 'str'; } if (chance == null) { chance = .03; } - if (user.fns.predictableRandom() <= chance * (1 + user._statsComputed[stat] / 100)) { - return 1.5 + (.02 * user._statsComputed[stat]); + s = user._statsComputed[stat]; + if (user.fns.predictableRandom() <= chance * (1 + s / 100)) { + return 1.5 + 4 * s / (s + 200); } else { return 1; } @@ -16295,4 +16301,4 @@ api.wrap = function(user, main) { }).call(this,require("/Users/blade/habitrpg/habitrpg-shared/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js")) -},{"./content.coffee":5,"./i18n.coffee":6,"/Users/blade/habitrpg/habitrpg-shared/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":2,"lodash":3,"moment":4}]},{},[1]) \ No newline at end of file +},{"./content.coffee":5,"./i18n.coffee":6,"/Users/blade/habitrpg/habitrpg-shared/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":2,"lodash":3,"moment":4}]},{},[1]) diff --git a/script/index.coffee b/script/index.coffee index b6c2d24c6c..248f77ac58 100644 --- a/script/index.coffee +++ b/script/index.coffee @@ -1004,12 +1004,10 @@ api.wrap = (user, main=true) -> nextDelta = if not options.cron and direction is 'down' then calculateReverseDelta() else calculateDelta() unless task.type is 'reward' if (user.preferences.automaticAllocation is true and user.preferences.allocationMode is 'taskbased' and !(task.type is 'todo' and direction is 'down')) then user.stats.training[task.attribute] += nextDelta - # ===== STRENGTH ===== - # (Only for up-scoring, ignore up-onlies and rewards) - # Note, we create a new val (adjustAmt) to add to task.value, since delta will be used in Exp & GP calculations - we don't want STR to bonus that - if direction is 'up' and !(task.type is 'habit' and !task.down) + if direction is 'up' # Make progress on quest based on STR user.party.quest.progress.up = user.party.quest.progress.up || 0; user.party.quest.progress.up += (nextDelta * (1 + (user._statsComputed.str / 200))) if task.type in ['daily','todo'] + user.party.quest.progress.up += (nextDelta * (0.5 + (user._statsComputed.str / 400))) if task.type is 'habit' task.value += nextDelta delta += nextDelta @@ -1050,9 +1048,16 @@ api.wrap = (user, main=true) -> hpMod = delta * conBonus * task.priority * 2 # constant 2 multiplier for better results stats.hp += Math.round(hpMod * 10) / 10 # round to 1dp + gainMP = (delta) -> + delta *= user._tmp.crit or 1 + user.stats.mp += delta + user.stats.mp = user._statsComputed.maxMP if user.stats.mp >= user._statsComputed.maxMP + user.stats.mp = 0 if user.stats.mp < 0 + switch task.type when 'habit' changeTaskValue() + gainMP(_.max([0.25, (.0025 * user._statsComputed.maxMP)]) * if direction is 'down' then -1 else 1) # Add habit value to habit-history (if different) if (delta > 0) then addPoints() else subtractPoints() @@ -1071,6 +1076,7 @@ api.wrap = (user, main=true) -> task.streak = 0 unless user.stats.buffs.streaks else changeTaskValue() + gainMP(_.max([1, (.01 * user._statsComputed.maxMP)]) * if direction is 'down' then -1 else 1) if direction is 'down' delta = calculateDelta() # recalculate delta for unchecking so the gp and exp come out correctly addPoints() # obviously for delta>0, but also a trick to undo accidental checkboxes @@ -1097,12 +1103,7 @@ api.wrap = (user, main=true) -> addPoints() # obviously for delta>0, but also a trick to undo accidental checkboxes # MP++ per checklist item in ToDo, bonus per CLI multiplier = _.max([(_.reduce(task.checklist,((m,i)->m+(if i.completed then 1 else 0)),1)),1]) - mpDelta = _.max([(multiplier), (.01 * user._statsComputed.maxMP * multiplier)]) - mpDelta *= user._tmp.crit or 1 - 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 + gainMP(_.max([(multiplier), (.01 * user._statsComputed.maxMP * multiplier)]) * if direction is 'down' then -1 else 1) when 'reward' # Don't adjust values for rewards @@ -1159,7 +1160,9 @@ api.wrap = (user, main=true) -> crit: (stat='str', chance=.03) -> #console.log("Crit Chance:"+chance*(1+user._statsComputed[stat]/100)) - if user.fns.predictableRandom() <= chance*(1+user._statsComputed[stat]/100) then 1.5 + (.02*user._statsComputed[stat]) + s = user._statsComputed[stat] + if user.fns.predictableRandom() <= chance*(1 + s/100) + 1.5 + 4*s/(s + 200) else 1 ###