Merge branch 'master' of ssh://cryps.gg:40022/~/cryps

This commit is contained in:
ntr 2019-05-02 13:26:57 +10:00
commit e4c8190cad
3 changed files with 36 additions and 18 deletions

View File

@ -218,6 +218,9 @@ function getCombatSequence(event) {
if (['Immunity'].includes(event[0])) return ['START_SKILL', 'POST_SKILL']; if (['Immunity'].includes(event[0])) return ['START_SKILL', 'POST_SKILL'];
if (['Healing'].includes(event[0]) && event[1].skill === 'Slay') return ['POST_SKILL']; if (['Healing'].includes(event[0]) && event[1].skill === 'Slay') return ['POST_SKILL'];
if (['Effect'].includes(event[0])
&& event[1].skill === 'Decay' && event[1].effect === 'Wither') return ['POST_SKILL'];
if (['Damage'].includes(event[0]) if (['Damage'].includes(event[0])
&& event[1].skill === 'Chaos' && event[1].colour === 'RedDamage') return ['POST_SKILL']; && event[1].skill === 'Chaos' && event[1].colour === 'RedDamage') return ['POST_SKILL'];

View File

@ -252,6 +252,7 @@ pub enum Effect {
Mesmerise, Mesmerise,
Amplify, Amplify,
Silence, Silence,
Wither, // Reduce green dmg (healing) taken
// corrupt is the buff that applies // corrupt is the buff that applies
// corruption the dmg debuff // corruption the dmg debuff
@ -346,6 +347,8 @@ impl Effect {
Effect::Amplify => vec![Stat::BlueDamage], Effect::Amplify => vec![Stat::BlueDamage],
Effect::Curse => vec![Stat::BlueDamageTaken], Effect::Curse => vec![Stat::BlueDamageTaken],
Effect::Wither => vec![Stat::GreenDamageTaken],
Effect::Haste => vec![Stat::Speed], Effect::Haste => vec![Stat::Speed],
Effect::Slow => vec![Stat::Speed], Effect::Slow => vec![Stat::Speed],
@ -365,6 +368,8 @@ impl Effect {
Effect::Haste => value << 1, Effect::Haste => value << 1,
Effect::Slow => value >> 1, Effect::Slow => value >> 1,
Effect::Wither => value >> 1,
Effect::Hatred => value + match meta { Effect::Hatred => value + match meta {
Some(EffectMeta::AddedDamage(d)) => d, Some(EffectMeta::AddedDamage(d)) => d,
_ => panic!("hatred meta not damage"), _ => panic!("hatred meta not damage"),
@ -412,6 +417,7 @@ impl Effect {
Effect::Mesmerise => Category::Debuff, Effect::Mesmerise => Category::Debuff,
Effect::Amplify => Category::Buff, Effect::Amplify => Category::Buff,
Effect::Silence => Category::Debuff, Effect::Silence => Category::Debuff,
Effect::Wither => Category::Debuff,
Effect::Corrupt => Category::Buff, Effect::Corrupt => Category::Buff,
Effect::Corruption => Category::Debuff, Effect::Corruption => Category::Debuff,
@ -555,9 +561,9 @@ impl Skill {
// Others // Others
Skill::CorruptionTick => 80, Skill::CorruptionTick => 80,
Skill::DecayTick => 60, Skill::DecayTick => 25,
Skill::Riposte => 100, Skill::Riposte => 100,
Skill::SiphonTick => 100, // 1.0 to pass tests Skill::SiphonTick => 30,
Skill::StrangleTick => 30, Skill::StrangleTick => 30,
Skill::TriageTick => 65, Skill::TriageTick => 65,
_ => 100, _ => 100,
@ -645,9 +651,9 @@ impl Skill {
Skill::Chaos => None, Skill::Chaos => None,
Skill::Amplify => Some(1), Skill::Amplify => Some(1),
Skill::Invert => Some(2), Skill::Invert => Some(2),
Skill::Decay => None, // dot Skill::Decay => Some(1), // dot
Skill::DecayTick => None, Skill::DecayTick => None,
Skill::Siphon => Some(1), Skill::Siphon => None,
Skill::SiphonTick => None, Skill::SiphonTick => None,
Skill::Curse => Some(1), Skill::Curse => Some(1),
Skill::Empower => Some(1), Skill::Empower => Some(1),
@ -958,13 +964,20 @@ fn empower(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill
fn slay(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions { fn slay(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
let amount = source.red_damage().pct(skill.multiplier()); let amount = source.red_damage().pct(skill.multiplier());
target.deal_red_damage(skill, amount) let slay_events = target.deal_red_damage(skill, amount);
.into_iter()
.for_each(|e| results.push(Resolution::new(source, target).event(e)));
source.deal_green_damage(skill, amount) for e in slay_events {
.into_iter() match e {
.for_each(|e| results.push(Resolution::new(source, source).event(e))); Event::Damage { amount, mitigation: _, colour: _, skill: _ } => {
results.push(Resolution::new(source, target).event(e));
let heal = source.deal_green_damage(skill, amount);
for h in heal {
results.push(Resolution::new(source, source).event(h));
};
},
_ => results.push(Resolution::new(source, target).event(e)),
}
}
return results; return results;
} }
@ -1035,10 +1048,12 @@ fn slow(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: S
} }
fn decay(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions { fn decay(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
let wither = CrypEffect::new(Effect::Wither, skill.duration());
let decay = CrypEffect::new(Effect::Decay, skill.duration()) let decay = CrypEffect::new(Effect::Decay, skill.duration())
.set_tick(Cast::new_tick(source, target, Skill::DecayTick)); .set_tick(Cast::new_tick(source, target, Skill::DecayTick));
results.push(Resolution::new(source, target).event(target.add_effect(skill, decay))); results.push(Resolution::new(source, target).event(target.add_effect(skill, decay)));
results.push(Resolution::new(source, target).event(target.add_effect(skill, wither)));
return decay_tick(source, target, results, Skill::DecayTick); return decay_tick(source, target, results, Skill::DecayTick);
} }
@ -1140,12 +1155,12 @@ fn siphon_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, s
match e { match e {
Event::Damage { amount, mitigation: _, colour: _, skill: _ } => { Event::Damage { amount, mitigation: _, colour: _, skill: _ } => {
results.push(Resolution::new(source, target).event(e)); results.push(Resolution::new(source, target).event(e));
let heal = source.deal_green_damage(Skill::Siphon, amount); let heal = source.deal_green_damage(Skill::SiphonTick, amount);
for h in heal { for h in heal {
results.push(Resolution::new(source, source).event(h)); results.push(Resolution::new(source, source).event(h));
}; };
}, },
_ => (), _ => results.push(Resolution::new(source, target).event(e)),
} }
} }
@ -1370,7 +1385,7 @@ mod tests {
let mut results = resolve(Skill::Siphon, &mut x, &mut y, vec![]); let mut results = resolve(Skill::Siphon, &mut x, &mut y, vec![]);
assert!(y.affected(Effect::Siphon)); assert!(y.affected(Effect::Siphon));
assert!(x.green_life() == 768); assert!(x.green_life() == (512 + 256.pct(Skill::SiphonTick.multiplier())));
let Resolution { source: _, target: _, event } = results.remove(0); let Resolution { source: _, target: _, event } = results.remove(0);
match event { match event {
@ -1380,14 +1395,14 @@ mod tests {
let Resolution { source: _, target: _, event } = results.remove(0); let Resolution { source: _, target: _, event } = results.remove(0);
match event { match event {
Event::Damage { amount, skill: _, mitigation: _, colour: _} => assert_eq!(amount, 256), Event::Damage { amount, skill: _, mitigation: _, colour: _} => assert_eq!(amount, 256.pct(Skill::SiphonTick.multiplier())),
_ => panic!("not damage siphon"), _ => panic!("not damage siphon"),
}; };
let Resolution { source: _, target, event } = results.remove(0); let Resolution { source: _, target, event } = results.remove(0);
match event { match event {
Event::Healing { amount, skill: _, overhealing: _ } => { Event::Healing { amount, skill: _, overhealing: _ } => {
assert_eq!(amount, 256); assert_eq!(amount, 256.pct(Skill::SiphonTick.multiplier()));
assert_eq!(target.id, x.id); assert_eq!(target.id, x.id);
}, },
_ => panic!("not healing"), _ => panic!("not healing"),

View File

@ -359,7 +359,7 @@ fn get_combos() -> Vec<Combo> {
Combo { units: vec![Var::Debuff, Var::Green, Var::Green], var: Var::Purge }, Combo { units: vec![Var::Debuff, Var::Green, Var::Green], var: Var::Purge },
Combo { units: vec![Var::Debuff, Var::Blue, Var::Blue], var: Var::Silence }, Combo { units: vec![Var::Debuff, Var::Blue, Var::Blue], var: Var::Silence },
Combo { units: vec![Var::Debuff, Var::Red, Var::Green], var: Var::Slow }, Combo { units: vec![Var::Debuff, Var::Red, Var::Green], var: Var::Slow },
Combo { units: vec![Var::Debuff, Var::Green, Var::Blue], var: Var::Siphon }, Combo { units: vec![Var::Debuff, Var::Green, Var::Blue], var: Var::Decay },
Combo { units: vec![Var::Debuff, Var::Red, Var::Blue], var: Var::Invert }, Combo { units: vec![Var::Debuff, Var::Red, Var::Blue], var: Var::Invert },
Combo { units: vec![Var::Block, Var::Red, Var::Red], var: Var::Parry }, Combo { units: vec![Var::Block, Var::Red, Var::Red], var: Var::Parry },
@ -383,7 +383,7 @@ fn get_combos() -> Vec<Combo> {
Combo { units: vec![Var::Attack, Var::Green, Var::Green], var: Var::Heal }, Combo { units: vec![Var::Attack, Var::Green, Var::Green], var: Var::Heal },
Combo { units: vec![Var::Attack, Var::Blue, Var::Blue], var: Var::Blast }, Combo { units: vec![Var::Attack, Var::Blue, Var::Blue], var: Var::Blast },
Combo { units: vec![Var::Attack, Var::Red, Var::Green], var: Var::Slay }, Combo { units: vec![Var::Attack, Var::Red, Var::Green], var: Var::Slay },
Combo { units: vec![Var::Attack, Var::Green, Var::Blue], var: Var::Decay }, Combo { units: vec![Var::Attack, Var::Green, Var::Blue], var: Var::Siphon },
Combo { units: vec![Var::Attack, Var::Red, Var::Blue], var: Var::Chaos }, Combo { units: vec![Var::Attack, Var::Red, Var::Blue], var: Var::Chaos },
Combo { units: vec![Var::Damage, Var::Red, Var::Red], var: Var::RedDamageI }, Combo { units: vec![Var::Damage, Var::Red, Var::Red], var: Var::RedDamageI },