From ab7e05b19c18e8041c9b690a8fe9caf01032cb1f Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Sat, 14 Dec 2013 13:19:48 -0700 Subject: [PATCH] bug fix subtractPoints() for hp modification --- dist/habitrpg-shared.js | 5 +++-- script/index.coffee | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dist/habitrpg-shared.js b/dist/habitrpg-shared.js index 9877a51f8d..aa6343a3c6 100644 --- a/dist/habitrpg-shared.js +++ b/dist/habitrpg-shared.js @@ -11299,9 +11299,10 @@ var process=require("__browserify_process");(function() { return stats.gp += task.streak ? (streakBonus = task.streak / 100 + 1, afterStreak = gpMod * streakBonus, gpMod > 0 ? user._tmp.streakBonus = afterStreak - gpMod : void 0, afterStreak) : gpMod; }; subtractPoints = function() { - var conMod; + var conMod, hpMod; conMod = 1 - (user._statsComputed.con / 100); - return stats.hp += Math.round(task.value * HP * conMod * task.priority); + hpMod = delta * HP * conMod * task.priority; + return stats.hp += Math.round(hpMod * 10) / 10; }; switch (task.type) { case 'habit': diff --git a/script/index.coffee b/script/index.coffee index 416718f7a1..448b146f00 100644 --- a/script/index.coffee +++ b/script/index.coffee @@ -565,8 +565,8 @@ api.wrap = (user) -> # HP modifier subtractPoints = -> conMod = 1 - (user._statsComputed.con / 100) - stats.hp += Math.round(task.value * HP * conMod * task.priority) - # round to 1dp + hpMod = delta * HP * conMod * task.priority + stats.hp += Math.round(hpMod * 10) / 10 # round to 1dp switch task.type when 'habit'