fix animCb logic from stalling

This commit is contained in:
Mashy 2019-10-23 15:49:46 +10:00
parent b120fdc08e
commit 14cb075161
4 changed files with 18 additions and 10 deletions

View File

@ -1,4 +1,5 @@
const { TIMES } = require('./constants'); const { TIMES } = require('./constants');
const { removeTier } = require('./utils');
function none() { function none() {
return { return {
@ -200,14 +201,20 @@ function getText(resolution, sequence) {
}; };
} }
function isCbAnim(skill) {
return ['Attack', 'Blast', 'Siphon', 'SiphonTick', 'Strike', 'Chaos', 'Slay', 'Heal',
'Buff', 'Amplify', 'Haste', 'Triage', 'TriageTick', 'Link', 'Hybrid', 'Intercept',
'Debuff', 'Curse', 'Decay', 'DecayTick', 'Purge', 'Silence', 'Restrict',
'Stun', 'Bash', 'Absorb', 'Sleep', 'Break', 'Ruin',
'Block', 'Sustain', 'Electrify', 'Electrocute', 'ElectrocuteTick',
'Counter', 'CounterAttack', 'Purify', 'Recharge', 'Reflect'].includes(removeTier(skill));
}
module.exports = { module.exports = {
getFocusTargets, getFocusTargets,
getObjects, getObjects,
getTime, getTime,
getSequence, getSequence,
getText, getText,
isCbAnim,
}; };
// if (!(resolution.target.id === construct.id)
// && !(resolution.event[0] === 'AoeSkill' && targetTeam.includes(construct.id))) return false;

View File

@ -7,7 +7,7 @@ const sample = require('lodash/sample');
const actions = require('./actions'); const actions = require('./actions');
const { TIMES } = require('./constants'); const { TIMES } = require('./constants');
const animations = require('./animations.utils'); const animations = require('./animations.utils');
const { infoToast, errorToast, removeTier } = require('./utils'); const { infoToast, errorToast } = require('./utils');
function registerEvents(store) { function registerEvents(store) {
function notify(msg) { function notify(msg) {
@ -79,7 +79,7 @@ function registerEvents(store) {
if (sequence.includes('START_SKILL') && anims.animSource) store.dispatch(actions.setAnimSource(anims.animSource)); if (sequence.includes('START_SKILL') && anims.animSource) store.dispatch(actions.setAnimSource(anims.animSource));
if (sequence.includes('END_SKILL') && anims.animTarget) { if (sequence.includes('END_SKILL') && anims.animTarget) {
store.dispatch(actions.setAnimTarget(anims.animTarget)); store.dispatch(actions.setAnimTarget(anims.animTarget));
if (!['Banish', 'Invert'].includes(removeTier(anims.animTarget.skill))) store.dispatch(actions.setAnimCb(cb)); if (animations.isCbAnim(anims.animSkill)) store.dispatch(actions.setAnimCb(cb));
} }
if (sequence.includes('POST_SKILL') && text) { if (sequence.includes('POST_SKILL') && text) {
// timeout to prevent text classes from being added too soon // timeout to prevent text classes from being added too soon
@ -98,8 +98,8 @@ function registerEvents(store) {
store.dispatch(actions.setAnimTarget(null)); store.dispatch(actions.setAnimTarget(null));
store.dispatch(actions.setAnimText(null)); store.dispatch(actions.setAnimText(null));
store.dispatch(actions.setAnimFocus([])); store.dispatch(actions.setAnimFocus([]));
if (!sequence.includes('END_SKILL') || (anims.animSkill && ['Banish', 'Invert'].includes(anims.animSkill))) return cb(); if (sequence.includes('END_SKILL') && animations.isCbAnim(anims.animSkill)) return true;
return true; return cb();
}, timeout); }, timeout);
}, err => { }, err => {
if (err) return console.error(err); if (err) return console.error(err);

View File

@ -142,6 +142,7 @@ function randomPoints(numPoints, radius, dimensions) {
} }
const removeTier = skill => { const removeTier = skill => {
if (!skill) return skill;
if (skill.includes('SiphonTick')) return 'SiphonTick'; if (skill.includes('SiphonTick')) return 'SiphonTick';
if (skill.includes('TriageTick')) return 'TriageTick'; if (skill.includes('TriageTick')) return 'TriageTick';
if (skill.includes('DecayTick')) return 'DecayTick'; if (skill.includes('DecayTick')) return 'DecayTick';

View File

@ -69,12 +69,12 @@ pub fn pre_resolve(cast: &Cast, game: &mut Game, mut resolutions: Resolutions) -
pub fn resolve(skill: Skill, source: &mut Construct, target: &mut Construct, mut resolutions: Vec<Resolution>) -> Resolutions { pub fn resolve(skill: Skill, source: &mut Construct, target: &mut Construct, mut resolutions: Vec<Resolution>) -> Resolutions {
if let Some(disable) = source.disabled(skill) { if let Some(disable) = source.disabled(skill) {
resolutions.push(Resolution::new(source, target).event(Event::Disable { disable, skill })); resolutions.push(Resolution::new(source, target).event(Event::Disable { disable, skill }).stages(EventStages::PostOnly));
return resolutions; return resolutions;
} }
if target.is_ko() { if target.is_ko() {
resolutions.push(Resolution::new(source, target).event(Event::TargetKo { skill })); resolutions.push(Resolution::new(source, target).event(Event::TargetKo { skill }).stages(EventStages::PostOnly));
return resolutions; return resolutions;
} }