From 50f2afd657baa752a2f72e85f9deb22e5216b7fd Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 16 Sep 2019 15:26:44 +1000 Subject: [PATCH] strike stuff --- client/assets/styles/styles.less | 2 +- client/src/animations.socket.jsx | 16 ++++++++-------- client/src/components/anims/strike.jsx | 15 +++++++++++---- client/src/test.game.js | 12 ++++++------ 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/client/assets/styles/styles.less b/client/assets/styles/styles.less index 3ca91487..29e06109 100644 --- a/client/assets/styles/styles.less +++ b/client/assets/styles/styles.less @@ -97,7 +97,7 @@ dl { &.animations-test { grid-template-columns: 1fr 9fr 1fr; grid-template-areas: - "hdr hdr ctrl" + "nav hdr ctrl" "nav main ctrl" "nav main ctrl"; diff --git a/client/src/animations.socket.jsx b/client/src/animations.socket.jsx index c1567fa5..edd822c6 100644 --- a/client/src/animations.socket.jsx +++ b/client/src/animations.socket.jsx @@ -6,6 +6,7 @@ const eachSeries = require('async/eachSeries'); const actions = require('./actions'); const { TIMES } = require('./constants'); const animations = require('./animations.utils'); +const { removeTier } = require('./utils'); const SOCKET_URL = process.env.NODE_ENV === 'production' ? 'wss://mnml.gg/api/ws' : 'ws://localhost/api/ws'; @@ -28,6 +29,7 @@ function createSocket(store) { if (animating) return false; store.dispatch(actions.setAnimating(true)); + // stop fetching the game state til animations are done return eachSeries(newRes, (r, cb) => { if (['Disable', 'TargetKo'].includes(r.event[0])) return cb(); @@ -37,15 +39,14 @@ function createSocket(store) { const timeout = animations.getTime(sequence); const anims = animations.getObjects(r, sequence, game, account); const text = animations.getText(r, sequence); + store.dispatch(actions.setAnimFocus(animations.getFocusTargets(r, game))); - store.dispatch(actions.setAnimFocus(animations.getFocusTargets(r))); - - if (sequence.includes('START_SKILL')) store.dispatch(actions.setAnimSource(anims.animSource)); - if (sequence.includes('END_SKILL')) { + if (sequence.includes('START_SKILL') && anims.animSource) store.dispatch(actions.setAnimSource(anims.animSource)); + if (sequence.includes('END_SKILL') && anims.animTarget) { store.dispatch(actions.setAnimTarget(anims.animTarget)); - if (!['Banish', 'Invert'].includes(anims.animTarget.skill)) store.dispatch(actions.setAnimCb(cb)); + if (!['Banish', 'Invert'].includes(removeTier(anims.animTarget.skill))) store.dispatch(actions.setAnimCb(cb)); } - if (sequence.includes('POST_SKILL')) { + if (sequence.includes('POST_SKILL' && text)) { // timeout to prevent text classes from being added too soon setTimeout( () => store.dispatch(actions.setAnimText(text)), @@ -58,7 +59,7 @@ function createSocket(store) { store.dispatch(actions.setAnimText(null)); store.dispatch(actions.setAnimFocus([])); if (!sequence.includes('END_SKILL') - || ['Banish', 'Invert'].includes(anims.animTarget.skill)) return cb(); + || ['Banish', 'Invert'].includes(removeTier(anims.animTarget.skill))) return cb(); return true; }, timeout); }, err => { @@ -70,7 +71,6 @@ function createSocket(store) { store.dispatch(actions.setAnimating(false)); store.dispatch(actions.setSkip(false)); - store.dispatch(actions.setResolution(null)); // set the game state so resolutions don't fire twice store.dispatch(actions.setGame(game)); diff --git a/client/src/components/anims/strike.jsx b/client/src/components/anims/strike.jsx index 066fe1c5..00dbbb18 100644 --- a/client/src/components/anims/strike.jsx +++ b/client/src/components/anims/strike.jsx @@ -20,6 +20,12 @@ class Strike extends Component { } render() { + // const { x, y } = (this.props && this.props.direction) || { x: 0, y: 0 }; + // const angle = (Math.atan(y / x) * (180 / Math.PI)) + 90; + // console.log(x, -y); + // console.log(angle); + // can't get this shit to work + return ( - + ); @@ -43,11 +50,11 @@ class Strike extends Component { this.animations.push(anime({ targets: ['#strike rect'], easing: 'easeOutExpo', - y: [400, 200, 200], + y: [800, 100, 100], x: [200, 0, 200], height: [200, 10, 0], width: [20, 400, 0], - delay: TIMES.TARGET_DELAY_MS, + delay: TIMES.TARGET_DELAY_MS / 2, duration: TIMES.TARGET_DURATION_MS, })); diff --git a/client/src/test.game.js b/client/src/test.game.js index e17cb8e0..6ee80a0b 100644 --- a/client/src/test.game.js +++ b/client/src/test.game.js @@ -35,7 +35,7 @@ function testGame(uuid) { "constructs": [ { "id": "82e8b940-411c-42a1-8fc2-484ec7207734", - "img": "8446736d-d682-4588-b8a0-5b7ba53bdb55", + "img": "b1be1dfe-f8b5-4467-8406-11f22ffb9e95", "account": "8552e0bf-340d-4fc8-b6fc-3d56b68fe2a1", "red_damage": { "base": 256, @@ -109,7 +109,7 @@ function testGame(uuid) { }, { "id": "96ca4a0e-fed2-4ea2-9ec5-ae308f8dde4b", - "img": "8446736d-d682-4588-b8a0-5b7ba53bdb55", + "img": "b1be1dfe-f8b5-4467-8406-11f22ffb9e95", "account": "8552e0bf-340d-4fc8-b6fc-3d56b68fe2a1", "red_damage": { "base": 256, @@ -186,7 +186,7 @@ function testGame(uuid) { { "id": "ea302c35-d326-475c-a867-8ad5b162165a", "account": "8552e0bf-340d-4fc8-b6fc-3d56b68fe2a1", - "img": "8446736d-d682-4588-b8a0-5b7ba53bdb55", + "img": "b1be1dfe-f8b5-4467-8406-11f22ffb9e95", "red_damage": { "base": 256, "value": Math.floor(Math.random() * 10000), @@ -302,7 +302,7 @@ function testGame(uuid) { { "id": "3aa0f284-1e1b-4054-b38a-b2d50db471bd", "account": uuid, - "img": "8446736d-d682-4588-b8a0-5b7ba53bdb55", + "img": "b1be1dfe-f8b5-4467-8406-11f22ffb9e95", "red_damage": { "base": 256, "value": Math.floor(Math.random() * 10000), @@ -389,7 +389,7 @@ function testGame(uuid) { { "id": "50e5d94e-8ebe-495c-a916-3eb509ff4683", "account": uuid, - "img": "8446736d-d682-4588-b8a0-5b7ba53bdb55", + "img": "b1be1dfe-f8b5-4467-8406-11f22ffb9e95", "red_damage": { "base": 256, "value": Math.floor(Math.random() * 10000), @@ -470,7 +470,7 @@ function testGame(uuid) { { "id": "5d49fe65-27f0-4372-90a3-334ef906a0f5", "account": uuid, - "img": "8446736d-d682-4588-b8a0-5b7ba53bdb55", + "img": "b1be1dfe-f8b5-4467-8406-11f22ffb9e95", "red_damage": { "base": 256, "value": Math.floor(Math.random() * 10000),