From bbc38a6532f8b719d70b6da651debbade93a18e9 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Tue, 17 Dec 2013 23:24:38 -0700 Subject: [PATCH] fix drops: seed rarity & drop-chance separately. because we're using predictableRandom, the rarity random is set NOT to be less than 75%, so food is unlikely to drop without this fix --- dist/habitrpg-shared.js | 14 +++++++------- script/index.coffee | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dist/habitrpg-shared.js b/dist/habitrpg-shared.js index 4506a4c379..83adb2a637 100644 --- a/dist/habitrpg-shared.js +++ b/dist/habitrpg-shared.js @@ -10020,7 +10020,7 @@ var global=self;/** mana: 10, lvl: 6, target: 'task', - notes: 'With a crack, flames burst from your staff, scorching a task. You deal much higher damage to the task and gain additional xp.', + notes: 'With a crack, flames burst from your staff, scorching a task. You deal much higher damage to the task and gain additional experience.', cast: function(user, target) { target.value += user._statsComputed.int * .2; return user.stats.exp += Math.abs(target.value); @@ -10031,7 +10031,7 @@ var global=self;/** mana: 15, lvl: 7, target: 'task', - notes: 'A bolt a lightning pierces through a task. There is a high chance of a critical hit.', + notes: 'A bolt of lightning pierces through a task. There is a high chance of a critical hit.', cast: function(user, target) { return target.value += user._statsComputed.int * .3 * crit(user, 'per'); } @@ -10041,7 +10041,7 @@ var global=self;/** mana: 35, lvl: 8, target: 'party', - notes: "Ice forms of the party's tasks, slowing them down and opening them up to more attacks. Your party gains a buff to xp.", + notes: "Ice forms on the party's tasks, slowing them down and opening them up to more attacks. Your party gains a buff to experience.", cast: function(user, target) { return _.each(target, function(member) { return member.stats.buffs.int = user._statsComputed.int / 2; @@ -10077,7 +10077,7 @@ var global=self;/** mana: 25, lvl: 7, target: 'self', - notes: "You take a moment to relax your body and enter a defensive stance to ready yourself for the tasks' next onslaught. Reduced damage from dailies at the end of the day.", + notes: "You take a moment to relax your body and enter a defensive stance to ready yourself for the tasks' next onslaught. Reduces damage from dailies at the end of the day.", cast: function(user, target) { return user.stats.buffs.con = user._statsComputed.con / 2; } @@ -10176,7 +10176,7 @@ var global=self;/** mana: 15, lvl: 7, target: 'self', - notes: "You cast a burst of light that blinds all of your tasks. The redness of your tasks is reduced", + notes: "You cast a burst of light that blinds all of your tasks. The redness of your tasks is reduced.", cast: function(user, target) { return _.each(user.tasks, function(target) { if (target.type === 'reward') { @@ -11745,8 +11745,8 @@ var process=require("__browserify_process");(function() { max = 0.75; a = 0.1; alpha = a * max * chanceMultiplier / (a * chanceMultiplier + max); - if (((_ref1 = user.flags) != null ? _ref1.dropsEnabled : void 0) && user.fns.predictableRandom() < alpha) { - rarity = user.fns.predictableRandom(); + if (((_ref1 = user.flags) != null ? _ref1.dropsEnabled : void 0) && user.fns.predictableRandom(user.stats.exp) < alpha) { + rarity = user.fns.predictableRandom(user.stats.gp); if (rarity > .6) { drop = user.fns.randomVal(_.omit(content.food, 'Saddle')); if ((_base1 = user.items.food)[_name = drop.name] == null) { diff --git a/script/index.coffee b/script/index.coffee index 2b081ba89c..fbe874d13b 100644 --- a/script/index.coffee +++ b/script/index.coffee @@ -863,10 +863,10 @@ api.wrap = (user) -> a = 0.1 # rate of increase alpha = a*max*chanceMultiplier/(a*chanceMultiplier+max) # current probability of drop - if user.flags?.dropsEnabled and user.fns.predictableRandom() < alpha + if user.flags?.dropsEnabled and user.fns.predictableRandom(user.stats.exp) < 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 = user.fns.predictableRandom() + rarity = user.fns.predictableRandom(user.stats.gp) # Food: 40% chance if rarity > .6