diff --git a/client/src/events.jsx b/client/src/events.jsx old mode 100644 new mode 100755 index 96ad39be..1cf4ffca --- a/client/src/events.jsx +++ b/client/src/events.jsx @@ -3,6 +3,7 @@ const eachSeries = require('async/eachSeries'); const actions = require('./actions'); const { TIMES } = require('./constants'); +const { getCombatSequence } = require('./utils'); function registerEvents(store) { function setCryps(cryps) { @@ -25,10 +26,7 @@ function registerEvents(store) { return eachSeries(newRes, (r, cb) => { if (['Disable', 'TargetKo'].includes(r.event[0])) return cb(); // Create sub events for combat animations - // Some types only need to animate final effect - const sequence = ['Ko'].includes(r.event[0]) - ? ['POST_SKILL'] - : ['START_SKILL', 'END_SKILL', 'POST_SKILL']; + const sequence = getCombatSequence(r.event); return eachSeries(sequence, (stage, sCb) => { const stagedR = Object.create(r); stagedR.stage = stage; diff --git a/client/src/utils.jsx b/client/src/utils.jsx index f25c95b1..fa34190d 100644 --- a/client/src/utils.jsx +++ b/client/src/utils.jsx @@ -175,6 +175,14 @@ function eventClasses(resolution, cryp) { return ''; } +function getCombatSequence(event) { + if (!event) return false; + // Skip combat animations depending on event type, expandable in future + if (['Ko'].includes(event[0])) return ['POST_SKILL']; + if (['DecayTick'].includes(event[1].skill)) return ['END_SKILL', 'POST_SKILL']; + return ['START_SKILL', 'END_SKILL', 'POST_SKILL']; +} + function getCombatText(cryp, resolution) { if (!resolution) return ''; @@ -262,6 +270,7 @@ module.exports = { genAvatar, requestAvatar, eventClasses, + getCombatSequence, getCombatText, NULL_UUID, STATS,