Merge branch 'ko-anims' into develop

This commit is contained in:
Mashy 2019-10-23 16:04:21 +10:00
commit a59a13e2e6
4 changed files with 25 additions and 21 deletions

View File

@ -1,4 +1,5 @@
const { TIMES } = require('./constants');
const { removeTier } = require('./utils');
function none() {
return {
@ -75,8 +76,6 @@ function getObjects(resolution, stages, game, account) {
function getSequence(resolution) {
if (!resolution.event) return [];
if (resolution.event[0] === 'Inversion') return [];
if (['TargetKo', 'Ko'].includes(resolution.event[0])) return [];
if (['Skill', 'AoeSkill'].includes(resolution.event[0])) return ['START_SKILL', 'END_SKILL'];
switch (resolution.stages) {
case 'AllStages': return ['START_SKILL', 'END_SKILL', 'POST_SKILL'];
@ -202,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 = {
getFocusTargets,
getObjects,
getTime,
getSequence,
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 { TIMES } = require('./constants');
const animations = require('./animations.utils');
const { infoToast, errorToast, removeTier } = require('./utils');
const { infoToast, errorToast } = require('./utils');
function registerEvents(store) {
function notify(msg) {
@ -67,8 +67,6 @@ function registerEvents(store) {
// stop fetching the game state til animations are done
const newRes = game.resolved.slice(currentGame.resolved.length);
return eachSeries(newRes, (r, cb) => {
if (['Disable', 'TargetKo'].includes(r.event[0])) return cb();
// convert server enum into anims keywords
// todo make serersideonly
const sequence = animations.getSequence(r);
@ -81,7 +79,7 @@ function registerEvents(store) {
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(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) {
// timeout to prevent text classes from being added too soon
@ -100,8 +98,8 @@ function registerEvents(store) {
store.dispatch(actions.setAnimTarget(null));
store.dispatch(actions.setAnimText(null));
store.dispatch(actions.setAnimFocus([]));
if (!sequence.includes('END_SKILL') || (anims.animSkill && ['Banish', 'Invert'].includes(anims.animSkill))) return cb();
return true;
if (sequence.includes('END_SKILL') && animations.isCbAnim(anims.animSkill)) return true;
return cb();
}, timeout);
}, err => {
if (err) return console.error(err);

View File

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

View File

@ -16,7 +16,7 @@ pub fn dev_resolve(a_id: Uuid, b_id: Uuid, skill: Skill) -> Resolutions {
let mut b = Construct::new();
b.id = b_id;
if skill.aoe() { // Send an aoe skill event for anims
resolutions.push(Resolution::new(&a, &b).event(Event::AoeSkill { skill }));
resolutions.push(Resolution::new(&a, &b).event(Event::AoeSkill { skill }).stages(EventStages::StartEnd));
}
return resolve(skill, &mut a, &mut b, resolutions);
}
@ -36,7 +36,7 @@ pub fn pre_resolve(cast: &Cast, game: &mut Game, mut resolutions: Resolutions) -
if skill.aoe() { // Send an aoe skill event for anims
resolutions.push(Resolution::new(&source,
&game.construct_by_id(cast.target_construct_id).unwrap().clone()).event(Event::AoeSkill { skill }));
&game.construct_by_id(cast.target_construct_id).unwrap().clone()).event(Event::AoeSkill { skill }).stages(EventStages::StartEnd));
}
for target_id in targets {
@ -68,13 +68,13 @@ 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 {
if let Some(disable) = source.disabled(skill) {
resolutions.push(Resolution::new(source, target).event(Event::Disable { disable, skill }));
if let Some(_disable) = source.disabled(skill) {
// resolutions.push(Resolution::new(source, target).event(Event::Disable { disable, skill }).stages(EventStages::PostOnly));
return resolutions;
}
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;
}
@ -342,7 +342,7 @@ fn post_resolve(_skill: Skill, game: &mut Game, mut resolutions: Resolutions) ->
};
if target.is_ko() {
resolutions.push(Resolution::new(&source, &target).event(Event::Ko()));
resolutions.push(Resolution::new(&source, &target).event(Event::Ko()).stages(EventStages::PostOnly));
target.effects.clear();
}
@ -1811,7 +1811,7 @@ fn silence(source: &mut Construct, target: &mut Construct, mut results: Resoluti
}
fn purge(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions {
results.push(Resolution::new(source, target).event(Event::Skill { skill }));
results.push(Resolution::new(source, target).event(Event::Skill { skill }).stages(EventStages::StartEnd));
while let Some(i) = target.effects
.iter()
.position(|ce| {
@ -1845,7 +1845,7 @@ fn purge(source: &mut Construct, target: &mut Construct, mut results: Resolution
}
fn purify(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions {
results.push(Resolution::new(source, target).event(Event::Skill { skill }));
results.push(Resolution::new(source, target).event(Event::Skill { skill }).stages(EventStages::StartEnd));
let amount = source.green_power().pct(skill.multiplier());
while let Some(i) = target.effects
.iter()
@ -1869,7 +1869,7 @@ fn purify(source: &mut Construct, target: &mut Construct, mut results: Resolutio
}
fn banish(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions {
results.push(Resolution::new(source, target).event(Event::Skill { skill }));
results.push(Resolution::new(source, target).event(Event::Skill { skill }).stages(EventStages::StartEnd));
let red_damage = target.red_life().pct(skill.multiplier());
let blue_damage = target.blue_life().pct(skill.multiplier());