Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. game.tick = function() {
  2. var self = this;
  3.  
  4. _.each(self.all_parts(), function(p) {
  5. p.clear_buffs();
  6. });
  7.  
  8. self.mana_generated(0);
  9. self.arcana_generated(0);
  10. _.each(self.spent_mana(), function(sm) {
  11. sm.val(0);
  12. });
  13.  
  14. _.each(self.connected_nodes(), function(n) {
  15. if(n.part() && n.part().apply) {
  16. n.part().apply(self);
  17. }
  18. if(n.part() && n.part().tick) {
  19. n.part().tick(self);
  20. }
  21. });
  22.  
  23. _.each(self.all_parts(), function(p) {
  24. p.highest_stats.recompute();
  25. });
  26.  
  27. var net = self.mana_generated();
  28. _.each(self.spent_mana(), function(sm) {
  29. net -= sm.val();
  30. });
  31. self.net_mana(net);
  32.  
  33. self.save_ticks.inc(1);
  34. if(self.save_ticks() >= 60) {
  35. self.save_game();
  36. }
  37.  
  38. var connected = self.connected_nodes();
  39. for(var x = connected.length - 1; x>= 0; x--) {
  40. var node = connected[x];
  41. if(node.part() && node.part().reverse_apply) {
  42. node.part().reverse_apply(self);
  43. }
  44. }
  45. };
  46.  
  47. game.pause();
  48. game.unpause();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement