add countPets helper

This commit is contained in:
Matteo Pagliazzi 2013-11-18 16:07:23 +01:00
parent 7c5818c876
commit ec1681fce4
2 changed files with 21 additions and 2 deletions

View file

@ -9991,6 +9991,21 @@ var process=require("__browserify_process");(function() {
return i.defense;
}
},
countPets: function(originalCount, pets) {
var count;
count = originalCount || _.size(pets);
if (pets["Wolf-Veteran"]) {
count--;
}
if (pets["Wolf-Cerberus"]) {
count--;
}
if (pets["Dragon-Hydra"]) {
count--;
}
return count;
},
/*
----------------------------------------------------------------------
Derby-specific helpers. Will remove after the rewrite, need them here for now

View file

@ -307,8 +307,6 @@ module.exports =
return false unless messages?.length > 0
messages?[0] and (messages[0].id != lastMessageSeen)
###
are any tags active?
###
@ -353,6 +351,12 @@ module.exports =
i = items.getItem(type, item)
if type is 'weapon' then i.strength else i.defense
countPets: (originalCount, pets) ->
count = originalCount or _.size(pets);
count-- if pets["Wolf-Veteran"]
count-- if pets["Wolf-Cerberus"]
count-- if pets["Dragon-Hydra"]
count
###
----------------------------------------------------------------------