Merge branch 'release/1.4.8' of ssh://git.mnml.gg:40022/~/mnml into release/1.4.8

This commit is contained in:
ntr 2019-09-20 16:14:17 +10:00
commit 54c2dc728d
6 changed files with 43 additions and 40 deletions

View File

@ -3,7 +3,7 @@ const range = require('lodash/range');
const reactStringReplace = require('react-string-replace'); const reactStringReplace = require('react-string-replace');
const { INFO } = require('./../constants'); const { INFO } = require('./../constants');
const { convertItem, removeTier, itemSpeed } = require('../utils'); const { convertItem, removeTier } = require('../utils');
const shapes = require('./shapes'); const shapes = require('./shapes');
function InfoComponent(args) { function InfoComponent(args) {
@ -46,10 +46,7 @@ function InfoComponent(args) {
: false; : false;
const itemRegEx = /(Red|Blue|Green)/; const itemRegEx = /(Red|Blue|Green)/;
const itemSourceDescription = reactStringReplace(itemSourceInfo, itemRegEx, match => shapes[match]()); const itemSourceDescription = reactStringReplace(itemSourceInfo, itemRegEx, match => shapes[match]());
const calcSpeed = itemSource.length const speed = <div> Speed {shapes.SpeedStat()} multiplier {fullInfo.speed * 4}% </div>;
? (24 + (itemSpeed(itemSource[0].components[0]) + itemSpeed(itemSource[0].components[1])) * itemSpeed(itemSource[0].components[2])) * 4
: (24 + itemSpeed(info)) * 4;
const speed = <div> Speed {shapes.SpeedStat()} multiplier {calcSpeed}% </div>;
const cooldown = fullInfo.cooldown ? `${fullInfo.cooldown} Turn delay` : null; const cooldown = fullInfo.cooldown ? `${fullInfo.cooldown} Turn delay` : null;
return ( return (
<div class="info-skill"> <div class="info-skill">

View File

@ -91,7 +91,7 @@ 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') if (!sequence.includes('END_SKILL' && anims.animTarget)
|| ['Banish', 'Invert'].includes(removeTier(anims.animTarget.skill))) return cb(); || ['Banish', 'Invert'].includes(removeTier(anims.animTarget.skill))) return cb();
return true; return true;
}, timeout); }, timeout);

View File

