diff --git a/src/app/scoring.coffee b/src/app/scoring.coffee index c4f3894ad5..462a72339b 100644 --- a/src/app/scoring.coffee +++ b/src/app/scoring.coffee @@ -107,6 +107,31 @@ score = (model, taskId, direction, times, batch, cron) -> origStats = _.clone obj.stats updateStats model, { hp, exp, gp }, batch + ### + Drops + ### + # 1% chance of getting a pet or meat + if direction is 'up' and obj.flags.dropsEnabled and Math.random() < .5 + if Math.random() < .5 + drop = randomVal(food) + obj.items.food.push drop.name + batch.set 'items.food', obj.items.food + drop.type = 'Food' + drop.dialog = "You've found #{drop.text} Hatching Powder! #{drop.notes}" + else + drop = randomVal(pets) + obj.items.eggs.push drop + batch.set 'items.eggs', obj.items.eggs + drop.type = 'Egg' + drop.dialog = "You've found a #{drop.text} Egg! #{drop.notes}" + + model.set '_drop', drop + $('#item-dropped-modal').modal 'show' + + + ### + Commit + ### if commit # newStats / origStats is a glorious hack to trick Derby into seeing the change in model.on(*) newStats = _.clone batch.obj().stats @@ -115,22 +140,6 @@ score = (model, taskId, direction, times, batch, cron) -> # batch.setStats() batch.commit() - # 1% chance of getting a pet or meat - if direction is 'up' and obj.flags.dropsEnabled and Math.random() < .5 - if Math.random() < .5 - drop = randomVal(food) - user.push 'items.food', drop.name - drop.type = 'Food' - drop.dialog = "You've found #{drop.text} Hatching Powder! #{drop.notes}" - else - drop = randomVal(pets) - user.push 'items.eggs', drop - drop.type = 'Egg' - drop.dialog = "You've found a #{drop.text} Egg! #{drop.notes}" - - model.set '_drop', drop - $('#item-dropped-modal').modal 'show' - return delta ### diff --git a/views/app/pets.html b/views/app/pets.html index 39649f4e65..3f4baec080 100644 --- a/views/app/pets.html +++ b/views/app/pets.html @@ -56,18 +56,18 @@ {#if _feedEgg}
-

Feed Your Egg

+

Hatch Your Egg

{#if not(_user.items.food)} -

You don't have any food yet.

+

You don't have any hatching powder yet.

{else} -

What would you like to feed your {_feedEgg.text}?

+

What would you like to sprinkle on your {_feedEgg.text} egg?

- +
{/if}