mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-11 22:46:47 +00:00
Merge pull request #46 from BlackEdder/max_drop_chance_clean
Calculate chance to drop using a slowly increasing function
This commit is contained in:
commit
40b89dda46
1 changed files with 9 additions and 1 deletions
|
|
@ -127,7 +127,15 @@ randomDrop = (user, delta, priority, streak = 0, options={}) ->
|
|||
chanceMultiplier *= obj.priorityValue(priority) # multiply chance by reddness
|
||||
chanceMultiplier += streak # streak bonus
|
||||
|
||||
if user.flags?.dropsEnabled and Math.random() < (.05 * chanceMultiplier)
|
||||
# Temporary solution to lower the maximum drop chance to 75 percent. More thorough
|
||||
# overhaul of drop changes is needed. See HabitRPG/habitrpg#1922 for details.
|
||||
# Old drop chance:
|
||||
# if user.flags?.dropsEnabled and Math.random() < (.05 * chanceMultiplier)
|
||||
max = 0.75 # Max probability of drop
|
||||
a = 0.1 # rate of increase
|
||||
alpha = a*max*chanceMultiplier/(a*chanceMultiplier+max) # current probability of drop
|
||||
|
||||
if user.flags?.dropsEnabled and Math.random() < alpha
|
||||
# current breakdown - 1% (adjustable) chance on drop
|
||||
# If they got a drop: 50% chance of egg, 50% Hatching Potion. If hatchingPotion, broken down further even further
|
||||
rarity = Math.random()
|
||||
|
|
|
|||
Loading…
Reference in a new issue