diff --git a/client/src/events.jsx b/client/src/events.jsx index 9931b283..845ffbbc 100644 --- a/client/src/events.jsx +++ b/client/src/events.jsx @@ -86,7 +86,7 @@ function registerEvents(store) { store.dispatch(actions.setAnimating(true)); store.dispatch(actions.setGameSkillInfo(null)); // stop fetching the game state til animations are done - const newRes = game.events[currentGame.events.length - 1]; + const newRes = game.events[currentGame.events.length]; return eachSeries(newRes, (r, cb) => { const timeout = r.delay; const anims = animations.getObjects(r, game, account); diff --git a/core/src/game.rs b/core/src/game.rs index 1cbef655..9258c2e0 100644 --- a/core/src/game.rs +++ b/core/src/game.rs @@ -191,9 +191,7 @@ impl Game { } fn skill_phase_start(mut self, resolution_animation_ms: i64) -> Game { - self.events.push(vec![]); - - self.phase_start = Utc::now() + self.phase_start = Utc::now() .checked_add_signed(Duration::milliseconds(resolution_animation_ms)) .expect("could not set phase start"); @@ -415,6 +413,8 @@ impl Game { } pub fn resolve_phase_start(mut self) -> Game { + self.events.push(vec![]); + if self.phase != Phase::Skill { panic!("game not in skill phase"); }