Checklists should reset even when resting in the inn

This commit is contained in:
Blade Barringer 2015-05-02 22:10:26 -05:00
parent 2d9707bd39
commit c81d321366
2 changed files with 46 additions and 3 deletions

View file

@ -1488,6 +1488,7 @@ api.wrap = (user, main=true) ->
user.stats.buffs = clearBuffs
user.dailys.forEach (daily) ->
daily.completed = false
_.each daily.checklist, ((i)->i.completed=false;true)
return
# Tally each task

View file

@ -1,6 +1,3 @@
### Install: npm install --dev ###
### Run: npm test ###
_ = require 'lodash'
expect = require 'expect.js'
sinon = require 'sinon'
@ -203,6 +200,51 @@ describe 'User', ->
cron()
expect(user.dailys[0].completed).to.not.be.ok
it 'resets checklist on incomplete dailies', ->
user.dailys[0].checklist = [
{
"text" : "1",
"id" : "checklist-one",
"completed" : true
},
{
"text" : "2",
"id" : "checklist-two",
"completed" : true
},
{
"text" : "3",
"id" : "checklist-three",
"completed" : false
}
]
cron()
_.each user.dailys[0].checklist, (box)->
expect(box.completed).to.not.be.ok
it 'resets checklist on complete dailies', ->
user.dailys[0].checklist = [
{
"text" : "1",
"id" : "checklist-one",
"completed" : true
},
{
"text" : "2",
"id" : "checklist-two",
"completed" : true
},
{
"text" : "3",
"id" : "checklist-three",
"completed" : false
}
]
user.dailys[0].completed = true
cron()
_.each user.dailys[0].checklist, (box)->
expect(box.completed).to.not.be.ok
it 'does not damage user for incomplete dailies', ->
expect(user).toHaveHP 50
user.dailys[0].completed = true