Merge pull request #46 from BlackEdder/max_drop_chance_clean

Calculate chance to drop using a slowly increasing function
This commit is contained in:
Tyler Renelle 2013-12-08 08:21:28 -08:00
commit 40b89dda46

View file

@ -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()