feat(seasonal): Implement snowball

Minor refactoring of special spell purchasing, and turns snowball into Gold- instead of Gem-purchasable.
This commit is contained in:
Sabe Jones 2014-12-27 11:48:22 -06:00
parent e93754e50b
commit f7d45c951e
2 changed files with 8 additions and 7 deletions

View file

@ -649,7 +649,7 @@ api.spells =
snowball:
text: t('spellSpecialSnowballAuraText')
mana: 0
value: 1
value: 15
target: 'user'
notes: t('spellSpecialSnowballAuraNotes')
cast: (user, target) ->

View file

@ -688,15 +688,16 @@ api.wrap = (user, main=true) ->
user.items.food[food.key]--
cb? {code:200, message}, userPets[pet]
#FIXME stupid method of special-handling spookDust, since it can be purchased with gold and the system only accomodates gem-purchasable holiday spells
buySpookDust: (req,cb) ->
item = content.special.spookDust
buySpecialSpell: (req,cb) ->
{key} = req.params
item = content.special[key]
return cb?({code:401, message: i18n.t('messageNotEnoughGold', req.language)}) if user.stats.gp < item.value
user.stats.gp -= item.value
user.items.special.spookDust ?= 0
user.items.special.spookDust++
user.items.special[item.key] ?= 0
user.items.special[item.key]++
user.markModified? 'items.special'
cb? null, _.pick(user,$w 'items stats')
message = i18n.t('messageBought', {itemText: item.text(req.language)}, req.language)
cb? {code:200,message}, _.pick(user,$w 'items stats')
# buy is for using Gold, purchase is for Gems (I know, I know...)
purchase: (req, cb, ga) ->