@ -187,20 +187,6 @@ const removeTier = skill => {
return skill; return skill;
}; };
function itemSpeed(item) {
switch (item) {
case 'Attack': return 1;
case 'Stun': return 2;
case 'Block': return 3;
case 'Buff': return 4;
case 'Debuff': return 4;
case 'Red': return 3;
case 'Green': return 2;
case 'Blue': return 1;
default: return 0;
}
}
function postData(url = '/', data = {}) { function postData(url = '/', data = {}) {
// Default options are marked with * // Default options are marked with *
return fetch(`/api${url}`, { return fetch(`/api${url}`, {

View File

@ -322,7 +322,7 @@ impl Game {
return Err(err_msg("game not in skill phase")); return Err(err_msg("game not in skill phase"));
} }
let mut game_state = self.clone(); let mut game_state = self.clone();
self.stack.retain(|s| game_state.construct_by_id(s.source_construct_id).unwrap().account == player_id); self.stack.retain(|s| game_state.construct_by_id(s.source_construct_id).unwrap().account != player_id);
return Ok(self); return Ok(self);
} }

View File

@ -337,13 +337,27 @@ impl Item {
} }
} }
pub fn speed(&self) -> u64 { pub fn base_speed(&self) -> u64 {
match self { match self {
Item::Attack => 1, Item::Attack => 1,
Item::Stun => 2, Item::Stun => 2,
Item::Block => 3, Item::Block => 3,
Item::Buff | Item::Buff |
Item::Debuff => 4, Item::Debuff => 4,
Item::Blue => 1,
Item::Green => 2,
Item::Red => 3,
_ => 0,
}
}
pub fn speed(&self) -> u64 {
match self {
Item::Attack |
Item::Stun |
Item::Block |
Item::Buff |
Item::Debuff => 24 + self.base_speed(),
_ => { _ => {
let combos = get_combos(); let combos = get_combos();
let combo = combos.iter().find(|c| c.item == *self) let combo = combos.iter().find(|c| c.item == *self)
@ -355,17 +369,17 @@ impl Item {
combo.components.iter().for_each(|unit| { combo.components.iter().for_each(|unit| {
colour_speed += match unit { colour_speed += match unit {
Item::Red => 3, Item::Red |
Item::Green => 2, Item::Green |
Item::Blue => 1, Item::Blue => unit.base_speed(),
_ => 0, _ => 0,
}; };
skill_speed += match unit { skill_speed += match unit {
Item::Attack => 1, Item::Attack |
Item::Stun => 2, Item::Stun |
Item::Block => 3, Item::Block |
Item::Buff | Item::Buff |
Item::Debuff => 4, Item::Debuff => unit.base_speed(),
_ => 0, _ => 0,
}; };
if colour_speed == 0 && skill_speed == 0 { if colour_speed == 0 && skill_speed == 0 {
@ -1441,6 +1455,7 @@ pub struct ItemInfo {
pub spec: bool, pub spec: bool,
pub values: Option<SpecValues>, pub values: Option<SpecValues>,
pub skill: bool, pub skill: bool,
pub speed: Option<u64>,
pub cooldown: Cooldown, pub cooldown: Cooldown,
pub description: String, pub description: String,
} }
@ -1477,6 +1492,10 @@ pub fn item_info() -> ItemInfoCtr {
}, },
skill: v.into_skill().is_some(), skill: v.into_skill().is_some(),
description: v.into_description(), description: v.into_description(),
speed: match v.into_skill() {
Some(s) => Some(s.speed()),
None => None
},
cooldown: match v.into_skill() { cooldown: match v.into_skill() {
Some(s) => s.base_cd(), Some(s) => s.base_cd(),
None => None None => None

View File

@ -293,7 +293,7 @@ fn post_resolve(_skill: Skill, game: &mut Game, mut resolutions: Resolutions) ->
let mut target = game.construct_by_id(target.id).unwrap().clone(); let mut target = game.construct_by_id(target.id).unwrap().clone();
match event { match event {
Event::Damage { amount, skill, mitigation: _, colour: _ } => { Event::Damage { amount, skill, mitigation: _, colour: c } => {
if target.affected(Effect::Electric) { if target.affected(Effect::Electric) {
let ConstructEffect { effect: _, duration: _, meta, tick: _ } = target.effects.iter() let ConstructEffect { effect: _, duration: _, meta, tick: _ } = target.effects.iter()
.find(|e| e.effect == Effect::Electric).unwrap().clone(); .find(|e| e.effect == Effect::Electric).unwrap().clone();
@ -315,16 +315,17 @@ fn post_resolve(_skill: Skill, game: &mut Game, mut resolutions: Resolutions) ->
_ => panic!("no absorb skill"), _ => panic!("no absorb skill"),
}; };
} }
if c == Colour::Red {
if target.affected(Effect::Counter) { if target.affected(Effect::Counter) {
let ConstructEffect { effect: _, duration: _, meta, tick: _ } = target.effects.iter() let ConstructEffect { effect: _, duration: _, meta, tick: _ } = target.effects.iter()
.find(|e| e.effect == Effect::Counter).unwrap().clone(); .find(|e| e.effect == Effect::Counter).unwrap().clone();
match meta { match meta {
Some(EffectMeta::Skill(s)) => { Some(EffectMeta::Skill(s)) => {
resolutions = counter_attack(&mut target, &mut source, resolutions, s); resolutions = counter_attack(&mut target, &mut source, resolutions, s);
}, },
_ => panic!("no counter skill"), _ => panic!("no counter skill"),
}; };
}
} }
}, },
_ => (), _ => (),