scatter -> link

This commit is contained in:
ntr 2019-07-05 15:44:31 +10:00
parent 723201b74c
commit df00a7e00a
12 changed files with 75 additions and 152 deletions

View File

@ -37,7 +37,7 @@ var / skill info rpc
## [0.1.2] - 2019-05-07
### Added
New skill `Scatter `
New skill `Link `
Combines - Buff + BB
Links targets together so dmg taken is split
Recharge 140% source blue damage as blue life to target

View File

@ -68,7 +68,7 @@
mobile info page
rework scatter
rework link
absorb maybe
reconnect based on time delta

View File

@ -103,7 +103,7 @@ const SKILLS = [
'ReflectI',
'RestrictI',
'RuinI',
'ScatterI',
'LinkI',
'SilenceI',
'SiphonI',
'SiphonTickI',

View File

@ -27,7 +27,7 @@ const Purify = require('./anims/purify');
const Recharge = require('./anims/recharge');
const Refl = require('./anims/reflect');
const Restrict = require('./anims/restrict');
const Scatter = require('./anims/scatter');
const Link = require('./anims/link');
const Siphon = require('./anims/siphon');
const SiphonTick = require('./anims/siphon.tick');
const Slay = require('./anims/slay');
@ -123,7 +123,7 @@ function animations(props) {
case 'Haste': return <Haste />;
case 'Triage': return <Triage />;
case 'TriageTick': return <TriageTick />;
case 'Scatter': return <Scatter player={player} />;
case 'Link': return <Link player={player} />;
case 'Hybrid': return <Hybrid />;
case 'Intercept': return <Intercept player={player} />;

View File

@ -1,77 +0,0 @@
const preact = require('preact');
const { Component } = require('preact');
const anime = require('animejs').default;
const { TIMES } = require('../../constants');
class Scatter extends Component {
constructor() {
super();
this.animations = [];
}
render() {
return (
<svg
class='skill-animation blue'
version="1.1"
id="scatter"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 128 128">
<defs>
<filter id="scatterFilter">
<feGaussianBlur in="SourceGraphic" stdDeviation="5" />
<feMerge>
<feMergeNode />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
</defs>
<g class='blue' filter='url(#scatterFilter)' stroke-width="4px" stroke-linecap="round" >
<path d= "
M 4 4
h 30
q 30 0 30 30
q 0 30 30 30
h 30
q 0 -30 -30 -30
h -60
q -30 0 -30 -30
"/>
</g>
</svg>
);
}
componentDidMount() {
this.animations.push(anime({
targets: ['#scatter'],
opacity: [
{ value: 1, delay: TIMES.TARGET_DELAY_MS, duration: 1000 },
// { value: 0, delay: TIMES.TARGET_DURATION_MS * 0.6, duration: TIMES.TARGET_DURATION_MS * 0.2 },
],
easing: 'easeInOutSine',
}));
anime({
targets: ['#scatter path'],
strokeDashoffset: [anime.setDashoffset, 0],
duration: TIMES.TARGET_DURATION_MS * 0.8,
delay: TIMES.TARGET_DELAY_MS,
easing: 'easeInOutSine',
});
}
// this is necessary because
// skipping / timing / unmounting race conditions
// can cause the animations to cut short, this will ensure the values are reset
// because preact will recycle all these components
componentWillUnmount() {
for (let i = this.animations.length - 1; i >= 0; i--) {
this.animations[i].reset();
}
}
}
module.exports = Scatter;

View File

@ -1823,7 +1823,7 @@ function testInstance(uuid) {
"cd": null
},
{
"skill": "Scatter",
"skill": "Link",
"self_targeting": false,
"cd": 2
},
@ -4300,7 +4300,7 @@ function testInstance(uuid) {
"cd": null
},
{
"skill": "Scatter",
"skill": "Link",
"self_targeting": false,
"cd": 2
}

View File

@ -353,7 +353,7 @@ const removeTier = skill => {
if (skill.includes('Intercept')) return 'Intercept';
if (skill.includes('Triage')) return 'Triage';
if (skill.includes('Scatter')) return 'Scatter';
if (skill.includes('Link')) return 'Link';
if (skill.includes('Haste')) return 'Haste';
if (skill.includes('Hybrid')) return 'Hybrid';
if (skill.includes('Amplify')) return 'Amplify';

View File

@ -69,7 +69,7 @@ pub enum EffectMeta {
Skill(Skill),
TickAmount(u64),
AddedDamage(u64),
ScatterTarget(Uuid),
LinkTarget(Uuid),
Multiplier(u64),
}

View File

@ -38,7 +38,7 @@ pub enum Effect {
Absorption,
// magic immunity
Scatter,
Link,
// effects over time
Triage,
@ -125,7 +125,7 @@ impl Effect {
Effect::Haste => vec![Stat::Speed],
Effect::Slow => vec![Stat::Speed],
Effect::Scatter => vec![Stat::BlueDamageTaken, Stat::GreenDamageTaken, Stat::RedDamageTaken],
Effect::Link => vec![Stat::BlueDamageTaken, Stat::GreenDamageTaken, Stat::RedDamageTaken],
_ => vec![],
}
@ -146,7 +146,7 @@ impl Effect {
_ => 100,
}),
Effect::Scatter => value >> 1,
Effect::Link => value >> 1,
Effect::Absorption => value + match meta {
Some(EffectMeta::AddedDamage(d)) => d,
@ -194,7 +194,7 @@ impl Effect {
// magic
Effect::Hybrid => Some(Colour::Green),
Effect::Scatter => Some(Colour::Green),
Effect::Link => Some(Colour::Green),
Effect::Invert => Some(Colour::Green),
// effects over time

View File

@ -1138,7 +1138,7 @@ mod tests {
}
#[test]
fn scatter_test() {
fn link_test() {
let mut game = create_test_game();
let x_player = game.players[0].clone();
@ -1147,32 +1147,32 @@ mod tests {
let x_construct = x_player.constructs[0].clone();
let y_construct = y_player.constructs[0].clone();
game.construct_by_id(x_construct.id).unwrap().learn_mut(Skill::ScatterI);
game.construct_by_id(x_construct.id).unwrap().learn_mut(Skill::LinkI);
while game.construct_by_id(x_construct.id).unwrap().skill_on_cd(Skill::ScatterI).is_some() {
while game.construct_by_id(x_construct.id).unwrap().skill_on_cd(Skill::LinkI).is_some() {
game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns();
}
// apply buff
game.add_skill(x_player.id, x_construct.id, Some(y_construct.id), Skill::ScatterI).unwrap();
game.add_skill(x_player.id, x_construct.id, Some(y_construct.id), Skill::LinkI).unwrap();
game.player_ready(x_player.id).unwrap();
game.player_ready(y_player.id).unwrap();
game = game.resolve_phase_start();
assert!(game.construct_by_id(x_construct.id).unwrap().affected(Effect::Scatter));
assert!(game.construct_by_id(x_construct.id).unwrap().affected(Effect::Link));
let Resolution { source: _, target: _, event, stages: _ } = game.resolved.pop().unwrap();
match event {
Event::Effect { effect, skill: _, duration: _, construct_effects: _ } => assert_eq!(effect, Effect::Scatter),
Event::Effect { effect, skill: _, duration: _, construct_effects: _ } => assert_eq!(effect, Effect::Link),
_ => panic!("not siphon"),
};
let Resolution { source: _, target: _, event, stages: _ } = game.resolved.pop().unwrap();
match event {
Event::Recharge { red: _, blue: _, skill: _ } => (),
_ => panic!("scatter result was not recharge"),
_ => panic!("link result was not recharge"),
}
// attack and receive scatter hit
// attack and receive link hit
game.add_skill(y_player.id, y_construct.id, Some(x_construct.id), Skill::Attack).unwrap();
game.player_ready(x_player.id).unwrap();
game.player_ready(y_player.id).unwrap();
@ -1183,7 +1183,7 @@ mod tests {
match event {
Event::Damage { amount, skill: _, mitigation: _, colour: _} =>
assert_eq!(amount, 256.pct(Skill::Attack.multiplier()) >> 1),
_ => panic!("not damage scatter"),
_ => panic!("not damage link"),
};
}

View File

@ -148,9 +148,9 @@ pub enum Item {
RuinI,
RuinII,
RuinIII,
ScatterI,
ScatterII,
ScatterIII,
LinkI,
LinkII,
LinkIII,
SilenceI,
SilenceII,
SilenceIII,
@ -362,9 +362,9 @@ impl Item {
Item::RuinI => Some(Skill::RuinI),
Item::RuinII => Some(Skill::RuinII),
Item::RuinIII => Some(Skill::RuinIII),
Item::ScatterI => Some(Skill::ScatterI),
Item::ScatterII => Some(Skill::ScatterII),
Item::ScatterIII => Some(Skill::ScatterIII),
Item::LinkI => Some(Skill::LinkI),
Item::LinkII => Some(Skill::LinkII),
Item::LinkIII => Some(Skill::LinkIII),
Item::SilenceI => Some(Skill::SilenceI),
Item::SilenceII => Some(Skill::SilenceII),
Item::SilenceIII => Some(Skill::SilenceIII),
@ -702,9 +702,9 @@ impl Item {
"Team wide Stun for {:?}T. Stunned constructs are unable to cast skills.",
self.into_skill().unwrap().effect()[0].get_duration()),
Item::ScatterI |
Item::ScatterII |
Item::ScatterIII => format!(
Item::LinkI |
Item::LinkII |
Item::LinkIII => format!(
"Caster links with target. Linked constructs split incoming Damage evenly. Recharges target Blue Life {:?}% of BluePower",
self.into_skill().unwrap().multiplier()),
@ -790,9 +790,9 @@ impl Item {
Item::TriageI => vec![Item::Buff, Item::Green, Item::Green],
Item::TriageII => vec![Item::TriageI, Item::TriageI, Item::TriageI],
Item::TriageIII => vec![Item::TriageII, Item::TriageII, Item::TriageII],
Item::ScatterI => vec![Item::Buff, Item::Blue, Item::Blue],
Item::ScatterII => vec![Item::ScatterI, Item::ScatterI, Item::ScatterI],
Item::ScatterIII => vec![Item::ScatterIII, Item::ScatterIII, Item::ScatterIII],
Item::LinkI => vec![Item::Buff, Item::Blue, Item::Blue],
Item::LinkII => vec![Item::LinkI, Item::LinkI, Item::LinkI],
Item::LinkIII => vec![Item::LinkIII, Item::LinkIII, Item::LinkIII],
Item::HasteI => vec![Item::Buff, Item::Red, Item::Green],
Item::HasteII => vec![Item::HasteI, Item::HasteI, Item::HasteI],
Item::HasteIII => vec![Item::HasteII, Item::HasteII, Item::HasteII],
@ -1018,9 +1018,9 @@ impl From<Skill> for Item {
Skill::RuinI => Item::RuinI,
Skill::RuinII => Item::RuinII,
Skill::RuinIII => Item::RuinIII,
Skill::ScatterI => Item::ScatterI,
Skill::ScatterII => Item::ScatterII,
Skill::ScatterIII => Item::ScatterIII,
Skill::LinkI => Item::LinkI,
Skill::LinkII => Item::LinkII,
Skill::LinkIII => Item::LinkIII,
Skill::SilenceI => Item::SilenceI,
Skill::SilenceII => Item::SilenceII,
Skill::SilenceIII => Item::SilenceIII,
@ -1162,9 +1162,9 @@ pub fn get_combos() -> Vec<Combo> {
Combo { components: Item::TriageII.combo(), item: Item::TriageII },
Combo { components: Item::TriageIII.combo(), item: Item::TriageIII },
Combo { components: Item::ScatterI.combo(), item: Item::ScatterI },
Combo { components: Item::ScatterII.combo(), item: Item::ScatterII },
Combo { components: Item::ScatterIII.combo(), item: Item::ScatterIII },
Combo { components: Item::LinkI.combo(), item: Item::LinkI },
Combo { components: Item::LinkII.combo(), item: Item::LinkII },
Combo { components: Item::LinkIII.combo(), item: Item::LinkIII },
Combo { components: Item::HasteI.combo(), item: Item::HasteI },
Combo { components: Item::HasteII.combo(), item: Item::HasteII },

View File

@ -212,9 +212,9 @@ pub fn resolve(skill: Skill, source: &mut Construct, target: &mut Construct, mut
Skill::RuinII |
Skill::RuinIII => ruin(source, target, resolutions, skill),
Skill::ScatterI |
Skill::ScatterII |
Skill::ScatterIII => scatter(source, target, resolutions, skill), // target is immune to magic damage and fx
Skill::LinkI |
Skill::LinkII |
Skill::LinkIII => link(source, target, resolutions, skill), // target is immune to magic damage and fx
Skill::SilenceI |
Skill::SilenceII |
@ -315,10 +315,10 @@ fn post_resolve(_skill: Skill, game: &mut Game, mut resolutions: Resolutions) ->
};
}
// beware that scatter doesn't cause any damage
// beware that link doesn't cause any damage
// because then applying it will proc this
if target.affected(Effect::Scatter) {
resolutions = scatter_hit(&source, &target, resolutions, game, event)
if target.affected(Effect::Link) {
resolutions = link_hit(&source, &target, resolutions, game, event)
}
},
@ -587,9 +587,9 @@ pub enum Skill {
RuinII,
RuinIII,
ScatterI,
ScatterII,
ScatterIII,
LinkI,
LinkII,
LinkIII,
SilenceI,
SilenceII,
@ -711,9 +711,9 @@ impl Skill {
// Buff base
Skill::HybridBlast => 25,
Skill::HasteStrike => 30,
Skill::ScatterI => 140,
Skill::ScatterII => 200,
Skill::ScatterIII => 300,
Skill::LinkI => 140,
Skill::LinkII => 200,
Skill::LinkIII => 300,
Skill::InterceptI => 80,
Skill::InterceptII => 110,
Skill::InterceptIII => 150,
@ -838,9 +838,9 @@ impl Skill {
Skill::PurgeII => vec![ConstructEffect {effect: Effect::Purge, duration: 2, meta: None, tick: None}],
Skill::PurgeIII => vec![ConstructEffect {effect: Effect::Purge, duration: 3, meta: None, tick: None}],
Skill::ScatterI => vec![ConstructEffect {effect: Effect::Scatter, duration: 2, meta: None, tick: None}],
Skill::ScatterII => vec![ConstructEffect {effect: Effect::Scatter, duration: 3, meta: None, tick: None}],
Skill::ScatterIII => vec![ConstructEffect {effect: Effect::Scatter, duration: 4, meta: None, tick: None}],
Skill::LinkI => vec![ConstructEffect {effect: Effect::Link, duration: 2, meta: None, tick: None}],
Skill::LinkII => vec![ConstructEffect {effect: Effect::Link, duration: 3, meta: None, tick: None}],
Skill::LinkIII => vec![ConstructEffect {effect: Effect::Link, duration: 4, meta: None, tick: None}],
Skill::SilenceI => vec![ConstructEffect {effect: Effect::Silence, duration: 2, meta: None, tick: None}],
Skill::SilenceII => vec![ConstructEffect {effect: Effect::Silence, duration: 3, meta: None, tick: None}],
@ -949,9 +949,9 @@ impl Skill {
Skill::CurseII => Some(1),
Skill::CurseIII => Some(1),
Skill::ScatterI => Some(2),
Skill::ScatterII => Some(2),
Skill::ScatterIII => Some(2),
Skill::LinkI => Some(2),
Skill::LinkII => Some(2),
Skill::LinkIII => Some(2),
Skill::SilenceI => Some(3),
Skill::SilenceII => Some(2),
@ -1171,9 +1171,9 @@ impl Skill {
Skill::ReflectI |
Skill::ReflectII |
Skill::ReflectIII |
Skill::ScatterI |
Skill::ScatterII |
Skill::ScatterIII |
Skill::LinkI |
Skill::LinkII |
Skill::LinkIII |
Skill::TriageI |
Skill::TriageII |
Skill::TriageIII => true,
@ -1593,40 +1593,40 @@ fn siphon_tick(source: &mut Construct, target: &mut Construct, mut results: Reso
return results;
}
fn scatter(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions {
fn link(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions {
let blue_amount = source.blue_power().pct(skill.multiplier());
results.push(Resolution::new(source, target).event(target.recharge(skill, 0, blue_amount)));
let scatter = skill.effect()[0].set_meta(EffectMeta::ScatterTarget(target.id));
results.push(Resolution::new(source, target).event(source.add_effect(skill, scatter)).stages(LogStages::PostOnly));
let link = skill.effect()[0].set_meta(EffectMeta::LinkTarget(target.id));
results.push(Resolution::new(source, target).event(source.add_effect(skill, link)).stages(LogStages::PostOnly));
return results;
}
fn scatter_hit(source: &Construct, target: &Construct, mut results: Resolutions, game: &mut Game, event: Event) -> Resolutions {
fn link_hit(source: &Construct, target: &Construct, mut results: Resolutions, game: &mut Game, event: Event) -> Resolutions {
match event {
Event::Damage { amount, skill, mitigation: _, colour } => {
let scatter = target.effects.iter().find(|e| e.effect == Effect::Scatter).unwrap();
let link = target.effects.iter().find(|e| e.effect == Effect::Link).unwrap();
if let Some(EffectMeta::ScatterTarget(scatter_target_id)) = scatter.meta {
let mut scatter_target = game.construct_by_id(scatter_target_id).unwrap();
if let Some(EffectMeta::LinkTarget(link_target_id)) = link.meta {
let mut link_target = game.construct_by_id(link_target_id).unwrap();
let res = match colour {
Colour::Red => scatter_target.deal_red_damage(skill, amount),
Colour::Blue => scatter_target.deal_blue_damage(skill, amount),
Colour::Green => scatter_target.deal_green_damage(skill, amount),
Colour::Red => link_target.deal_red_damage(skill, amount),
Colour::Blue => link_target.deal_blue_damage(skill, amount),
Colour::Green => link_target.deal_green_damage(skill, amount),
};
results.push(Resolution::new(target, scatter_target).event(Event::Skill { skill: Skill::ScatterI }));
res.into_iter().for_each(|e| results.push(Resolution::new(&source, &scatter_target)
results.push(Resolution::new(target, link_target).event(Event::Skill { skill: Skill::LinkI }));
res.into_iter().for_each(|e| results.push(Resolution::new(&source, &link_target)
.event(e).stages(LogStages::EndPost)));
} else {
panic!("not a scatter target {:?}", scatter);
panic!("not a link target {:?}", link);
}
return results;
},
_ => panic!("{:?} scatter hit not damage event", event),
_ => panic!("{:?} link hit not damage event", event),
}
}