mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
fix money/hp buying difference
This commit is contained in:
@@ -69,7 +69,7 @@ updateStats = function(user, stats) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
module.exports.score = score = function(spec) {
|
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) {
|
if (spec == null) {
|
||||||
spec = {
|
spec = {
|
||||||
user: null,
|
user: null,
|
||||||
@@ -124,9 +124,8 @@ module.exports.score = score = function(spec) {
|
|||||||
num = task.get('value').toFixed(2);
|
num = task.get('value').toFixed(2);
|
||||||
statsNotification("<i class='icon-star'></i>GP -" + num, 'success');
|
statsNotification("<i class='icon-star'></i>GP -" + num, 'success');
|
||||||
if (money < 0) {
|
if (money < 0) {
|
||||||
diff = hp + money;
|
hp += money;
|
||||||
hp = diff;
|
statsNotification("<i class='icon-heart'></i>HP " + (money.toFixed(2)), 'error');
|
||||||
statsNotification("<i class='icon-heart'></i>HP -" + (diff.toFixed(2)), 'error');
|
|
||||||
money = 0;
|
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'
|
statsNotification "<i class='icon-star'></i>GP -#{num}", 'success'
|
||||||
# if too expensive, reduce health & zero money
|
# if too expensive, reduce health & zero money
|
||||||
if money < 0
|
if money < 0
|
||||||
diff = hp + money # hp - money difference
|
hp += money# hp - money difference
|
||||||
hp = diff
|
statsNotification "<i class='icon-heart'></i>HP #{money.toFixed(2)}", 'error'
|
||||||
statsNotification "<i class='icon-heart'></i>HP -#{diff.toFixed(2)}", 'error'
|
|
||||||
money = 0
|
money = 0
|
||||||
|
|
||||||
# Add points to exp & money if positive delta
|
# Add points to exp & money if positive delta
|
||||||
|
|||||||
Reference in New Issue
Block a user