Merge branch 'ko-anims' into develop
This commit is contained in:
commit
a59a13e2e6
@ -1,4 +1,5 @@
|
|||||||
const { TIMES } = require('./constants');
|
const { TIMES } = require('./constants');
|
||||||
|
const { removeTier } = require('./utils');
|
||||||
|
|
||||||
function none() {
|
function none() {
|
||||||
return {
|
return {
|
||||||
@ -75,8 +76,6 @@ function getObjects(resolution, stages, game, account) {
|
|||||||
function getSequence(resolution) {
|
function getSequence(resolution) {
|
||||||
if (!resolution.event) return [];
|
if (!resolution.event) return [];
|
||||||
if (resolution.event[0] === 'Inversion') 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) {
|
switch (resolution.stages) {
|
||||||
case 'AllStages': return ['START_SKILL', 'END_SKILL', 'POST_SKILL'];
|
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 = {
|
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;
|
|
||||||
|
|||||||
@ -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) {
|
||||||
@ -67,8 +67,6 @@ function registerEvents(store) {
|
|||||||
// stop fetching the game state til animations are done
|
// stop fetching the game state til animations are done
|
||||||
const newRes = game.resolved.slice(currentGame.resolved.length);
|
const newRes = game.resolved.slice(currentGame.resolved.length);
|
||||||
return eachSeries(newRes, (r, cb) => {
|
return eachSeries(newRes, (r, cb) => {
|
||||||
if (['Disable', 'TargetKo'].includes(r.event[0])) return cb();
|
|
||||||
|
|
||||||
// convert server enum into anims keywords
|
// convert server enum into anims keywords
|
||||||
// todo make serersideonly
|
// todo make serersideonly
|
||||||
const sequence = animations.getSequence(r);
|
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('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
|
||||||
@ -100,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);
|
||||||
|
|||||||
@ -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';
|
||||||
|
|||||||
@ -16,7 +16,7 @@ pub fn dev_resolve(a_id: Uuid, b_id: Uuid, skill: Skill) -> Resolutions {
|
|||||||
let mut b = Construct::new();
|
let mut b = Construct::new();
|
||||||
b.id = b_id;
|
b.id = b_id;
|
||||||
if skill.aoe() { // Send an aoe skill event for anims
|
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);
|
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
|
if skill.aoe() { // Send an aoe skill event for anims
|
||||||
resolutions.push(Resolution::new(&source,
|
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 {
|
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 {
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ fn post_resolve(_skill: Skill, game: &mut Game, mut resolutions: Resolutions) ->
|
|||||||
};
|
};
|
||||||
|
|
||||||
if target.is_ko() {
|
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();
|
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 {
|
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
|
while let Some(i) = target.effects
|
||||||
.iter()
|
.iter()
|
||||||
.position(|ce| {
|
.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 {
|
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());
|
let amount = source.green_power().pct(skill.multiplier());
|
||||||
while let Some(i) = target.effects
|
while let Some(i) = target.effects
|
||||||
.iter()
|
.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 {
|
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 red_damage = target.red_life().pct(skill.multiplier());
|
||||||
let blue_damage = target.blue_life().pct(skill.multiplier());
|
let blue_damage = target.blue_life().pct(skill.multiplier());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user