diff --git a/client/src/animations.utils.jsx b/client/src/animations.utils.jsx index 5220f3c7..1ba4bf10 100644 --- a/client/src/animations.utils.jsx +++ b/client/src/animations.utils.jsx @@ -2,17 +2,20 @@ const actions = require('./actions'); const { TIMES } = require('./constants'); function setAnimations(r, store, account) { + const { cast, focus, event, delay } = r; + const { source, target, player, skill } = cast; + store.dispatch(actions.setAnimFocus(r.focus)); - if (r.variant[0] === 'Cast') { + if (r.event[0] === 'Cast') { store.dispatch(actions.setAnimText(null)); - const { player } = r.cast; - const { x, y, target } = r.variant[1]; + debugger + const { construct, direction: [x, y] } = r.event[1]; const animY = y && player === account.id ? -1 : y; const animSource = { animation: 'sourceCast', - constructId: target, + constructId: construct, direction: { x, y: animY }, }; store.dispatch(actions.setAnimSource(animSource)); @@ -20,15 +23,14 @@ function setAnimations(r, store, account) { return setTimeout(() => store.dispatch(actions.setAnimSource(null)), TIMES.SOURCE_DURATION_MS); } - if (r.variant[0].includes('Hit')) { + if (r.event[0].includes('Hit')) { store.dispatch(actions.setAnimText(null)); - const { player, skill } = r.cast; - const { x, y, target } = r.variant[1]; + const { construct, direction: [x, y] } = r.event[1]; const animY = y && player === account.id ? -1 : y; const isPlayer = player === account.id; const animTarget = { - constructId: target, + constructId: construct, player: isPlayer, skill, direction: { x, y: animY }, diff --git a/client/src/components/game.construct.anim.text.jsx b/client/src/components/game.construct.anim.text.jsx index b54d9cd1..2c652e53 100644 --- a/client/src/components/game.construct.anim.text.jsx +++ b/client/src/components/game.construct.anim.text.jsx @@ -17,7 +17,7 @@ class AnimText extends preact.Component { componentDidUpdate(prevProps) { const { animText, construct } = this.props; - if (animText && animText !== prevProps.animText && animText.variant[1].target === construct.id) { + if (animText && animText !== prevProps.animText && animText.event[1].construct === construct.id) { anime({ targets: '.combat-text', top: '40%', @@ -29,7 +29,7 @@ class AnimText extends preact.Component { render() { const { construct, animText, itemInfo } = this.props; - if (animText && animText.variant[1].target === construct.id) { + if (animText && animText.event[1].construct === construct.id) { const itemSourceDescription = () => { const itemSource = itemInfo.combos.filter(c => c.item === removeTier(animText.cast.skill)); const itemSourceInfo = itemSource.length @@ -40,7 +40,7 @@ class AnimText extends preact.Component { }; const generateAnimText = () => { - const [type, event] = animText.variant; + const [type, event] = animText.event; if (type === 'Ko') return