diff --git a/common/locales/en/spells.json b/common/locales/en/spells.json index 5eb5d18be1..4be7778964 100644 --- a/common/locales/en/spells.json +++ b/common/locales/en/spells.json @@ -10,6 +10,8 @@ "spellWizardFrostText": "Chilling Frost", "spellWizardFrostNotes": "Ice covers your tasks. None of your streaks will reset to zero tomorrow! (One cast affects all streaks.)", + "spellWizardFrostAlreadyCast": " You have already cast this today. Your streaks are frozen, and there's no need to cast this again.", + "spellWarriorSmashText": "Brutal Smash", "spellWarriorSmashNotes": "You hit a task with all of your might. It gets more blue/less red, and you deal extra damage to Bosses! Click on a task to cast. (Based on: STR)", @@ -34,6 +36,8 @@ "spellRogueStealthText": "Stealth", "spellRogueStealthNotes": "You are too sneaky to spot. Some of your undone Dailies will not cause damage tonight, and their streaks/color will not change. (Cast multiple times to affect more Dailies)", + "spellRogueStealthDaliesAvoided": "<%= originalText %> Number of dailies avoided: <%= number %>.", + "spellRogueStealthMaxedOut": " You have already avoided all your dailies; there's no need to cast this again.", "spellHealerHealText": "Healing Light", "spellHealerHealNotes": "Light covers your body, healing your wounds. You regain health! (Based on: CON and INT)", diff --git a/website/client/css/tasks.styl b/website/client/css/tasks.styl index 8e4baa7f4b..7e2eaa09f0 100644 --- a/website/client/css/tasks.styl +++ b/website/client/css/tasks.styl @@ -657,6 +657,15 @@ form padding-left: 0.2em text-align: left border:none + + &.disabled + // bootstrap .btn.disabled styles + pointer-events: none + cursor: not-allowed + -webkit-box-shadow: none + box-shadow: none + opacity: .65 + span position: relative left: -2px diff --git a/website/client/js/controllers/tasksCtrl.js b/website/client/js/controllers/tasksCtrl.js index cff78a93d0..7dbbf7b826 100644 --- a/website/client/js/controllers/tasksCtrl.js +++ b/website/client/js/controllers/tasksCtrl.js @@ -334,4 +334,34 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N task.tags.splice(tagIndex, 1); } } + + /* + ------------------------ + Disabling Spells + ------------------------ + */ + + $scope.spellDisabled = function (skill) { + if (skill === 'frost' && $scope.user.stats.buffs.streaks) { + return true; + } else if (skill === 'stealth' && $scope.user.stats.buffs.stealth >= $scope.user.dailys.length) { + return true; + } + + return false; + }; + + $scope.skillNotes = function (skill) { + var notes = skill.notes(); + + if (skill.key === 'frost' && $scope.spellDisabled(skill.key)) { + notes = window.env.t('spellWizardFrostAlreadyCast'); + } else if (skill.key === 'stealth' && $scope.spellDisabled(skill.key)) { + notes = window.env.t('spellRogueStealthMaxedOut'); + } else if (skill.key === 'stealth') { + notes = window.env.t('spellRogueStealthDaliesAvoided', { originalText: notes, number: $scope.user.stats.buffs.stealth }); + } + + return notes; + }; }]); diff --git a/website/views/shared/tasks/task_view/skills.jade b/website/views/shared/tasks/task_view/skills.jade index dccd6d1233..8d36c79ec4 100644 --- a/website/views/shared/tasks/task_view/skills.jade +++ b/website/views/shared/tasks/task_view/skills.jade @@ -8,13 +8,14 @@ ul.items.rewards // Class Skills ul.items(ng-if='main && list.type=="reward" && user.stats.class && !user.preferences.disableClasses') - li.task.reward-item(ng-repeat='(k,skill) in Content.spells[user.stats.class]', ng-if='user.stats.lvl >= skill.lvl',popover-trigger='mouseenter', popover-placement='top', popover='{{skill.notes()}}') + li.task.reward-item.list-group-item(ng-repeat='(k,skill) in Content.spells[user.stats.class]', ng-if='user.stats.lvl >= skill.lvl',popover-trigger='mouseenter', popover-placement='top', + popover='{{skillNotes(skill)}}') .task-meta-controls span.task-notes span.glyphicon.glyphicon-comment //left-hand size commands .task-controls.task-primary - a.money.btn-buy.item-btn(ng-click='castStart(skill)', ng-class='{active: skill.key == spell.key}') + a.money.btn-buy.item-btn(ng-click='castStart(skill)', ng-class='{"disabled": spellDisabled(k)}') span.reward-cost strong {{::skill.mana}} =env.t('mp')