feat(pets): Magic Hatching Potions WIP

This commit is contained in:
Sabe Jones
2015-09-21 17:12:23 -04:00
parent 87f6af346a
commit 389b5b370a
8 changed files with 49 additions and 21 deletions

View File

@@ -114,6 +114,7 @@
"hatchingPotionCottonCandyPink": "Cotton Candy Pink",
"hatchingPotionCottonCandyBlue": "Cotton Candy Blue",
"hatchingPotionGolden": "Golden",
"hatchingPotionSpooky": "Spooky",
"hatchingPotionNotes": "Pour this on an egg, and it will hatch as a <%= potText(locale) %> pet.",

View File

@@ -1165,24 +1165,29 @@ api.hatchingPotions =
CottonCandyPink: value: 4, text: t('hatchingPotionCottonCandyPink')
CottonCandyBlue: value: 4, text: t('hatchingPotionCottonCandyBlue')
Golden: value: 5, text: t('hatchingPotionGolden')
Spooky: value: 3, text: t('hatchingPotionSpooky'), premium: true
_.each api.hatchingPotions, (pot,key) ->
_.defaults pot, {key, value: 2, notes: t('hatchingPotionNotes', {potText: pot.text})}
_.defaults pot, {key, value: 2, notes: t('hatchingPotionNotes', {potText: pot.text}), premium: false, canBuy: true}
api.pets = _.transform api.dropEggs, (m, egg) ->
_.defaults m, _.transform api.hatchingPotions, (m2, pot) ->
if not pot.premium
m2[egg.key + "-" + pot.key] = true
api.questPets = _.transform api.questEggs, (m, egg) ->
_.defaults m, _.transform api.hatchingPotions, (m2, pot) ->
if not pot.premium
m2[egg.key + "-" + pot.key] = true
## added for mountmaster -- yes, the transforms are correct, since the same strings are used for both pets and mounts
api.mounts = _.transform api.dropEggs, (m, egg) ->
_.defaults m, _.transform api.hatchingPotions, (m2, pot) ->
if not pot.premium
m2[egg.key + "-" + pot.key] = true
api.questMounts = _.transform api.questEggs, (m, egg) ->
_.defaults m, _.transform api.hatchingPotions, (m2, pot) ->
if not pot.premium
m2[egg.key + "-" + pot.key] = true
api.food =

View File

@@ -766,7 +766,7 @@ api.wrap = (user, main=true) ->
if food.key is 'Saddle'
evolve()
else
if food.target is potion
if food.target is potion or content.hatchingPotions[potion].premium
userPets[pet] += 5
message = i18n.t('messageLikesFood', {egg: petDisplayName, foodText: food.text(req.language)}, req.language)
else

View File

