Revert "mounts: remove food temporarily. merging to master so we can run schema"

This reverts commit bf8c0dd9dc.

Conflicts:
	dist/habitrpg-shared.js
	script/algos.coffee
This commit is contained in:
Tyler Renelle 2013-11-14 12:50:35 -08:00 committed by Ruthan
parent e963674384
commit 1ec0dc12b3
3 changed files with 34 additions and 26 deletions

View file

@ -8905,7 +8905,7 @@ var global=self;/**
randomDrop = function(user, delta, priority, streak, options) {
var acceptableDrops, chanceMultiplier, drop, paths, rarity, reachedDropLimit, _base, _base1, _base2, _name, _name1, _ref1;
var acceptableDrops, chanceMultiplier, drop, paths, rarity, reachedDropLimit, _base, _base1, _base2, _base3, _name, _name1, _name2, _ref1;
if (streak == null) {
streak = 0;
}
@ -8919,7 +8919,7 @@ var global=self;/**
count: 0
};
}
reachedDropLimit = (helpers.daysSince(user.items.lastDrop.date, user.preferences) === 0) && (user.items.lastDrop.count >= 2);
reachedDropLimit = (helpers.daysSince(user.items.lastDrop.date, user.preferences) === 0) && (user.items.lastDrop.count >= 5);
if (reachedDropLimit) {
return;
}
@ -8928,21 +8928,29 @@ var global=self;/**
chanceMultiplier += streak;
if (((_ref1 = user.flags) != null ? _ref1.dropsEnabled : void 0) && Math.random() < (.05 * chanceMultiplier)) {
rarity = Math.random();
if (rarity > .5) {
drop = helpers.randomVal(eggs);
if ((_base1 = user.items.eggs)[_name = drop.name] == null) {
if (rarity > .6) {
drop = helpers.randomVal(_.omit(items.items.food, 'Saddle'));
if ((_base1 = user.items.food)[_name = drop.name] == null) {
_base1[_name] = 0;
}
user.items.food[drop.name] += 1;
drop.type = 'Food';
drop.dialog = "You've found a " + drop.text + " Food! " + drop.notes;
} else if (rarity > .3) {
drop = helpers.randomVal(eggs);
if ((_base2 = user.items.eggs)[_name1 = drop.name] == null) {
_base2[_name1] = 0;
}
user.items.eggs[drop.name]++;
drop.type = 'Egg';
drop.dialog = "You've found a " + drop.text + " Egg! " + drop.notes;
} else {
acceptableDrops = rarity < .02 ? ['Golden'] : rarity < .13 ? ['Zombie', 'CottonCandyPink', 'CottonCandyBlue'] : rarity < .29 ? ['Red', 'Shade', 'Skeleton'] : ['Base', 'White', 'Desert'];
acceptableDrops = rarity < .03 ? ['Golden'] : rarity < .09 ? ['Zombie', 'CottonCandyPink', 'CottonCandyBlue'] : rarity < .18 ? ['Red', 'Shade', 'Skeleton'] : ['Base', 'White', 'Desert'];
drop = helpers.randomVal(_.pick(hatchingPotions, (function(v, k) {
return __indexOf.call(acceptableDrops, k) >= 0;
})));
if ((_base2 = user.items.hatchingPotions)[_name1 = drop.name] == null) {
_base2[_name1] = 0;
if ((_base3 = user.items.hatchingPotions)[_name2 = drop.name] == null) {
_base3[_name2] = 0;
}
user.items.hatchingPotions[drop.name]++;
drop.type = 'HatchingPotion';
@ -10587,4 +10595,4 @@ try {
},{"lodash":2}]},{},[6])
;
;

File diff suppressed because one or more lines are too long

View file

@ -119,7 +119,7 @@ randomDrop = (user, delta, priority, streak = 0, options={}) ->
date: +moment().subtract('d', 1) # trick - set it to yesterday on first run, that way they can get drops today
count: 0
reachedDropLimit = (helpers.daysSince(user.items.lastDrop.date, user.preferences) is 0) and (user.items.lastDrop.count >= 2)
reachedDropLimit = (helpers.daysSince(user.items.lastDrop.date, user.preferences) is 0) and (user.items.lastDrop.count >= 5)
return if reachedDropLimit
# % chance of getting a pet or meat
@ -132,16 +132,16 @@ randomDrop = (user, delta, priority, streak = 0, options={}) ->
# If they got a drop: 50% chance of egg, 50% Hatching Potion. If hatchingPotion, broken down further even further
rarity = Math.random()
# # Food: 40% chance
# if rarity > .6
# drop = helpers.randomVal _.omit(items.items.food, 'Saddle')
# user.items.food[drop.name] ?= 0
# user.items.food[drop.name]+= 1
# drop.type = 'Food'
# drop.dialog = "You've found a #{drop.text} Food! #{drop.notes}"
# Food: 40% chance
if rarity > .6
drop = helpers.randomVal _.omit(items.items.food, 'Saddle')
user.items.food[drop.name] ?= 0
user.items.food[drop.name]+= 1
drop.type = 'Food'
drop.dialog = "You've found a #{drop.text} Food! #{drop.notes}"
# Eggs: 30% chance
if rarity > .5
else if rarity > .3
drop = helpers.randomVal eggs
user.items.eggs[drop.name] ?= 0
user.items.eggs[drop.name]++
@ -151,13 +151,13 @@ randomDrop = (user, delta, priority, streak = 0, options={}) ->
# Hatching Potion, 30% chance - break down by rarity.
else
acceptableDrops =
# Very Rare: 4% of 50% (4% each)
if rarity < .02 then ['Golden']
# Rare: 22% of 50% (7.33% each)
else if rarity < .13 then ['Zombie', 'CottonCandyPink', 'CottonCandyBlue']
# Uncommon: 32% of 50% (10.66% each)
else if rarity < .29 then ['Red', 'Shade', 'Skeleton']
# Common: 42% of 50% (14% each)
# Very Rare: 10% (of 30%)
if rarity < .03 then ['Golden']
# Rare: 20% (of 30%)
else if rarity < .09 then ['Zombie', 'CottonCandyPink', 'CottonCandyBlue']
# Uncommon: 30% (of 30%)
else if rarity < .18 then ['Red', 'Shade', 'Skeleton']
# Common: 40% (of 30%)
else ['Base', 'White', 'Desert']
# No Rarity (@see https://github.com/HabitRPG/habitrpg/issues/1048, we may want to remove rareness when we add mounts)