fix game construct css classes
This commit is contained in:
@@ -40,8 +40,11 @@ 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.resolution !== this.props.resolution) return true;
|
||||
if (newProps.construct !== this.props.construct) return true;
|
||||
if (newProps.resolution && newProps.resolution !== this.props.resolution) {
|
||||
const [type, variant] = newProps.resolution.event;
|
||||
if (variant.construct === this.props.construct.id && type === 'Ko') return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -56,15 +59,17 @@ class GameConstruct extends preact.Component {
|
||||
player,
|
||||
} = this.props;
|
||||
|
||||
const koEvent = resolution && resolution.text === 'KO!' && resolution.constructId === construct.id;
|
||||
const ko = construct.green_life.value === 0 && !koEvent ? 'ko' : '';
|
||||
|
||||
const cssClass = () => {
|
||||
if (koEvent) return 'ko-transition';
|
||||
if (animFocus && !animFocus.includes(construct.id)) return 'unfocus';
|
||||
const ko = construct.green_life.value === 0 ? 'ko' : '';
|
||||
const koEvent = () => {
|
||||
if (resolution) {
|
||||
const [type, variant] = resolution.event;
|
||||
if (variant.construct === construct.id && type === 'Ko') return 'ko-transition';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
const unfocus = animFocus && !animFocus.includes(construct.id) ? 'unfocus' : '';
|
||||
|
||||
const crypSkills = player
|
||||
? <div class="skills"> {range(0, 3).map(j => <SkillBtn key={j} construct={construct} i={j} />)} </div>
|
||||
: <div></div>;
|
||||
@@ -74,7 +79,7 @@ class GameConstruct extends preact.Component {
|
||||
<div
|
||||
onClick={() => selectSkillTarget(construct.id)}
|
||||
style={ activeSkill ? { cursor: 'pointer' } : {}}
|
||||
class={`game-construct ${ko} ${cssClass()}`}>
|
||||
class={`game-construct ${ko} ${koEvent()} ${unfocus}`}>
|
||||
<div class="left">
|
||||
{crypSkills}
|
||||
<ConstructEffectBox construct={construct} />
|
||||
|
||||
@@ -8,8 +8,8 @@ const addState = connect(({ resolution }) => ({ resolution }));
|
||||
class GameConstructLife extends preact.Component {
|
||||
shouldComponentUpdate(newProps) {
|
||||
if (newProps.resolution && newProps.resolution !== this.props.resolution) {
|
||||
const [type, info] = newProps.resolution.event;
|
||||
if (info.construct === this.props.construct.id
|
||||
const [type, variant] = newProps.resolution.event;
|
||||
if (variant.construct === this.props.construct.id
|
||||
&& (type === 'Damage' || type === 'Healing' || type === 'Recharge')) return true;
|
||||
}
|
||||
if (newProps.construct !== this.props.construct) return true;
|
||||
|
||||
@@ -240,7 +240,10 @@ function convertItem(v) {
|
||||
}
|
||||
|
||||
function effectInfo(i) {
|
||||
const hybridBlast = 25;
|
||||
// FIX ME
|
||||
return 'effect info to be fixed';
|
||||
|
||||
/*const hybridBlast = 25;
|
||||
const hasteStrike = 30;
|
||||
function multiplier(s) { // Update later to use server info in future
|
||||
if (s === 'CounterAttack') return 120;
|
||||
@@ -295,7 +298,7 @@ function effectInfo(i) {
|
||||
case 'Siphon': return `Construct will take ${multiplier(i.tick.skill)}% of caster's BluePower + GreenPower as blue damage each turn, healing the caster.`;
|
||||
|
||||
default: return 'Missing Effect Text';
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user