Create delay between attack initiating and hitting

 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.

The current implementation of attack delaying works by deciding in
advance if an attack will be successful, then waiting the delay time,
and finally sending the hit registration to Rails. When I implement
attack delaying with players it will go more like this:
1)User 1 initiates attack
2)Timer starts, if either players try to exit room they receive an error
3)If User 2 can deflect attack while timer is activated
4)Timer is up, a funciton will check of the verdict of if User 2 ever
deflected the attack.
Targets powerlevel updates real time in fight

As a target incurs damage, it is reflected in real time in both the
users browser and the database.