fix cb for banish/invert

This commit is contained in:
Mashy 2019-07-23 15:57:50 +10:00
parent d03eec1423
commit ef11d14752

View File

@ -65,7 +65,10 @@ function registerEvents(store) {
store.dispatch(actions.setAnimFocus(animations.getFocusTargets(r))); store.dispatch(actions.setAnimFocus(animations.getFocusTargets(r)));
if (sequence.includes('START_SKILL')) store.dispatch(actions.setAnimSource(anims.animSource)); 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')) { if (sequence.includes('POST_SKILL')) {
// timeout to prevent text classes from being added too soon // timeout to prevent text classes from being added too soon
setTimeout( setTimeout(
@ -73,21 +76,14 @@ function registerEvents(store) {
timeout - TIMES.POST_SKILL_DURATION_MS timeout - TIMES.POST_SKILL_DURATION_MS
); );
} }
return setTimeout(() => { return setTimeout(() => {
const clearAnimProps = () => { store.dispatch(actions.setAnimSource(null));
store.dispatch(actions.setAnimSource(null)); store.dispatch(actions.setAnimTarget(null));
store.dispatch(actions.setAnimTarget(null)); store.dispatch(actions.setAnimText(null));
store.dispatch(actions.setAnimText(null)); store.dispatch(actions.setAnimFocus([]));
store.dispatch(actions.setAnimFocus([])); if (!sequence.includes('END_SKILL')
}; || ['Banish', 'Invert'].includes(anims.animTarget.skill)) return cb();
if (sequence.includes('END_SKILL')) { return true;
// If we are have an animation playing let the anim return cb()
store.dispatch(actions.setAnimCb(cb));
return clearAnimProps();
}
clearAnimProps();
return cb();
}, timeout); }, timeout);
}, err => { }, err => {
if (err) return console.error(err); if (err) return console.error(err);