Merge branch 'develop' of ssh://mnml.gg:40022/~/mnml into develop

This commit is contained in:
ntr 2019-07-23 19:09:30 +10:00
commit 8e8a6a3673
9 changed files with 28 additions and 26 deletions

View File

@ -12,7 +12,7 @@ function getObjects(resolution, stages, game, account) {
if (!resolution) return none();
if (!resolution.target) return none();
const [, event] = resolution.event;
const [type, event] = resolution.event;
if (!event || !event.skill) return none();
const playerTeam = game.players.find(t => t.id === account.id);
@ -22,6 +22,14 @@ function getObjects(resolution, stages, game, account) {
const sourceIsPlayer = playerTeamIds.includes(resolution.source.id);
const targetIsPlayer = playerTeamIds.includes(resolution.target.id);
const targetting = () => {
if (type === 'AoeSkill') {
if (targetIsPlayer) return playerTeamIds;
return otherTeamIds;
}
return [resolution.target.id];
};
const sameTeam = (sourceIsPlayer && targetIsPlayer) || (!sourceIsPlayer && !targetIsPlayer);
let y = 0;
if (!sameTeam) y = targetIsPlayer ? 1 : -1;
@ -56,11 +64,10 @@ function getObjects(resolution, stages, game, account) {
const animTarget = {
skill,
constructId: resolution.target.id,
constructId: targetting(),
player: playerTeamIds.includes(resolution.target.id),
direction,
};
return {
animSource,
animTarget,
@ -109,11 +116,11 @@ function getFocusTargets(resolution, game) {
if (type === 'AoeSkill') {
const targetTeam = game.players.find(t => t.constructs.find(c => c.id === target));
const targetTeamIds = targetTeam.constructs.map(c => c.id);
if (source !== target) return targetTeamIds.push(source);
if (source !== target) targetTeamIds.push(source);
return targetTeamIds;
}
if (source !== target) return [source, target];
return target;
return [target];
}
function getText(resolution, sequence) {

View File

@ -64,7 +64,7 @@ class ConstructAnimation extends Component {
constructId,
} = animTarget;
if (construct.id !== constructId) return false;
if (!constructId.includes(construct.id)) return false;
// find target animation
const chooseAnim = (skill) => {

View File

@ -27,15 +27,9 @@ class Block extends Component {
xmlns="http://www.w3.org/2000/svg"
transform="rotate(180)"
viewBox="0 0 256 256">
<polygon
points='128,168 80,240 176,240'
id="charge"/>
<polyline
points='176,240 212,216 128,96 44,216 80,240'
id="charge"/>
<polyline
points='212,216 248,192 128,24 8,192 44,216'
id="charge"/>
<polygon points='128,168 80,240 176,240'/>
<polyline points='176,240 212,216 128,96 44,216 80,240'/>
<polyline points='212,216 248,192 128,24 8,192 44,216'/>
</svg>
);
}

View File

@ -22,7 +22,7 @@ class Buff extends Component {
return (
<svg
id='buff'
class="skill-animation"
class="skill-animation white"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 200 200">

View File

@ -22,7 +22,7 @@ class Debuff extends Component {
return (
<svg
id='debuff'
class="skill-animation"
class="skill-animation white"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 200 200"

View File

@ -98,7 +98,12 @@ class Ruin extends Component {
componentWillUnmount() {
for (let i = this.animations.length - 1; i >= 0; i--) {
this.animations[i].reset();
} this.props.animCb();
}
try {
this.props.animCb();
} catch (e) {
console.log(e);
}
}
}

View File

@ -132,7 +132,7 @@ class ConstructAvatar extends Component {
}
// this is the target
if (animTarget && animTarget.constructId === construct.id) {
if (animTarget && animTarget.constructId.includes(construct.id)) {
// console.warn(construct.name, 'should update')
return true;
}
@ -141,7 +141,7 @@ class ConstructAvatar extends Component {
const prevSrc = this.props.animSource && this.props.animSource.constructId === construct.id;
if (prevSrc && !animSource) return true;
const prevTarget = this.props.animTarget && this.props.animTarget.constructId === construct.id;
const prevTarget = this.props.animTarget && this.props.animTarget.constructId.includes(construct.id);
if (prevTarget && !animTarget) return true;
// console.warn(construct.name, 'not updating');

View File

@ -8,12 +8,8 @@ const { ConstructAvatar, ConstructText } = require('./construct');
const { ConstructAnimation } = require('./animations');
const shapes = require('./shapes');
const SkillBtn = require('./skill.btn');
const actions = require('../actions');
const addState = connect(
function receiveState(state) {
const {

View File

@ -62,7 +62,7 @@ function registerEvents(store) {
const anims = animations.getObjects(r, sequence, game, account);
const text = animations.getText(r, sequence);
store.dispatch(actions.setAnimFocus(animations.getFocusTargets(r)));
store.dispatch(actions.setAnimFocus(animations.getFocusTargets(r, game)));
if (sequence.includes('START_SKILL')) store.dispatch(actions.setAnimSource(anims.animSource));
if (sequence.includes('END_SKILL')) {