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;
}
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</div>)
: null;
return (<div class="effects"> {effects} </div>);
}
};
return (
<div

View File

@ -342,7 +342,7 @@ fn post_resolve(_skill: Skill, game: &mut Game, mut resolutions: Resolutions) ->
};
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();
}