@@ -6,7 +6,7 @@ var expect = chai.expect
require('coffee-script');
var count = require('../../common/script/count');
describe('count', function() {
describe.only('count', function() {
describe('beastMasterProgress', function() {
it('returns 0 if no pets', function() {
var pets = {};
@@ -26,6 +26,16 @@ describe('count', function() {
expect(beastMasterTotal).to.eql(1);
});
it('does not count pets hatched with premium potions', function() {
var pets = {
"Wolf-Spooky": 5,
"Dragon-Spooky": 5,
"FlyingPig-Base": 5
}
var beastMasterTotal = count.beastMasterProgress(pets);
expect(beastMasterTotal).to.eql(1);
});
it('does not count special pets', function() {
var pets = {
"Wolf-Base": 2,
@@ -65,6 +75,15 @@ describe('count', function() {
expect(mountMasterTotal).to.eql(2);
});
it('does not count premium mounts', function() {
var mounts = {
"Dragon-Red": true,
"FlyingPig-Spooky": true
}
var mountMasterTotal = count.mountMasterProgress(mounts);
expect(mountMasterTotal).to.eql(1);
});
it('does not count quest mounts', function() {
var mounts = { "Dragon-Red": true, "Gryphon-Base": true };
var mountMasterTotal = count.mountMasterProgress(mounts);

View File

@@ -24,7 +24,8 @@ describe('Stats Service', function() {
"Deer-Golden" : 5,
"Deer-Red" : 5,
"Egg-Desert" : 5,
"MantisShrimp-Base" : 5
"MantisShrimp-Base" : 5,
"Wolf-Spooky": 5
}
var beastMasterDisplay = statCalc.beastMasterProgress(user.items.pets);
@@ -38,9 +39,10 @@ describe('Stats Service', function() {
"BearCub-CottonCandyBlue" : -1,
"Cactus-Zombie" : 5,
"Deer-Golden" : 5,
"Deer-Red" : 5,
"Deer-Red" : -1,
"Egg-Desert" : 5,
"MantisShrimp-Base" : 5
"MantisShrimp-Base" : 5,
"Wolf-Spooky": -1
}
var beastMasterDisplay = statCalc.beastMasterProgress(user.items.pets);
@@ -221,7 +223,8 @@ describe('Stats Service', function() {
"Wolf-Golden" : true,
"Owl-CottonCandyBlue" : true,
"Mammoth-Base" : true,
"Bunny-Skeleton" : true
"Bunny-Skeleton" : true,
"Tiger-Spooky": true
}
var mountMasterDisplay = statCalc.mountMasterProgress(user.items.mounts);
@@ -237,7 +240,8 @@ describe('Stats Service', function() {
"Wolf-Golden" : false,
"Owl-CottonCandyBlue" : true,
"Mammoth-Base" : true,
"Bunny-Skeleton" : true
"Bunny-Skeleton" : true,
"Tiger-Spooky": true
}
var mountMasterDisplay = statCalc.mountMasterProgress(user.items.mounts);

View File

@@ -134,7 +134,7 @@
li.customize-menu
menu.pets-menu(label=env.t('hatchingPotions'))
p.muted!=env.t('dropsExplanation')
div(ng-repeat='pot in Content.hatchingPotions')
div(ng-repeat='pot in Content.hatchingPotions', ng-if='pot.canBuy')
button.customize-option(class='Pet_HatchingPotion_{{::pot.key}}',
popover='{{::pot.notes()}}', popover-append-to-body='true',
popover-title!=env.t("potion", {potionType: "{{::pot.text()}}"}),

View File

@@ -1,4 +1,4 @@
mixin mountList(source)
mixin mountList(source,showPremium)
menu.pets(type='list')
each egg in source
-if(!egg.noMount) {
@@ -6,9 +6,8 @@ mixin mountList(source)
menu
each potion in env.Content.hatchingPotions
- mount = egg.key+"-"+potion.key
div(popover-trigger='mouseenter', popover=env.t('mountName', {potion: potion.text(env.language.code), mount: egg.mountText(env.language.code)}), popover-placement='bottom')
div(popover-trigger='mouseenter', popover=env.t('mountName', {potion: potion.text(env.language.code), mount: egg.mountText(env.language.code)}), popover-placement='bottom', ng-hide='#{potion.premium} && #{!showPremium}')
button(class="pet-button Mount_Head_#{mount}", ng-show='user.items.mounts["#{mount}"]', ng-class='{active: user.items.currentMount == "#{mount}"}', ng-click='chooseMount("#{egg.key}", "#{potion.key}")')
//div(class='Mount_Head_{{mount}}')
button(class="pet-button mount-not-owned", ng-hide='user.items.mounts["#{mount}"]')
.PixelPaw
-}
@@ -24,7 +23,7 @@ mixin mountList(source)
p=env.t('mattShall', {name: "{{user.profile.name}}"})
h4 {{:: env.t('stableMountMasterProgress', { number: mountMasterProgress }) }}
.row: .col-md-12
+mountList(env.Content.dropEggs)
+mountList(env.Content.dropEggs,true)
.row: .col-md-12
h4=env.t('questMounts')
+mountList(env.Content.questEggs)

View File

@@ -1,11 +1,11 @@
mixin petList(source)
mixin petList(source,showPremium)
menu.pets(type='list')
each egg in source
li.customize-menu
menu
each potion in env.Content.hatchingPotions
- pet = egg.key+"-"+potion.key
div(popover-trigger='mouseenter', popover=env.t('petName', {potion: potion.text(env.language.code), egg: egg.text(env.language.code)}), popover-placement='bottom')
div(popover-trigger='mouseenter', popover=env.t('petName', {potion: potion.text(env.language.code), egg: egg.text(env.language.code)}), popover-placement='bottom', ng-hide='#{potion.premium} && #{!showPremium}')
button(class="pet-button Pet-#{pet}", ng-if='user.items.pets["#{pet}"]>0', ng-class='{active: user.items.currentPet == "#{pet}", selectableInventory: #{!egg.noMount} && selectedFood && !user.items.mounts["#{pet}"]}', ng-click='choosePet("#{egg.key}", "#{potion.key}")')
.progress(ng-show='!user.items.mounts["#{pet}"]')
.progress-bar.progress-bar-success(ng-style='{width: user.items.pets["#{pet}"]/.5 + "%"}')
@@ -24,7 +24,7 @@ mixin petList(source)
p=env.t('mattBochText1')
h4 {{:: env.t('stableBeastMasterProgress', { number: beastMasterProgress }) }}
.row: .col-md-12
+petList(env.Content.dropEggs)
+petList(env.Content.dropEggs,true)
.row: .col-md-12
h4=env.t('questPets')
+petList(env.Content.questEggs)