feat: Disable spells on client when they cannot be cast

Closes #7110
Closes #6867
This commit is contained in:
Blade Barringer
2016-06-09 08:58:57 -05:00
parent a941ee8b84
commit b97d7cc9f9
4 changed files with 46 additions and 2 deletions

View File

@@ -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)",

View File

@@ -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

View File

@@ -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;
};
}]);

View File

@@ -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')