mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 03:52:14 +00:00
fix money/hp buying difference
This commit is contained in:
parent
e78cb66f9c
commit
f0aa6299ea
2 changed files with 5 additions and 7 deletions
|
|
@ -69,7 +69,7 @@ updateStats = function(user, stats) {
|
|||
};
|
||||
|
||||
module.exports.score = score = function(spec) {
|
||||
var adjustvalue, cron, delta, diff, direction, exp, hp, lvl, modified, money, num, sign, task, type, user, value, _ref, _ref1, _ref2;
|
||||
var adjustvalue, cron, delta, direction, exp, hp, lvl, modified, money, num, sign, task, type, user, value, _ref, _ref1, _ref2;
|
||||
if (spec == null) {
|
||||
spec = {
|
||||
user: null,
|
||||
|
|
@ -124,9 +124,8 @@ module.exports.score = score = function(spec) {
|
|||
num = task.get('value').toFixed(2);
|
||||
statsNotification("<i class='icon-star'></i>GP -" + num, 'success');
|
||||
if (money < 0) {
|
||||
diff = hp + money;
|
||||
hp = diff;
|
||||
statsNotification("<i class='icon-heart'></i>HP -" + (diff.toFixed(2)), 'error');
|
||||
hp += money;
|
||||
statsNotification("<i class='icon-heart'></i>HP " + (money.toFixed(2)), 'error');
|
||||
money = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,9 +111,8 @@ module.exports.score = score = (spec = {user:null, task:null, direction:null, cr
|
|||
statsNotification "<i class='icon-star'></i>GP -#{num}", 'success'
|
||||
# if too expensive, reduce health & zero money
|
||||
if money < 0
|
||||
diff = hp + money # hp - money difference
|
||||
hp = diff
|
||||
statsNotification "<i class='icon-heart'></i>HP -#{diff.toFixed(2)}", 'error'
|
||||
hp += money# hp - money difference
|
||||
statsNotification "<i class='icon-heart'></i>HP #{money.toFixed(2)}", 'error'
|
||||
money = 0
|
||||
|
||||
# Add points to exp & money if positive delta
|
||||
|
|
|
|||
Loading…
Reference in a new issue