shouldCompUpdate game construct, disable ko event

This commit is contained in:
Mashy 2019-10-28 14:58:33 +10:00
parent 2f391fc85b
commit 85591ec857
2 changed files with 24 additions and 9 deletions

View File

@ -85,21 +85,36 @@ class GameConstruct extends Component {
this.resolvedLength = 0; 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() { render() {
const { const {
i, // Changing state variables
activeSkill,
animFocus,
animText,
animating, animating,
construct, construct,
player, player,
activeSkill,
selectSkillTarget,
animFocus,
animText,
tutorialGame, tutorialGame,
gameSkillInfo,
// Constants
i,
itemInfo,
// Functions
selectSkillTarget,
setTutorialGameClear, setTutorialGameClear,
setGameEffectInfo, setGameEffectInfo,
gameSkillInfo,
itemInfo,
} = this.props; } = this.props;
const ko = construct.green_life.value === 0 ? 'ko' : ''; const ko = construct.green_life.value === 0 ? 'ko' : '';
@ -145,7 +160,7 @@ class GameConstruct extends Component {
> {c.effect} - {c.duration}T</div>) > {c.effect} - {c.duration}T</div>)
: null; : null;
return (<div class="effects"> {effects} </div>); return (<div class="effects"> {effects} </div>);
} };
return ( return (
<div <div

View File

@ -342,7 +342,7 @@ fn post_resolve(_skill: Skill, game: &mut Game, mut resolutions: Resolutions) ->
}; };
if target.is_ko() { 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(); target.effects.clear();
} }