{c.effect} - {c.duration}T
)
:
;
-
- const combatAnim = animations({ game, account, resolution, player, construct });
+ const combatAnim = animations({ game, account, resolution, player, construct, avatarAnimation, setAvatarAnimation });
const combatText = getCombatText(resolution, construct);
return (
;
}
-
- const arrows = resolution
- ? null
- : outgoing.map(getPath);
+ if (resolution === 'clear') return false;
+ if (!resolution) {
+ return (
+
+ );
+ }
let skill = '';
- if (resolution) {
- if (resolution.event[1]) ([, { skill }] = resolution.event);
- }
- const resolutionText = resolution
- ?
{skill}
- : null;
-
+ if (resolution.event[1]) ([, { skill }] = resolution.event);
return (
);
}
diff --git a/client/src/events.jsx b/client/src/events.jsx
index 25d0e76c..ec20bef3 100644
--- a/client/src/events.jsx
+++ b/client/src/events.jsx
@@ -60,15 +60,17 @@ function registerEvents(store) {
// stop fetching the game state til animations are done
ws.clearGameStateTimeout();
const newRes = game.resolved.slice(currentGame.resolved.length);
+ let id = game.resolved.length - currentGame.resolved.length;
return eachSeries(newRes, (r, cb) => {
if (['Disable', 'TargetKo'].includes(r.event[0])) return cb();
// Create sub events for combat animations
const sequence = getCombatSequence(r);
+ id += 1;
return eachSeries(sequence, (stages, sCb) => {
const stagedR = Object.create(r);
stagedR.sequence = sequence;
stagedR.stages = stages;
-
+ stagedR.id = id;
let timeout = 0;
if (stages.includes('START_SKILL') && stages.includes('END_SKILL')) {
timeout = TIMES.SOURCE_AND_TARGET_TOTAL_DURATION;
@@ -80,11 +82,14 @@ function registerEvents(store) {
return setTimeout(sCb, timeout);
}, err => {
if (err) console.error(err);
- // Finished this resolution
- return cb();
+ // Clear the anim classes
+ store.dispatch(actions.setResolution('clear'));
+ // Finished this resolution small delay for reset
+ return setTimeout(cb, 5);
});
}, err => {
if (err) return console.error(err);
+ store.dispatch(actions.setAvatarAnimation({ id: -1 }));
store.dispatch(actions.setResolution(null));
// stop skipping resolutions
store.dispatch(actions.setSkip(false));
diff --git a/client/src/reducers.jsx b/client/src/reducers.jsx
index 2498963b..abd7ad03 100644
--- a/client/src/reducers.jsx
+++ b/client/src/reducers.jsx
@@ -15,6 +15,7 @@ module.exports = {
activeConstruct: createReducer(null, 'SET_ACTIVE_CONSTRUCT'),
activeItem: createReducer(null, 'SET_ACTIVE_VAR'),
activeSkill: createReducer(null, 'SET_ACTIVE_SKILL'),
+ avatarAnimation: createReducer({ id: -1 }, 'SET_AVATAR_ANIMATION'),
combiner: createReducer([null, null, null], 'SET_COMBINER'),
constructs: createReducer([], 'SET_CONSTRUCTS'),
constructDeleteId: createReducer(null, 'SET_CONSTRUCT_DELETE_ID'),
diff --git a/client/src/utils.jsx b/client/src/utils.jsx
index c610f0dd..da74c26d 100644
--- a/client/src/utils.jsx
+++ b/client/src/utils.jsx
@@ -74,7 +74,7 @@ const STATS = {
};
function eventClasses(game, account, resolution, construct) {
- if (!resolution) return '';
+ if (!resolution || resolution === 'clear') return '';
const postSkill = resolution.stages.includes('POST_SKILL');
const source = construct.id === resolution.source.id;
const target = construct.id === resolution.target.id;
@@ -176,7 +176,7 @@ function getCombatSequence(resolution) {
}
function getCombatText(resolution, construct) {
- if (!resolution) return false;
+ if (!resolution || resolution === 'clear') return false;
if (!resolution.stages.includes('POST_SKILL')) return false;
if (construct.id !== resolution.target.id) return false;