events code from anims

This commit is contained in:
ntr 2019-07-05 18:27:16 +10:00
parent bd104b65b2
commit 2fcbd24495
2 changed files with 13 additions and 8 deletions

View File

@ -34,14 +34,14 @@ class Purify extends Component {
this.charges = points.map(coord => projectile(coord[0], coord[1], 12, COLOURS.GREEN));
}
render({ team }) {
render() {
return (
<svg
class='skill-animation green'
version="1.1"
id="purify"
xmlns="http://www.w3.org/2000/svg"
style={{ transform: team ? 'rotate3d(1, 0, 0, 180deg)' : '' }}
style={{ transform: 'rotate3d(1, 0, 0, 180deg)' }}
viewBox="0 0 256 256">
<filter id='purifyFilter'>
<feGaussianBlur stdDeviation="3"/>

View File

@ -50,7 +50,6 @@ function registerEvents(store) {
const { game: currentGame, ws } = store.getState();
if (game) ws.startGameStateTimeout(game.id);
console.log(JSON.stringify(game))
if (game && currentGame) {
if (game.resolved.length !== currentGame.resolved.length) {
// stop fetching the game state til animations are done
@ -60,14 +59,20 @@ function registerEvents(store) {
if (['Disable', 'TargetKo'].includes(r.event[0])) return cb();
// Create sub events for combat animations
const sequence = getCombatSequence(r);
return eachSeries(sequence, (stage, sCb) => {
const { skip } = store.getState();
if (skip) return sCb('skip');
return eachSeries(sequence, (stages, sCb) => {
const stagedR = Object.create(r);
stagedR.stage = stage;
stagedR.sequence = sequence;
stagedR.stages = stages;
let timeout = 0;
if (stages.includes('START_SKILL') && stages.includes('END_SKILL')) {
timeout = TIMES.SOURCE_AND_TARGET_TOTAL_DURATION;
} else if (stages.includes('START_SKILL')) timeout = TIMES.SOURCE_DURATION_MS;
else if (stages.includes('END_SKILL')) timeout = TIMES.TARGET_DURATION_MS;
else if (stages.includes('POST_SKILL')) timeout = TIMES.POST_SKILL_DURATION_MS;
store.dispatch(actions.setResolution(stagedR));
return setTimeout(sCb, TIMES[stage]);
return setTimeout(sCb, timeout);
}, err => {
if (err) console.error(err);
// Finished this resolution