mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 15:38:59 +00:00
feat(onboarding): give food on 3rd task
This commit is contained in:
parent
7b35c6fb8b
commit
6f8f8f723c
2 changed files with 5 additions and 2 deletions
|
|
@ -16,6 +16,7 @@ describe('common.fns.randomDrop', () => {
|
|||
user = generateUser();
|
||||
user._tmp = user._tmp ? user._tmp : {};
|
||||
user.items.eggs.Wolf = 0;
|
||||
user.items.food.Meat = 0;
|
||||
task = generateTodo({ userId: user._id });
|
||||
predictableRandom = sandbox.stub().returns(0.5);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -82,10 +82,12 @@ export default function randomDrop (user, options, req = {}, analytics) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (predictableRandom() < chance) {
|
||||
const firstFoodDrop = size(user.items.food) < 1;
|
||||
|
||||
if (firstFoodDrop || predictableRandom() < chance) {
|
||||
rarity = predictableRandom();
|
||||
|
||||
if (rarity > 0.6) { // food 40% chance
|
||||
if (firstFoodDrop || rarity > 0.6) { // food 40% chance
|
||||
drop = cloneDropItem(randomVal(filter(content.food, {
|
||||
canDrop: true,
|
||||
})));
|
||||
|
|
|
|||
Loading…
Reference in a new issue