From 85591ec8573458ded55bde6744408b503dccdcdb Mon Sep 17 00:00:00 2001 From: Mashy Date: Mon, 28 Oct 2019 14:58:33 +1000 Subject: [PATCH] shouldCompUpdate game construct, disable ko event --- client/src/components/game.construct.jsx | 31 ++++++++++++++++++------ server/src/skill.rs | 2 +- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/client/src/components/game.construct.jsx b/client/src/components/game.construct.jsx index 79f2a8bc..75a1677d 100644 --- a/client/src/components/game.construct.jsx +++ b/client/src/components/game.construct.jsx @@ -85,21 +85,36 @@ class GameConstruct extends Component { this.resolvedLength = 0; } + 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.animating !== this.props.animating) return true; + if (newProps.construct !== this.props.construct) return true; + if (newProps.player !== this.props.player) return true; + if (newProps.tutorialGame !== this.props.tutorialGame) return true; + if (newProps.gameSkillInfo !== this.props.gameSkillInfo) return true; + return false; + } + render() { const { - i, + // Changing state variables + activeSkill, + animFocus, + animText, animating, construct, player, - activeSkill, - selectSkillTarget, - animFocus, - animText, tutorialGame, + gameSkillInfo, + // Constants + i, + itemInfo, + // Functions + selectSkillTarget, setTutorialGameClear, setGameEffectInfo, - gameSkillInfo, - itemInfo, } = this.props; const ko = construct.green_life.value === 0 ? 'ko' : ''; @@ -145,7 +160,7 @@ class GameConstruct extends Component { > {c.effect} - {c.duration}T) : null; return (
{effects}
); - } + }; return (
}; if target.is_ko() { - resolutions.push(Resolution::new(&source, &target).event(Event::Ko()).stages(EventStages::PostOnly)); + // resolutions.push(Resolution::new(&source, &target).event(Event::Ko()).stages(EventStages::PostOnly)); target.effects.clear(); }