diff --git a/client/src/events.jsx b/client/src/events.jsx index 48028205..e5d3a92b 100644 --- a/client/src/events.jsx +++ b/client/src/events.jsx @@ -77,21 +77,24 @@ function registerEvents(store) { if (game && currentGame) { if (game.resolutions.length !== currentGame.resolutions.length) { + // stop fetching the game state til animations are done store.dispatch(actions.setAnimating(true)); store.dispatch(actions.setGameSkillInfo(null)); - // stop fetching the game state til animations are done - const newRes = game.resolutions[game.resolutions.length - 1]; - return eachSeries(newRes, (r, cb) => { - if (r.delay === 0) return cb(); // TargetKo etc - setAnimations(r, store); - return setTimeout(cb, r.delay); + + const newTurns = game.resolutions.slice(currentGame.resolutions.length); + return eachSeries(newTurns, (turn, turnCb) => { + return eachSeries(turn, (r, cb) => { + if (r.delay === 0) return cb(); // TargetKo etc + setAnimations(r, store); + return setTimeout(cb, r.delay); + }, turnCb); }, err => { if (err) return console.error(err); clearAnimations(store); // set the game state so resolutions don't fire twice store.dispatch(actions.setGame(game)); ws.sendGameState(game.id); - return true; + return false; }); } }