diff --git a/client/src/animations.socket.jsx b/client/src/animations.socket.jsx index 9dcc6ebd..ba3da1c4 100644 --- a/client/src/animations.socket.jsx +++ b/client/src/animations.socket.jsx @@ -31,7 +31,9 @@ function createSocket(store) { const sequence = getCombatSequence(r); return eachSeries(sequence, (stages, sCb) => { const stagedR = Object.create(r); + stagedR.sequence = sequence; stagedR.stages = stages; + let timeout = 0; if (stages.includes('START_SKILL') && stages.includes('END_SKILL')) { timeout = (TIMES.TARGET_DURATION_MS + TIMES.TARGET_DELAY_MS); diff --git a/client/src/components/animations.jsx b/client/src/components/animations.jsx index 82d7025c..e0d88364 100644 --- a/client/src/components/animations.jsx +++ b/client/src/components/animations.jsx @@ -36,7 +36,7 @@ const colours = { white: '#FFFFFF', }; -const SOURCE_ANIM_MS = 850; +const { TIMES } = require('../constants'); function animations(props) { const { game, account, resolution, player, construct } = props; @@ -44,10 +44,9 @@ function animations(props) { const [, event] = resolution.event; if (!event.skill) return false; if (!resolution.target) return false; - const { stages } = resolution; // source animation - if (resolution.source.id === construct.id && stages.includes('START_SKILL')) { + if (resolution.source.id === construct.id && resolution.stages.includes('START_SKILL')) { const playerTeam = game.players.find(t => t.id === account.id); const playerTeamIds = playerTeam.constructs.map(c => c.id); const otherTeam = game.players.find(t => t.id !== account.id); @@ -73,14 +72,14 @@ function animations(props) { : otherTeamIds.findIndex(c => c === resolution.target.id); const x = j - i; - anime({ targets: [document.getElementById(construct.id)], translateY: y * 200, translateX: x * 200, easing: 'easeInOutElastic', direction: 'alternate', - duration: SOURCE_ANIM_MS, + duration: TIMES.SOURCE_DURATION_MS, + }); } @@ -89,7 +88,7 @@ function animations(props) { // target animation const anim = text => { console.log(text); - if (!text || !stages.includes('END_SKILL')) return false; + if (!text || !resolution.sequence[0].includes('END_SKILL')) return false; const skill = removeTier(text); // if (skill === 'Bash' && type === 'Damage') return false;