Merge branch 'rebalancing-2014-12' of https://github.com/HabitRPG/habitrpg-shared into rebalancing-2014-12
Conflicts: dist/habitrpg-shared.js
This commit is contained in:
+14
-11
@@ -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
|
||||
|
||||
###
|
||||
|
||||
Reference in New Issue
Block a user