From 2fcbd244950b0f257a2d865c56e80c0162eb7394 Mon Sep 17 00:00:00 2001 From: ntr Date: Fri, 5 Jul 2019 18:27:16 +1000 Subject: [PATCH] events code from anims --- client/src/components/anims/purify.jsx | 4 ++-- client/src/events.jsx | 17 +++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/client/src/components/anims/purify.jsx b/client/src/components/anims/purify.jsx index fb3c02fe..d4b1001b 100644 --- a/client/src/components/anims/purify.jsx +++ b/client/src/components/anims/purify.jsx @@ -34,14 +34,14 @@ class Purify extends Component { this.charges = points.map(coord => projectile(coord[0], coord[1], 12, COLOURS.GREEN)); } - render({ team }) { + render() { return ( diff --git a/client/src/events.jsx b/client/src/events.jsx index 88f1f1b6..dbbbc76a 100644 --- a/client/src/events.jsx +++ b/client/src/events.jsx @@ -50,7 +50,6 @@ function registerEvents(store) { const { game: currentGame, ws } = store.getState(); if (game) ws.startGameStateTimeout(game.id); - console.log(JSON.stringify(game)) if (game && currentGame) { if (game.resolved.length !== currentGame.resolved.length) { // stop fetching the game state til animations are done @@ -60,14 +59,20 @@ function registerEvents(store) { if (['Disable', 'TargetKo'].includes(r.event[0])) return cb(); // Create sub events for combat animations const sequence = getCombatSequence(r); - return eachSeries(sequence, (stage, sCb) => { - const { skip } = store.getState(); - if (skip) return sCb('skip'); + return eachSeries(sequence, (stages, sCb) => { const stagedR = Object.create(r); - stagedR.stage = stage; + stagedR.sequence = sequence; + stagedR.stages = stages; + + let timeout = 0; + if (stages.includes('START_SKILL') && stages.includes('END_SKILL')) { + timeout = TIMES.SOURCE_AND_TARGET_TOTAL_DURATION; + } else if (stages.includes('START_SKILL')) timeout = TIMES.SOURCE_DURATION_MS; + else if (stages.includes('END_SKILL')) timeout = TIMES.TARGET_DURATION_MS; + else if (stages.includes('POST_SKILL')) timeout = TIMES.POST_SKILL_DURATION_MS; store.dispatch(actions.setResolution(stagedR)); - return setTimeout(sCb, TIMES[stage]); + return setTimeout(sCb, timeout); }, err => { if (err) console.error(err); // Finished this resolution