Time delay between user attack and NPC deflection.

Josh suggested I refactor all my logic that has to do with timing into my Javascript. I created the function launchAttack, which declares within it all variables of a target and attacker along with all functions associated with attacking. Users can attack NPCs. NPCs have a chance to deflect the attack. There is a lag time between when the attack is initiated and when it lands. When an attack has been landed the bots health is updated in the database, then sent back from rails to Pusher.js, and updated on the players combat log in the browser using Jquery.


Lessons learned from this branch:
-If a problem seems too hard to solve, instead of attempting to discover a complex solution, try to change the step before it and solve the problem on that level. For example, instead of trying to solve the problem of timing in the model, where it is very hard, I just decided to handle timing before anything even got to the model and it became much easier. I handled the timing in the Javascript instead.

Vim command Ag allows you to search throughout entire document for string match
comments