diff --git a/client/src/actions.jsx b/client/src/actions.jsx index e426f70b..e99bba62 100644 --- a/client/src/actions.jsx +++ b/client/src/actions.jsx @@ -1,12 +1,11 @@ export const setAccount = value => ({ type: 'SET_ACCOUNT', value }); export const setAnimating = value => ({ type: 'SET_ANIMATING', value }); -export const setAnimCb = value => ({ type: 'SET_ANIM_CB', value }); export const setAnimFocus = value => ({ type: 'SET_ANIM_FOCUS', value }); -export const setAnimSkill = value => ({ type: 'SET_ANIM_SKILL', value }); +export const setAnimSkill = value => ({ type: 'SET_ANIM_SKILL', value }); export const setAnimSource = value => ({ type: 'SET_ANIM_SOURCE', value }); export const setAnimTarget = value => ({ type: 'SET_ANIM_TARGET', value }); -export const setAnimText = value => ({ type: 'SET_ANIM_TEXT', value }); +export const setResolution = value => ({ type: 'SET_RESOLUTION', value }); export const setDemo = value => ({ type: 'SET_DEMO', value }); diff --git a/client/src/animations.socket.jsx b/client/src/animations.socket.jsx index d42ded1b..b81e752b 100644 --- a/client/src/animations.socket.jsx +++ b/client/src/animations.socket.jsx @@ -51,10 +51,10 @@ function createSocket(store) { if (r.stages.includes('POST_SKILL') && text) { // timeout to prevent text classes from being added too soon if (timeout === TIMES.POST_SKILL_DURATION_MS) { - store.dispatch(actions.setAnimText(text)); + store.dispatch(actions.setResolution(text)); } else { setTimeout( - () => store.dispatch(actions.setAnimText(text)), + () => store.dispatch(actions.setResolution(text)), timeout - TIMES.POST_SKILL_DURATION_MS ); } @@ -64,7 +64,7 @@ function createSocket(store) { store.dispatch(actions.setAnimSkill(null)); store.dispatch(actions.setAnimSource(null)); store.dispatch(actions.setAnimTarget(null)); - store.dispatch(actions.setAnimText(null)); + store.dispatch(actions.setResolution(null)); store.dispatch(actions.setAnimFocus([])); if (r.stages.includes('END_SKILL') && animations.isCbAnim(anims.animSkill)) return true; return cb(); @@ -75,7 +75,7 @@ function createSocket(store) { store.dispatch(actions.setAnimSkill(null)); store.dispatch(actions.setAnimSource(null)); store.dispatch(actions.setAnimTarget(null)); - store.dispatch(actions.setAnimText(null)); + store.dispatch(actions.setResolution(null)); store.dispatch(actions.setAnimating(false)); store.dispatch(actions.setGameEffectInfo(null)); diff --git a/client/src/animations.utils.jsx b/client/src/animations.utils.jsx index 2290f560..25542967 100644 --- a/client/src/animations.utils.jsx +++ b/client/src/animations.utils.jsx @@ -7,7 +7,7 @@ function setAnimations(r, store, account) { store.dispatch(actions.setAnimFocus(focus)); if (type === 'Cast') { - store.dispatch(actions.setAnimText(null)); + store.dispatch(actions.setResolution(null)); const { construct, player, direction: [x, y] } = variant; const animY = y && player === account.id ? -1 : y; @@ -22,7 +22,7 @@ function setAnimations(r, store, account) { } if (type.includes('Hit')) { - store.dispatch(actions.setAnimText(null)); + store.dispatch(actions.setResolution(null)); const { construct, player, direction: [x, y] } = variant; const animY = y && player === account.id ? -1 : y; @@ -38,14 +38,14 @@ function setAnimations(r, store, account) { return setTimeout(() => store.dispatch(actions.setAnimTarget(null)), TIMES.TARGET_DURATION_MS); } - return store.dispatch(actions.setAnimText(r)); + return store.dispatch(actions.setResolution(r)); } function clearAnimations(store) { store.dispatch(actions.setAnimSkill(null)); store.dispatch(actions.setAnimSource(null)); store.dispatch(actions.setAnimTarget(null)); - store.dispatch(actions.setAnimText(null)); + store.dispatch(actions.setResolution(null)); store.dispatch(actions.setAnimating(false)); store.dispatch(actions.setGameEffectInfo(null)); store.dispatch(actions.setAnimFocus(null)); diff --git a/client/src/components/construct.jsx b/client/src/components/construct.jsx index 57b221ab..f4ecbd3e 100644 --- a/client/src/components/construct.jsx +++ b/client/src/components/construct.jsx @@ -13,8 +13,8 @@ const { ConstructAnimation } = require('./animations'); const addState = connect( function receiveState(state) { - const { animSource, animTarget, animText } = state; - return { animSource, animTarget, animText }; + const { animSource, animTarget, resolution } = state; + return { animSource, animTarget, resolution }; } ); @@ -62,9 +62,9 @@ class ConstructAvatar extends Component { } componentDidUpdate(prevProps) { - const { animSource, animTarget, animText, construct } = this.props; + const { animSource, animTarget, resolution, construct } = this.props; // a different text object and text construct - if (animText && animText !== prevProps.animText && animText.constructId === construct.id) { + if (resolution && resolution !== prevProps.resolution && resolution.constructId === construct.id) { return wiggle(construct.id, this.idle); } @@ -86,10 +86,10 @@ class ConstructAvatar extends Component { shouldComponentUpdate(newProps) { - const { animSource, animTarget, animText, construct, mouseOver } = newProps; + const { animSource, animTarget, resolution, construct, mouseOver } = newProps; if (animSource !== this.props.animSource) return true; if (animTarget !== this.props.animTarget) return true; - if (animText !== this.props.animText) return true; + if (resolution !== this.props.resolution) return true; if (construct !== this.props.construct) return true; if (mouseOver !== this.props.mouseOver) return true; return false; diff --git a/client/src/components/game.construct.anim.text.jsx b/client/src/components/game.construct.anim.text.jsx index 56f8f04d..07773ad7 100644 --- a/client/src/components/game.construct.anim.text.jsx +++ b/client/src/components/game.construct.anim.text.jsx @@ -7,17 +7,17 @@ const shapes = require('./shapes'); const { removeTier } = require('../utils'); const { TIMES } = require('./../constants'); -const addState = connect(({ animText, itemInfo }) => ({ animText, itemInfo })); +const addState = connect(({ resolution, itemInfo }) => ({ resolution, itemInfo })); class AnimText extends preact.Component { shouldComponentUpdate(newProps) { - if (newProps.animText !== this.props.animText) return true; + if (newProps.resolution !== this.props.resolution) return true; return false; } componentDidUpdate(prevProps) { - const { animText, construct } = this.props; - if (animText && animText !== prevProps.animText && animText.event[1].construct === construct.id) { + const { resolution, construct } = this.props; + if (resolution && resolution !== prevProps.resolution && resolution.event[1].construct === construct.id) { anime({ targets: '.combat-text', top: '40%', @@ -28,10 +28,10 @@ class AnimText extends preact.Component { } render() { - const { construct, animText, itemInfo } = this.props; - if (animText && animText.event[1].construct === construct.id) { + const { construct, resolution, itemInfo } = this.props; + if (resolution && resolution.event[1].construct === construct.id) { const itemSourceDescription = () => { - const itemSource = itemInfo.combos.filter(c => c.item === removeTier(animText.skill)); + const itemSource = itemInfo.combos.filter(c => c.item === removeTier(resolution.skill)); const itemSourceInfo = itemSource.length ? `${itemSource[0].components[0]} ${itemSource[0].components[1]} ${itemSource[0].components[2]}` : false; @@ -40,7 +40,7 @@ class AnimText extends preact.Component { }; const generateAnimText = () => { - const [type, event] = animText.event; + const [type, event] = resolution.event; if (type === 'Ko') return

KO!

; if (type === 'Disable') { const { disable } = event; @@ -82,7 +82,7 @@ class AnimText extends preact.Component { return (
-

{animText.skill}

+

{resolution.skill}

{itemSourceDescription()} {generateAnimText()}
diff --git a/client/src/components/game.construct.effect.box.jsx b/client/src/components/game.construct.effect.box.jsx index 0766b014..4f571533 100644 --- a/client/src/components/game.construct.effect.box.jsx +++ b/client/src/components/game.construct.effect.box.jsx @@ -7,7 +7,7 @@ const shapes = require('./shapes'); const { INFO } = require('./../constants'); const addState = connect( - ({ animText, itemInfo, gameSkillInfo }) => ({ animText, itemInfo, gameSkillInfo }), + ({ resolution, itemInfo, gameSkillInfo }) => ({ resolution, itemInfo, gameSkillInfo }), function receiveDispatch(dispatch) { function setGameEffectInfo(info) { @@ -21,8 +21,8 @@ const addState = connect( class GameConstructEffects extends preact.Component { shouldComponentUpdate(newProps) { - if (newProps.animText && newProps.animText !== this.props.animText) { - const [type, info] = newProps.animText.event; + if (newProps.resolution && newProps.resolution !== this.props.resolution) { + const [type, info] = newProps.resolution.event; if (info.construct === this.props.construct.id && (type === 'Effect' || type === 'Removal')) return true; } @@ -32,7 +32,7 @@ class GameConstructEffects extends preact.Component { render() { const { - animText, + resolution, construct, gameSkillInfo, setGameEffectInfo, @@ -56,7 +56,7 @@ class GameConstructEffects extends preact.Component { ); } - const effects = animText ? animText.event[1].display.effects : construct.effects; + const effects = resolution ? resolution.event[1].display.effects : construct.effects; const renderEffects = effects.length ? effects.map(c => diff --git a/client/src/components/game.construct.jsx b/client/src/components/game.construct.jsx index 253b4af6..7e0d3592 100644 --- a/client/src/components/game.construct.jsx +++ b/client/src/components/game.construct.jsx @@ -17,7 +17,7 @@ const addState = connect( activeSkill, animFocus, - animText, + resolution, } = state; function selectSkillTarget(targetConstructId) { @@ -30,7 +30,7 @@ const addState = connect( return { activeSkill, animFocus, - animText, + resolution, selectSkillTarget, }; } @@ -40,7 +40,7 @@ class GameConstruct extends preact.Component { shouldComponentUpdate(newProps) { if (newProps.activeSkill !== this.props.activeSkill) return true; if (newProps.animFocus !== this.props.animFocus) return true; - if (newProps.animText !== this.props.animText) return true; + if (newProps.resolution !== this.props.resolution) return true; if (newProps.construct !== this.props.construct) return true; return false; } @@ -50,13 +50,13 @@ class GameConstruct extends preact.Component { // Changing state variables activeSkill, animFocus, - animText, + resolution, selectSkillTarget, construct, player, } = this.props; - const koEvent = animText && animText.text === 'KO!' && animText.constructId === construct.id; + const koEvent = resolution && resolution.text === 'KO!' && resolution.constructId === construct.id; const ko = construct.green_life.value === 0 && !koEvent ? 'ko' : ''; const cssClass = () => { diff --git a/client/src/components/game.construct.life.jsx b/client/src/components/game.construct.life.jsx index e3ccc52a..58eb2023 100644 --- a/client/src/components/game.construct.life.jsx +++ b/client/src/components/game.construct.life.jsx @@ -3,12 +3,12 @@ const { connect } = require('preact-redux'); const shapes = require('./shapes'); -const addState = connect(({ animText }) => ({ animText })); +const addState = connect(({ resolution }) => ({ resolution })); class GameConstructLife extends preact.Component { shouldComponentUpdate(newProps) { - if (newProps.animText && newProps.animText !== this.props.animText) { - const [type, info] = newProps.animText.event; + if (newProps.resolution && newProps.resolution !== this.props.resolution) { + const [type, info] = newProps.resolution.event; if (info.construct === this.props.construct.id && (type === 'Damage' || type === 'Healing' || type === 'Recharge')) return true; } @@ -17,7 +17,7 @@ class GameConstructLife extends preact.Component { } render() { - const { construct, animText } = this.props; + const { construct, resolution } = this.props; const lifeBars = (redLife, greenLife, blueLife) => { return (
@@ -37,8 +37,8 @@ class GameConstructLife extends preact.Component { ); }; - if (animText) { - const { red, blue, green } = animText.event[1].display; + if (resolution) { + const { red, blue, green } = resolution.event[1].display; return lifeBars(red, green, blue); } diff --git a/client/src/reducers.jsx b/client/src/reducers.jsx index ef43b31a..73a3dcf1 100644 --- a/client/src/reducers.jsx +++ b/client/src/reducers.jsx @@ -14,12 +14,12 @@ module.exports = { activeSkill: createReducer(null, 'SET_ACTIVE_SKILL'), animating: createReducer(false, 'SET_ANIMATING'), - animCb: createReducer(null, 'SET_ANIM_CB'), animSkill: createReducer(null, 'SET_ANIM_SKILL'), animSource: createReducer(null, 'SET_ANIM_SOURCE'), animFocus: createReducer(null, 'SET_ANIM_FOCUS'), animTarget: createReducer(null, 'SET_ANIM_TARGET'), - animText: createReducer(null, 'SET_ANIM_TEXT'), + + resolution: createReducer(null, 'SET_RESOLUTION'), demo: createReducer(null, 'SET_DEMO'),