mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
feat: Disable spells on client when they cannot be cast
Closes #7110 Closes #6867
This commit is contained in:
@@ -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;
|
||||
};
|
||||
}]);
|
||||
|
||||
Reference in New Issue
Block a user