animText -> resolution
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 <h1><span>KO!</span></h1>;
|
||||
if (type === 'Disable') {
|
||||
const { disable } = event;
|
||||
@@ -82,7 +82,7 @@ class AnimText extends preact.Component {
|
||||
|
||||
return (
|
||||
<div class="combat-text">
|
||||
<h2><span>{animText.skill}</span></h2>
|
||||
<h2><span>{resolution.skill}</span></h2>
|
||||
<span>{itemSourceDescription()}</span>
|
||||
{generateAnimText()}
|
||||
</div>
|
||||
|
||||
@@ -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 {
|
||||
</div>);
|
||||
}
|
||||
|
||||
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 =>
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
@@ -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 (
|
||||
<div class="stats">
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user