fix targetting arrows
This commit is contained in:
parent
da9736256e
commit
e66a4233e8
@ -96,16 +96,13 @@ class ConstructAvatar extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ConstructText(props) {
|
function ConstructName(props) {
|
||||||
const { construct } = props;
|
const { construct } = props;
|
||||||
if (!construct) return false;
|
if (!construct) return false;
|
||||||
|
return <h3 class={'name'}><span>{construct.name}</span></h3>;
|
||||||
const text = construct.name;
|
|
||||||
|
|
||||||
return <h3 class={'name'}><span>{text}</span></h3>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
ConstructAvatar: addState(ConstructAvatar),
|
ConstructAvatar: addState(ConstructAvatar),
|
||||||
ConstructText,
|
ConstructName,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2,7 +2,7 @@ const preact = require('preact');
|
|||||||
const { connect } = require('preact-redux');
|
const { connect } = require('preact-redux');
|
||||||
const range = require('lodash/range');
|
const range = require('lodash/range');
|
||||||
|
|
||||||
const { ConstructAvatar, ConstructText } = require('./construct');
|
const { ConstructAvatar, ConstructName } = require('./construct');
|
||||||
|
|
||||||
const SkillBtn = require('./game.construct.skill.btn');
|
const SkillBtn = require('./game.construct.skill.btn');
|
||||||
const ConstructAnimationText = require('./game.construct.anim.text');
|
const ConstructAnimationText = require('./game.construct.anim.text');
|
||||||
@ -82,7 +82,7 @@ class GameConstruct extends preact.Component {
|
|||||||
<div class="right">
|
<div class="right">
|
||||||
<ConstructLife construct={construct} />
|
<ConstructLife construct={construct} />
|
||||||
<ConstructAvatar construct={construct} />
|
<ConstructAvatar construct={construct} />
|
||||||
<ConstructText construct={construct} />
|
<ConstructName construct={construct} />
|
||||||
<ConstructAnimationText construct={construct} />
|
<ConstructAnimationText construct={construct} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -31,7 +31,6 @@ class TargetSvg extends Component {
|
|||||||
if (newProps.game !== this.props.game) return true;
|
if (newProps.game !== this.props.game) return true;
|
||||||
if (newProps.account !== this.props.account) return true;
|
if (newProps.account !== this.props.account) return true;
|
||||||
if (newProps.animating !== this.props.animating) return true;
|
if (newProps.animating !== this.props.animating) return true;
|
||||||
if (newProps.animSkill !== this.props.animSkill) return true;
|
|
||||||
if (newProps.gameEffectInfo !== this.props.gameEffectInfo) return true;
|
if (newProps.gameEffectInfo !== this.props.gameEffectInfo) return true;
|
||||||
if (newProps.tutorialGame !== this.props.tutorialGame) return true;
|
if (newProps.tutorialGame !== this.props.tutorialGame) return true;
|
||||||
if (newState.width !== this.state.width) return true;
|
if (newState.width !== this.state.width) return true;
|
||||||
@ -44,12 +43,9 @@ class TargetSvg extends Component {
|
|||||||
// Changing State Variables
|
// Changing State Variables
|
||||||
account,
|
account,
|
||||||
animating,
|
animating,
|
||||||
animSkill,
|
|
||||||
game,
|
game,
|
||||||
gameEffectInfo,
|
gameEffectInfo,
|
||||||
tutorialGame,
|
tutorialGame,
|
||||||
// Static
|
|
||||||
itemInfo,
|
|
||||||
} = props;
|
} = props;
|
||||||
const { width, height } = state;
|
const { width, height } = state;
|
||||||
|
|
||||||
@ -87,14 +83,14 @@ class TargetSvg extends Component {
|
|||||||
const otherTeam = game.players.find(t => t.id !== account.id);
|
const otherTeam = game.players.find(t => t.id !== account.id);
|
||||||
|
|
||||||
const playerTeamIds = playerTeam.constructs.map(c => c.id);
|
const playerTeamIds = playerTeam.constructs.map(c => c.id);
|
||||||
const outgoing = game.stack.filter(stack => playerTeamIds.includes(stack.source_construct_id));
|
const outgoing = game.stack.filter(stack => stack.player === account.id);
|
||||||
|
|
||||||
function getPath(cast) {
|
function getPath(cast) {
|
||||||
const source = playerTeam.constructs.findIndex(c => c.id === cast.source_construct_id);
|
const source = playerTeam.constructs.findIndex(c => c.id === cast.source);
|
||||||
const defensive = playerTeamIds.includes(cast.target_construct_id);
|
const defensive = playerTeamIds.includes(cast.target);
|
||||||
const target = defensive
|
const target = defensive
|
||||||
? playerTeam.constructs.findIndex(c => c.id === cast.target_construct_id)
|
? playerTeam.constructs.findIndex(c => c.id === cast.target)
|
||||||
: otherTeam.constructs.findIndex(c => c.id === cast.target_construct_id);
|
: otherTeam.constructs.findIndex(c => c.id === cast.target);
|
||||||
|
|
||||||
const skillNumber = window.innerWidth <= 800 // mobile styling trigger
|
const skillNumber = window.innerWidth <= 800 // mobile styling trigger
|
||||||
? playerTeam.constructs[source].skills.findIndex(s => s.skill === cast.skill)
|
? playerTeam.constructs[source].skills.findIndex(s => s.skill === cast.skill)
|
||||||
|
|||||||
@ -83,11 +83,11 @@ function registerEvents(store) {
|
|||||||
if (animating) return false;
|
if (animating) return false;
|
||||||
|
|
||||||
if (game && currentGame) {
|
if (game && currentGame) {
|
||||||
if (game.resolved.length !== currentGame.resolved.length) {
|
if (game.events.length !== currentGame.events.length) {
|
||||||
store.dispatch(actions.setAnimating(true));
|
store.dispatch(actions.setAnimating(true));
|
||||||
store.dispatch(actions.setGameSkillInfo(null));
|
store.dispatch(actions.setGameSkillInfo(null));
|
||||||
// stop fetching the game state til animations are done
|
// stop fetching the game state til animations are done
|
||||||
const newRes = game.resolved.slice(currentGame.resolved.length);
|
const newRes = game.events[currentGame.events.length];
|
||||||
return eachSeries(newRes, (r, cb) => {
|
return eachSeries(newRes, (r, cb) => {
|
||||||
if (!r.event) return cb();
|
if (!r.event) return cb();
|
||||||
let timeout = animations.getTime(r.stages);
|
let timeout = animations.getTime(r.stages);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user