mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-19 04:14:40 +00:00
use a different random seed for starting Armoire randomness than for sub-choices within it to prevent bug that gives only some foods
This commit is contained in:
parent
9fa39d99ae
commit
e5b8c5c4e0
1 changed files with 5 additions and 1 deletions
|
|
@ -850,7 +850,11 @@ api.wrap = (user, main=true) ->
|
|||
user.stats.hp += 15
|
||||
user.stats.hp = 50 if user.stats.hp > 50
|
||||
else if item.key is 'armoire'
|
||||
armoireResult = user.fns.predictableRandom()
|
||||
armoireResult = user.fns.predictableRandom(user.stats.gp)
|
||||
# We use a different seed to choose the Armoire action than we use
|
||||
# to choose the sub-action, otherwise only some of the foods can
|
||||
# be given. E.g., if a seed gives armoireResult < .5 (food) then
|
||||
# the same seed would give one of the first five foods only.
|
||||
eligibleEquipment = _.filter(content.gear.flat, ((i)->i.klass is 'armoire' and !user.items.gear.owned[i.key]))
|
||||
if !_.isEmpty(eligibleEquipment) and (armoireResult < .6 or !user.flags.armoireOpened)
|
||||
drop = user.fns.randomVal(eligibleEquipment)
|
||||
|
|
|
|||
Loading…
Reference in a new issue