From 4edbb8bf3d865be418fa5f323a65f870dd646bad Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Wed, 27 Mar 2013 11:24:06 -0700 Subject: [PATCH] pets: rename everything "food" to "hatcing potions" (since we may be adding food in the near future) --- src/app/items.coffee | 6 +++--- src/app/pets.coffee | 42 +++++++++++++++++++-------------------- src/app/scoring.coffee | 10 +++++----- styles/app/inventory.styl | 2 +- views/app/avatar.html | 22 ++++++++++---------- views/app/pets.html | 28 +++++++++++++------------- 6 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/app/items.coffee b/src/app/items.coffee index 3b7b1ab7ef..73aad5c922 100644 --- a/src/app/items.coffee +++ b/src/app/items.coffee @@ -50,7 +50,7 @@ items = module.exports.items = {text: 'Bear Cub', name: 'BearCub', value: 2} ] - food: [ + hatchingPotions: [ {text: 'Common', name: 'Base', notes: "Hatches your pet in it's base form.", value: 1} {text: 'White', name: 'White', notes: 'Turns your animal into a White pet.', value: 2} {text: 'Desert', name: 'Desert', notes: 'Turns your animal into a Desert pet.', value: 2} @@ -68,7 +68,7 @@ _.each ['weapon', 'armor', 'head', 'shield'], (key) -> _.each items[key], (item) -> item.type = key _.each items.pets, (pet) -> pet.notes = 'Find some Hatching Potion to sprinkle on this egg, and one day it will hatch into a loyal pet.' -_.each items.food, (food) -> food.notes = "Sprinkle this on an egg, and it will hatch as a #{food.text} pet." +_.each items.hatchingPotions, (hatchingPotion) -> hatchingPotion.notes = "Sprinkle this on an egg, and it will hatch as a #{hatchingPotion.text} pet." ### view exports @@ -204,7 +204,7 @@ module.exports.updateStore = updateStore = (model) -> model.set '_view.items.potion', items.potion model.set '_view.items.reroll', items.reroll model.set '_view.items.pets', items.pets - model.set '_view.items.food', items.food + model.set '_view.items.hatchingPotions', items.hatchingPotions diff --git a/src/app/pets.coffee b/src/app/pets.coffee index 5e46067536..892357f676 100644 --- a/src/app/pets.coffee +++ b/src/app/pets.coffee @@ -1,6 +1,6 @@ _ = require 'underscore' { randomVal } = require './helpers' -{ pets, food } = require('./items').items +{ pets, hatchingPotions } = require('./items').items ### app exports @@ -22,33 +22,33 @@ module.exports.app = (appExports, model) -> $('#drops-enabled-modal').modal 'show' appExports.chooseEgg = (e, el) -> - model.ref '_feedEgg', e.at() + model.ref '_hatchEgg', e.at() - appExports.feedEgg = (e, el) -> - foodName = $(el).children('select').val() - myFood = user.get 'items.food' - egg = model.get '_feedEgg' + appExports.hatchEgg = (e, el) -> + hatchingPotionName = $(el).children('select').val() + myHatchingPotion = user.get 'items.hatchingPotions' + egg = model.get '_hatchEgg' eggs = user.get 'items.eggs' myPets = user.get 'items.pets' - foodIdx = myFood.indexOf foodName + hatchingPotionIdx = myHatchingPotion.indexOf hatchingPotionName eggIdx = eggs.indexOf egg - return alert "You don't own that food :\\" if foodIdx is -1 - return alert "You don't own that egg :\\" if eggIdx is -1 - return alert "You already have that pet." if myPets and myPets.indexOf("#{egg.name}-#{foodName}") != -1 + return alert "You don't own that hatching potion yet, complete more tasks!" if hatchingPotionIdx is -1 + return alert "You don't own that egg yet, complete more tasks!" if eggIdx is -1 + return alert "You already have that pet, hatch a different combo." if myPets and myPets.indexOf("#{egg.name}-#{hatchingPotionName}") != -1 - user.push 'items.pets', egg.name + '-' + foodName + user.push 'items.pets', egg.name + '-' + hatchingPotionName eggs.splice eggIdx, 1 - myFood.splice foodIdx, 1 + myHatchingPotion.splice hatchingPotionIdx, 1 user.set 'items.eggs', eggs - user.set 'items.food', myFood + user.set 'items.hatchingPotions', myHatching Potion alert 'Your egg hatched! Visit your stable to equip your pet.' #FIXME Bug: this removes from the array properly in the browser, but on refresh is has removed all items from the arrays -# user.remove 'items.food', foodIdx, 1 +# user.remove 'items.hatchingPotions', hatchingPotionIdx, 1 # user.remove 'items.eggs', eggIdx, 1 appExports.choosePet = (e, el) -> @@ -63,14 +63,14 @@ module.exports.app = (appExports, model) -> pet = {} if user.get('items.currentPet.str') is petStr user.set 'items.currentPet', pet - appExports.buyFood = (e, el) -> - name = $(el).attr 'data-food' - newFood = _.findWhere food, name: name + appExports.buyHatchingPotion = (e, el) -> + name = $(el).attr 'data-hatchingPotion' + newHatchingPotion = _.findWhere hatchingPotion, name: name tokens = user.get('balance') * 4 - if tokens > newFood.value - if confirm "Buy this food with #{newFood.value} of your #{tokens} tokens?" - user.push 'items.food', newFood.name - user.set 'balance', (tokens - newFood.value) / 4 + if tokens > newHatching Potion.value + if confirm "Buy this hatching potion with #{newHatchingPotion.value} of your #{tokens} tokens?" + user.push 'items.hatchingPotions', newHatchingPotion.name + user.set 'balance', (tokens - newHatchingPotion.value) / 4 else $('#more-tokens-modal').modal 'show' diff --git a/src/app/scoring.coffee b/src/app/scoring.coffee index 709d861d75..6c6d481893 100644 --- a/src/app/scoring.coffee +++ b/src/app/scoring.coffee @@ -5,7 +5,7 @@ _ = require 'underscore' browser = require './browser' character = require './character' items = require './items' -{ pets, food } = items.items +{ pets, hatchingPotions } = items.items algos = require './algos' MODIFIER = algos.MODIFIER # each new level, armor, weapon add 2% modifier (this mechanism will change) @@ -29,7 +29,7 @@ randomDrop = (model, delta) -> chanceMultiplier *= Math.abs(delta) # multiply chance by reddness if user.get('flags.dropsEnabled') and Math.random() < (.01 * chanceMultiplier) # current breakdown - 3% (adjustable) chance on drop - # If they got a drop: 50% chance of egg, 50% Food. If food, broken down further even further + # If they got a drop: 50% chance of egg, 50% Hatching Potion. If hatchingPotion, broken down further even further rarity = Math.random() # Egg, 40% chance @@ -39,7 +39,7 @@ randomDrop = (model, delta) -> drop.type = 'Egg' drop.dialog = "You've found a #{drop.text} Egg! #{drop.notes}" - # Food, 60% chance - break down by rarity even more. FIXME this may not be the best method, so revisit + # Hatching Potion, 60% chance - break down by rarity even more. FIXME this may not be the best method, so revisit else acceptableDrops = [] @@ -62,9 +62,9 @@ randomDrop = (model, delta) -> else acceptableDrops = ['Base'] - acceptableDrops = _.filter(food, (foodItem) -> foodItem.name in acceptableDrops) + acceptableDrops = _.filter(hatchingPotions, (hatchingPotion) -> hatchingPotion.name in acceptableDrops) drop = randomVal acceptableDrops - user.push 'items.food', drop.name + user.push 'items.hatchingPotions', drop.name drop.type = 'HatchingPotion' drop.dialog = "You've found a #{drop.text} Hatching Potion! #{drop.notes}" diff --git a/styles/app/inventory.styl b/styles/app/inventory.styl index a3a6d03f2f..4ae647a728 100644 --- a/styles/app/inventory.styl +++ b/styles/app/inventory.styl @@ -46,5 +46,5 @@ clear:both .pets-menu > div float:left -.food-menu > div +.hatchingPotions-menu > div float:left diff --git a/views/app/avatar.html b/views/app/avatar.html index 10896ed24c..82a98b407a 100644 --- a/views/app/avatar.html +++ b/views/app/avatar.html @@ -250,23 +250,23 @@ {/}

Hatching Potions

- {#with _view.items.food as :food} + {#with _view.items.hatchingPotions as :hatchingPotion} - {#with :food[0]}{/} - {#with :food[1]}{/} - {#with :food[2]}{/} - {#with :food[3]}{/} + {#with :hatchingPotion[0]}{/} + {#with :hatchingPotion[1]}{/} + {#with :hatchingPotion[2]}{/} + {#with :hatchingPotion[3]}{/} - {#with :food[4]}{/} - {#with :food[5]}{/} - {#with :food[6]}{/} - {#with :food[7]}{/} + {#with :hatchingPotion[4]}{/} + {#with :hatchingPotion[5]}{/} + {#with :hatchingPotion[6]}{/} + {#with :hatchingPotion[7]}{/} - {#with :food[8]}{/} - {#with :food[9]}{/} + {#with :hatchingPotion[8]}{/} + {#with :hatchingPotion[9]}{/}
{/} diff --git a/views/app/pets.html b/views/app/pets.html index e1e486423b..5d5d03a791 100644 --- a/views/app/pets.html +++ b/views/app/pets.html @@ -21,9 +21,9 @@ - - -
+ + +
{.text} @@ -51,31 +51,31 @@
  • - {#if not(_user.items.food)} + {#if not(_user.items.hatchingPotions)}

    You don't have any hatching potions yet.

    {/if} - - {#each _user.items.food as :food} + + {#each _user.items.hatchingPotions as :hatchingPotion}
    - -

    {:food}

    + +

    {:hatchingPotion}

    {/each}
  • - {#if _feedEgg} + {#if _hatchEgg}

    Hatch Your Egg

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

    You don't have any hatching potions yet.

    {else} -

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

    -
    +

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

    +