mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 12:02:13 +00:00
remove "+ undefined" for (-)habit. Workaround, need to find why
stats.gp is being set from (-)habit at all
This commit is contained in:
parent
54ef864458
commit
b468f052fd
3 changed files with 15 additions and 7 deletions
|
|
@ -48,12 +48,15 @@ module.exports.hpModifier = (value, armorDef, helmDef, shieldDef, level, priorit
|
|||
Future use
|
||||
{priority} user-defined priority multiplier
|
||||
###
|
||||
module.exports.gpModifier = (value, modifier, priority='!', streak=0, model) ->
|
||||
streakBonus = streak / 100 + 1 # eg, 1-day streak is 1.1, 2-day is 1.2, etc
|
||||
module.exports.gpModifier = (value, modifier, priority='!', streak, model) ->
|
||||
val = value * modifier * priorityValue(priority)
|
||||
afterStreak = val * streakBonus
|
||||
model.set('_streakBonus', afterStreak - val) if (model and streak and (val > 0)) # can we do this without model? just global emit?
|
||||
return afterStreak
|
||||
if streak and model
|
||||
streakBonus = streak / 100 + 1 # eg, 1-day streak is 1.1, 2-day is 1.2, etc
|
||||
afterStreak = val * streakBonus
|
||||
model.set('_streakBonus', afterStreak - val) if (val > 0) # can we do this without model? just global emit?
|
||||
return afterStreak
|
||||
else
|
||||
return val
|
||||
|
||||
###
|
||||
Calculates the next task.value based on direction
|
||||
|
|
|
|||
|
|
@ -173,12 +173,14 @@ setupGrowlNotifications = (model) ->
|
|||
|
||||
user.on 'set', 'stats.gp', (captures, args) ->
|
||||
money = captures - args
|
||||
return unless !!money # why is this happening? gotta find where stats.gp is being set from (-)habit
|
||||
sign = if money < 0 then '-' else '+'
|
||||
statsNotification "#{sign} #{showCoins(money)}", 'gp'
|
||||
|
||||
# Append Bonus
|
||||
bonus = model.get('_streakBonus')
|
||||
if money > 0 and bonus
|
||||
debugger
|
||||
if (money > 0) and !!bonus
|
||||
bonus = 0.01 if bonus < 0.01
|
||||
statsNotification "+ #{showCoins(bonus)} Streak Bonus!"
|
||||
model.del('_streakBonus')
|
||||
|
|
|
|||
|
|
@ -119,7 +119,10 @@ score = (model, taskId, direction, times, batch, cron) ->
|
|||
level = user.get('stats.lvl')
|
||||
weaponStrength = items.items.weapon[user.get('items.weapon')].strength
|
||||
exp += algos.expModifier(delta,weaponStrength,level, priority) / 2 # / 2 hack for now bcause people leveling too fast
|
||||
gp += algos.gpModifier(delta, 1, priority, streak, model)
|
||||
if streak
|
||||
gp += algos.gpModifier(delta, 1, priority, streak, model)
|
||||
else
|
||||
gp += algos.gpModifier(delta, 1, priority)
|
||||
|
||||
subtractPoints = ->
|
||||
level = user.get('stats.lvl')
|
||||
|
|
|
|||
Loading…
Reference in a new issue