Skip to content

Commit

Permalink
Merge pull request HabitRPG#2237 from colegleason/crit-notif
Browse files Browse the repository at this point in the history
Add Critical Hit notification by watching user._tmp.crit
  • Loading branch information
lefnire committed Jan 2, 2014
2 parents 3018804 + f218a52 commit 4c6ebb6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions public/js/controllers/notificationCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4c6ebb6

Please sign in to comment.