Merge branch 'release/1.6.4'
This commit is contained in:
commit
b196053a92
@ -2,8 +2,11 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
## [1.6.3] - 2019-10-23
|
## [1.6.4] - 2019-10-24
|
||||||
|
### Changed
|
||||||
|
- Animations processing on client side reduced.
|
||||||
|
|
||||||
|
## [1.6.3] - 2019-10-23
|
||||||
### Added
|
### Added
|
||||||
- MNNI: the MNML guide
|
- MNNI: the MNML guide
|
||||||
- Delivers the message of the day
|
- Delivers the message of the day
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mnml-client",
|
"name": "mnml-client",
|
||||||
"version": "1.6.3",
|
"version": "1.6.4",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mnml-client",
|
"name": "mnml-client",
|
||||||
"version": "1.6.3",
|
"version": "1.6.4",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
const { TIMES } = require('./constants');
|
const { TIMES } = require('./constants');
|
||||||
|
const { removeTier } = require('./utils');
|
||||||
|
|
||||||
function none() {
|
function none() {
|
||||||
return {
|
return {
|
||||||
@ -7,7 +8,7 @@ function none() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getObjects(resolution, stages, game, account) {
|
function getObjects(resolution, game, account) {
|
||||||
if (!resolution) return none();
|
if (!resolution) return none();
|
||||||
if (!resolution.target) return none();
|
if (!resolution.target) return none();
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ function getObjects(resolution, stages, game, account) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const skipSource = !stages.includes('START_SKILL')
|
const skipSource = !resolution.stages.includes('START_SKILL')
|
||||||
|| resolution.source.id === resolution.target.id;
|
|| resolution.source.id === resolution.target.id;
|
||||||
|
|
||||||
const animSource = skipSource
|
const animSource = skipSource
|
||||||
@ -72,25 +73,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'];
|
|
||||||
case 'StartEnd': return ['START_SKILL', 'END_SKILL'];
|
|
||||||
case 'StartPost': return ['START_SKILL', 'POST_SKILL'];
|
|
||||||
case 'StartOnly': return ['START_SKILL'];
|
|
||||||
case 'EndPost': return ['END_SKILL', 'POST_SKILL'];
|
|
||||||
case 'EndOnly': return ['END_SKILL'];
|
|
||||||
case 'PostOnly': return ['POST_SKILL'];
|
|
||||||
case 'NoStages': return [];
|
|
||||||
default: return ['START_SKILL', 'END_SKILL', 'POST_SKILL'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTime(stages) {
|
function getTime(stages) {
|
||||||
let time = 0;
|
let time = 0;
|
||||||
if (stages.includes('START_SKILL') && stages.includes('END_SKILL')) {
|
if (stages.includes('START_SKILL') && stages.includes('END_SKILL')) {
|
||||||
@ -121,10 +103,10 @@ function getFocusTargets(resolution, game) {
|
|||||||
return [target];
|
return [target];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getText(resolution, sequence) {
|
function getText(resolution) {
|
||||||
const nullText = { text: null, constructId: null, life: null };
|
const nullText = { text: null, constructId: null, life: null };
|
||||||
if (!resolution) return nullText;
|
if (!resolution) return nullText;
|
||||||
if (!sequence.includes('POST_SKILL')) return nullText;
|
if (!resolution.stages.includes('POST_SKILL')) return nullText;
|
||||||
|
|
||||||
function generatePostSkill() {
|
function generatePostSkill() {
|
||||||
const [type, event] = resolution.event;
|
const [type, event] = resolution.event;
|
||||||
@ -202,14 +184,19 @@ 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,
|
|
||||||
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) {
|
||||||
@ -63,27 +63,26 @@ function registerEvents(store) {
|
|||||||
if (game.resolved.length !== currentGame.resolved.length) {
|
if (game.resolved.length !== currentGame.resolved.length) {
|
||||||
store.dispatch(actions.setAnimating(true));
|
store.dispatch(actions.setAnimating(true));
|
||||||
store.dispatch(actions.setGameSkillInfo(null));
|
store.dispatch(actions.setGameSkillInfo(null));
|
||||||
|
|
||||||
// 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();
|
if (!r.event || r.stages === '') return cb;
|
||||||
|
const timeout = animations.getTime(r.stages);
|
||||||
// convert server enum into anims keywords
|
const anims = animations.getObjects(r, game, account);
|
||||||
// todo make serersideonly
|
const text = animations.getText(r);
|
||||||
const sequence = animations.getSequence(r);
|
|
||||||
const timeout = animations.getTime(sequence);
|
|
||||||
const anims = animations.getObjects(r, sequence, game, account);
|
|
||||||
const text = animations.getText(r, sequence);
|
|
||||||
store.dispatch(actions.setAnimFocus(animations.getFocusTargets(r, game)));
|
store.dispatch(actions.setAnimFocus(animations.getFocusTargets(r, game)));
|
||||||
if (anims.animSkill) store.dispatch(actions.setAnimSkill(anims.animSkill));
|
if (anims.animSkill) store.dispatch(actions.setAnimSkill(anims.animSkill));
|
||||||
|
|
||||||
if (sequence.includes('START_SKILL') && anims.animSource) store.dispatch(actions.setAnimSource(anims.animSource));
|
if (r.stages.includes('START_SKILL') && anims.animSource) {
|
||||||
if (sequence.includes('END_SKILL') && anims.animTarget) {
|
store.dispatch(actions.setAnimSource(anims.animSource));
|
||||||
store.dispatch(actions.setAnimTarget(anims.animTarget));
|
|
||||||
if (!['Banish', 'Invert'].includes(removeTier(anims.animTarget.skill))) store.dispatch(actions.setAnimCb(cb));
|
|
||||||
}
|
}
|
||||||
if (sequence.includes('POST_SKILL') && text) {
|
|
||||||
|
if (r.stages.includes('END_SKILL') && anims.animTarget) {
|
||||||
|
store.dispatch(actions.setAnimTarget(anims.animTarget));
|
||||||
|
if (animations.isCbAnim(anims.animSkill)) store.dispatch(actions.setAnimCb(cb));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r.stages.includes('POST_SKILL') && text) {
|
||||||
// timeout to prevent text classes from being added too soon
|
// timeout to prevent text classes from being added too soon
|
||||||
if (timeout === TIMES.POST_SKILL_DURATION_MS) {
|
if (timeout === TIMES.POST_SKILL_DURATION_MS) {
|
||||||
store.dispatch(actions.setAnimText(text));
|
store.dispatch(actions.setAnimText(text));
|
||||||
@ -94,14 +93,15 @@ function registerEvents(store) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return setTimeout(() => {
|
return setTimeout(() => {
|
||||||
store.dispatch(actions.setAnimSkill(null));
|
store.dispatch(actions.setAnimSkill(null));
|
||||||
store.dispatch(actions.setAnimSource(null));
|
store.dispatch(actions.setAnimSource(null));
|
||||||
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 (r.stages.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';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mnml-ops",
|
"name": "mnml-ops",
|
||||||
"version": "1.6.3",
|
"version": "1.6.4",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "mnml"
|
name = "mnml"
|
||||||
version = "1.6.3"
|
version = "1.6.4"
|
||||||
authors = ["ntr <ntr@smokestack.io>"]
|
authors = ["ntr <ntr@smokestack.io>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@ -606,7 +606,7 @@ impl Construct {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
true => {
|
true => {
|
||||||
events.push(Event::Inversion { skill });
|
// events.push(Event::Inversion { skill });
|
||||||
|
|
||||||
// there is no green shield (yet)
|
// there is no green shield (yet)
|
||||||
let current_green_life = self.green_life();
|
let current_green_life = self.green_life();
|
||||||
@ -669,7 +669,7 @@ impl Construct {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
true => {
|
true => {
|
||||||
events.push(Event::Inversion { skill });
|
// events.push(Event::Inversion { skill });
|
||||||
|
|
||||||
let current_green_life = self.green_life();
|
let current_green_life = self.green_life();
|
||||||
self.green_life.increase(modified_power);
|
self.green_life.increase(modified_power);
|
||||||
@ -738,7 +738,7 @@ impl Construct {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
true => {
|
true => {
|
||||||
events.push(Event::Inversion { skill });
|
// events.push(Event::Inversion { skill });
|
||||||
|
|
||||||
let current_green_life = self.green_life();
|
let current_green_life = self.green_life();
|
||||||
self.green_life.increase(modified_power);
|
self.green_life.increase(modified_power);
|
||||||
|
|||||||
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,13 +408,21 @@ pub struct EventConstruct {
|
|||||||
|
|
||||||
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]
|
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]
|
||||||
pub enum EventStages {
|
pub enum EventStages {
|
||||||
|
#[serde(rename = "START_SKILL END_SKILL POST_SKILL")]
|
||||||
AllStages, // Anim Anim Anim
|
AllStages, // Anim Anim Anim
|
||||||
|
#[serde(rename = "START_SKILL END_SKILL")]
|
||||||
StartEnd, // Anim Anim Skip
|
StartEnd, // Anim Anim Skip
|
||||||
|
#[serde(rename = "START_SKILL POST_SKILL")]
|
||||||
StartPost, // Anim Skip Anim
|
StartPost, // Anim Skip Anim
|
||||||
|
#[serde(rename = "START_SKILL")]
|
||||||
StartOnly, // Anim Skip Skip
|
StartOnly, // Anim Skip Skip
|
||||||
|
#[serde(rename = "END_SKILL POST_SKILL")]
|
||||||
EndPost, // Skip Anim Anim
|
EndPost, // Skip Anim Anim
|
||||||
|
#[serde(rename = "END_SKILL")]
|
||||||
EndOnly, // Skip Anim Skip
|
EndOnly, // Skip Anim Skip
|
||||||
|
#[serde(rename = "POST_SKILL")]
|
||||||
PostOnly, // Skip Skip Anim
|
PostOnly, // Skip Skip Anim
|
||||||
|
#[serde(rename = "")]
|
||||||
NoStages, // Skip Skip Skip
|
NoStages, // Skip Skip Skip
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1811,7 +1819,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 +1853,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 +1877,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());
|
||||||
@ -2004,10 +2012,10 @@ mod tests {
|
|||||||
// attack should heal and recharge red shield
|
// attack should heal and recharge red shield
|
||||||
let mut results = attack(&mut x, &mut y, vec![], Skill::Attack);
|
let mut results = attack(&mut x, &mut y, vec![], Skill::Attack);
|
||||||
|
|
||||||
match results.remove(0).event {
|
// match results.remove(0).event {
|
||||||
Event::Inversion { skill } => assert_eq!(skill, Skill::Attack),
|
// Event::Inversion { skill } => assert_eq!(skill, Skill::Attack),
|
||||||
_ => panic!("not inversion"),
|
// _ => panic!("not inversion"),
|
||||||
};
|
//};
|
||||||
|
|
||||||
match results.remove(0).event {
|
match results.remove(0).event {
|
||||||
Event::Healing { skill: _, overhealing: _, amount } => assert!(amount > 0),
|
Event::Healing { skill: _, overhealing: _, amount } => assert!(amount > 0),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user