From 70711fd37b34b26001093915b349c5ecba6ea19a Mon Sep 17 00:00:00 2001 From: Mashy Date: Thu, 5 Dec 2019 23:10:26 +1000 Subject: [PATCH] cleanup --- client/src/animations.utils.jsx | 15 --------------- client/src/events.jsx | 4 +--- core/src/skill.rs | 5 ++++- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/client/src/animations.utils.jsx b/client/src/animations.utils.jsx index 8d961676..b0b5d27f 100644 --- a/client/src/animations.utils.jsx +++ b/client/src/animations.utils.jsx @@ -1,4 +1,3 @@ -const { TIMES } = require('./constants'); const { removeTier } = require('./utils'); function none() { @@ -61,19 +60,6 @@ function getObjects(resolution, game, account) { }; } -function getTime(stages) { - let time = 0; - if (stages.includes('START_SKILL') && stages.includes('END_SKILL')) { - time += TIMES.SOURCE_AND_TARGET_TOTAL_DURATION; - } else { - if (stages.includes('START_SKILL')) time += TIMES.SOURCE_DURATION_MS; - if (stages.includes('END_SKILL')) time += TIMES.TARGET_DURATION_MS; - } - if (stages.includes('POST_SKILL')) time += TIMES.POST_SKILL_DURATION_MS; - - return time; -} - function getFocusTargets(resolution) { const [type, event] = resolution.variant; if (type === 'HitCast') { @@ -178,7 +164,6 @@ function isCbAnim(skill) { module.exports = { getFocusTargets, getObjects, - getTime, getText, isCbAnim, }; diff --git a/client/src/events.jsx b/client/src/events.jsx index 54a0bd11..9931b283 100644 --- a/client/src/events.jsx +++ b/client/src/events.jsx @@ -5,7 +5,6 @@ const eachSeries = require('async/eachSeries'); const sample = require('lodash/sample'); const actions = require('./actions'); -const { TIMES } = require('./constants'); const animations = require('./animations.utils'); const { infoToast, errorToast } = require('./utils'); const { tutorialVbox } = require('./tutorial.utils'); @@ -89,11 +88,9 @@ function registerEvents(store) { // stop fetching the game state til animations are done const newRes = game.events[currentGame.events.length - 1]; return eachSeries(newRes, (r, cb) => { - // if (!r.event) return cb(); const timeout = r.delay; const anims = animations.getObjects(r, game, account); - if (r.variant[0].includes('Hit')) { if (r.variant[0] === 'HitCast') { store.dispatch(actions.setAnimSource(anims.animSource)); @@ -111,6 +108,7 @@ function registerEvents(store) { return cb(); }, timeout); } + const text = animations.getText(r); store.dispatch(actions.setAnimText(text)); return setTimeout(cb, timeout); diff --git a/core/src/skill.rs b/core/src/skill.rs index 251f08d3..a2e008d3 100644 --- a/core/src/skill.rs +++ b/core/src/skill.rs @@ -105,7 +105,10 @@ impl Cast { } pub fn actions(&self) -> Vec { - let mut actions = vec![Action::HitCast { construct: self.target, skill: self.skill, source: self.source }]; + let mut actions = match self.skill.is_tick() { + false => vec![Action::HitCast { construct: self.target, skill: self.skill, source: self.source }], + true => vec![Action::Hit { construct: self.target, skill: self.skill }] + }; let mut rest = match self.skill { Skill::Amplify => vec![