Enable new inn behavior

This commit is contained in:
Blade Barringer
2015-05-13 08:44:08 -05:00
parent 0629b6af18
commit dca45d7845
3 changed files with 66 additions and 11 deletions
+2 -2
View File
@@ -5,8 +5,8 @@
"mattShall": "Shall I bring you your steed, <%= name %>? Click a mount to saddle up.",
"mattBochText1": "Welcome to the Stable! I'm Matt, the beast master. Choose a pet here to venture at your side. Feed them and they'll grow into powerful steeds.",
"daniel": "Daniel",
"danielText": "Welcome to the Tavern! Stay a while and meet the locals. If you need to rest (vacation? illness?), I'll set you up at the inn. While checked-in, your Dailies are frozen as-is (checked/unchecked) until the day after check-out. You will not suffer for missing them at the day's end.",
"danielText2": "Be warned: If you are participating in a boss quest, the boss will still damage you for your party mates' missed Dailies!",
"danielText": "Welcome to the Tavern! Stay a while and meet the locals. If you need to rest (vacation? illness?), I'll set you up at the Inn. While checked-in, your Dailies won't hurt you at the day's end, but you can still check them off.",
"danielText2": "Be warned: If you are participating in a boss quest, the boss will still damage you for your party mates' missed Dailies! Also, your own damage to the Boss (or items collected) will not be applied until you check out of the Inn.",
"alexander": "Alexander the Merchant",
"welcomeMarket": "Welcome to the Market! Buy hard-to-find eggs and potions! Sell your extras! Commission useful services! Come see what we have to offer.",
"sellForGold": "Sell <%= item %> for <%= gold %> Gold",
+9 -5
View File
@@ -1499,13 +1499,17 @@ api.wrap = (user, main=true) ->
_.merge plan.consecutive, {count:0, offset:0, gemCapExtra:0}
user.markModified? 'purchased.plan'
# User is resting at the inn. On cron, buffs are cleared and all dailies are reset without performing damage (fixes issue #5070)
# User is resting at the inn.
# On cron, buffs are cleared and all dailies are reset without performing damage
if user.preferences.sleep is true
user.stats.buffs = clearBuffs
# @TODO: uncomment when new dailies behavior goes live, per https://github.com/HabitRPG/habitrpg/pull/5073#issuecomment-98436542
# user.dailys.forEach (daily) ->
# daily.completed = false
# _.each daily.checklist, ((i)->i.completed=false;true)
user.dailys.forEach (daily) ->
{completed, repeat} = daily
thatDay = moment(now).subtract({days: 1})
if api.shouldDo(thatDay, repeat, user.preferences) || completed
_.each daily.checklist, ((box)->box.completed=false;true)
daily.completed = false
return
# Tally each task
+55 -4
View File
@@ -195,12 +195,12 @@ describe 'User', ->
it 'remains in the inn on cron', ->
cron()
expect(user.preferences.sleep).to.be.ok()
expect(user.preferences.sleep).to.be true
it 'resets dailies', ->
user.dailys[0].completed = true
cron()
expect(user.dailys[0].completed).to.not.be.ok
expect(user.dailys[0].completed).to.be false
it 'resets checklist on incomplete dailies', ->
user.dailys[0].checklist = [
@@ -222,7 +222,7 @@ describe 'User', ->
]
cron()
_.each user.dailys[0].checklist, (box)->
expect(box.completed).to.not.be.ok
expect(box.completed).to.be false
it 'resets checklist on complete dailies', ->
user.dailys[0].checklist = [
@@ -245,7 +245,58 @@ describe 'User', ->
user.dailys[0].completed = true
cron()
_.each user.dailys[0].checklist, (box)->
expect(box.completed).to.not.be.ok
expect(box.completed).to.be false
it 'does not reset checklist on grey incomplete dailies', ->
yesterday = moment().subtract(1,'days')
user.dailys[0].repeat[shared.dayMapping[yesterday.day()]] = 0
user.dailys[0].checklist = [
{
"text" : "1",
"id" : "checklist-one",
"completed" : true
},
{
"text" : "2",
"id" : "checklist-two",
"completed" : true
},
{
"text" : "3",
"id" : "checklist-three",
"completed" : true
}
]
cron()
_.each user.dailys[0].checklist, (box)->
expect(box.completed).to.be true
it 'resets checklist on complete grey complete dailies', ->
yesterday = moment().subtract(1,'days')
user.dailys[0].repeat[shared.dayMapping[yesterday.day()]] = 0
user.dailys[0].checklist = [
{
"text" : "1",
"id" : "checklist-one",
"completed" : true
},
{
"text" : "2",
"id" : "checklist-two",
"completed" : true
},
{
"text" : "3",
"id" : "checklist-three",
"completed" : true
}
]
user.dailys[0].completed = true
cron()
_.each user.dailys[0].checklist, (box)->
expect(box.completed).to.be false
it 'does not damage user for incomplete dailies', ->
expect(user).toHaveHP 50