From ef11d14752a50e11db295ef442e7c13a0e1a4d3a Mon Sep 17 00:00:00 2001 From: Mashy Date: Tue, 23 Jul 2019 15:57:50 +1000 Subject: [PATCH] fix cb for banish/invert --- client/src/events.jsx | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/client/src/events.jsx b/client/src/events.jsx index 4b401923..7c02a7b0 100644 --- a/client/src/events.jsx +++ b/client/src/events.jsx @@ -65,7 +65,10 @@ function registerEvents(store) { store.dispatch(actions.setAnimFocus(animations.getFocusTargets(r))); if (sequence.includes('START_SKILL')) store.dispatch(actions.setAnimSource(anims.animSource)); - if (sequence.includes('END_SKILL')) store.dispatch(actions.setAnimTarget(anims.animTarget)); + if (sequence.includes('END_SKILL')) { + store.dispatch(actions.setAnimTarget(anims.animTarget)); + if (!['Banish', 'Invert'].includes(anims.animTarget.skill)) store.dispatch(actions.setAnimCb(cb)); + } if (sequence.includes('POST_SKILL')) { // timeout to prevent text classes from being added too soon setTimeout( @@ -73,21 +76,14 @@ function registerEvents(store) { timeout - TIMES.POST_SKILL_DURATION_MS ); } - return setTimeout(() => { - const clearAnimProps = () => { - store.dispatch(actions.setAnimSource(null)); - store.dispatch(actions.setAnimTarget(null)); - store.dispatch(actions.setAnimText(null)); - store.dispatch(actions.setAnimFocus([])); - }; - if (sequence.includes('END_SKILL')) { - // If we are have an animation playing let the anim return cb() - store.dispatch(actions.setAnimCb(cb)); - return clearAnimProps(); - } - clearAnimProps(); - return cb(); + store.dispatch(actions.setAnimSource(null)); + store.dispatch(actions.setAnimTarget(null)); + store.dispatch(actions.setAnimText(null)); + store.dispatch(actions.setAnimFocus([])); + if (!sequence.includes('END_SKILL') + || ['Banish', 'Invert'].includes(anims.animTarget.skill)) return cb(); + return true; }, timeout); }, err => { if (err) return console.error(err);