mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-25 07:05:51 +00:00
Merge pull request #2237 from colegleason/crit-notif
Add Critical Hit notification by watching user._tmp.crit
This commit is contained in:
commit
4c6ebb6f14
1 changed files with 8 additions and 0 deletions
|
|
@ -38,6 +38,14 @@ habitrpg.controller('NotificationCtrl',
|
|||
Notification.mp(mana);
|
||||
});
|
||||
|
||||
$rootScope.$watch('user._tmp.crit', function(after, before){
|
||||
if (after == before || !after) return;
|
||||
var amount = User.user._tmp.crit * 100 - 100;
|
||||
// reset the crit counter
|
||||
User.user._tmp.crit = undefined;
|
||||
Notification.text("Critical Hit! Bonus: " + amount + "%");
|
||||
});
|
||||
|
||||
$rootScope.$watch('user._tmp.drop', function(after, before){
|
||||
// won't work when getting the same item twice?
|
||||
if (after == before || !after) return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue