Buff effects represented as perectanges, slow is now applied by debuff

This commit is contained in:
Mashy
2019-05-07 16:39:17 +10:00
parent d87c73411e
commit ae8a384b39
3 changed files with 33 additions and 26 deletions
+17 -18
View File
@@ -75,6 +75,7 @@ pub fn resolve(skill: Skill, source: &mut Cryp, target: &mut Cryp, mut resolutio
Skill::Corrupt => corrupt(source, target, resolutions, skill),
Skill::CorruptionTick => corruption_tick(source, target, resolutions, skill),
Skill::Curse => curse(source, target, resolutions, skill),
Skill::Debuff => debuff(source, target, resolutions, skill), // speed slow
Skill::Decay => decay(source, target, resolutions, skill), // dot
Skill::DecayTick => decay_tick(source, target, resolutions, skill), // dot
Skill::Haste => haste(source, target, resolutions, skill), // speed slow
@@ -99,7 +100,6 @@ pub fn resolve(skill: Skill, source: &mut Cryp, target: &mut Cryp, mut resolutio
Skill::SiphonTick => siphon_tick(source, target, resolutions, skill), // hot
Skill::Slay => slay(source, target, resolutions, skill), // hybrid dmg self heal
Skill::Sleep => sleep(source, target, resolutions, skill), // speed slow
Skill::Slow => slow(source, target, resolutions, skill), // speed slow
Skill::Snare => snare(source, target, resolutions, skill),
Skill::Strangle => strangle(source, target, resolutions, skill),
Skill::StrangleTick => strangle_tick(source, target, resolutions, skill),
@@ -387,17 +387,17 @@ impl Effect {
pub fn apply(&self, value: u64, meta: Option<EffectMeta>) -> u64 {
match self {
Effect::Vulnerable => value << 1,
Effect::Block => value >> 1,
Effect::Vulnerable => value.pct(150),
Effect::Block => value.pct(50),
Effect::Amplify => value << 1,
Effect::Curse => value << 1,
Effect::Amplify => value.pct(150),
Effect::Curse => value.pct(150),
Effect::Haste => value << 1,
Effect::Slow => value >> 1,
Effect::Haste => value.pct(150),
Effect::Slow => value.pct(50),
Effect::Impurity => value << 1,
Effect::Wither => value >> 1,
Effect::Impurity => value.pct(150),
Effect::Wither => value.pct(50),
Effect::Hatred => value + match meta {
Some(EffectMeta::AddedDamage(d)) => d,
@@ -494,11 +494,13 @@ pub enum Category {
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
pub enum Skill {
Attack,
Debuff,
Block, // reduce damage
Stun,
// -----------------
// Nature
// -----------------
Block, // reduce damage
Parry, // avoid all damage
Riposte,
Snare,
@@ -521,7 +523,6 @@ pub enum Skill {
Strike,
StrikeII,
StrikeIII,
Stun,
// Evade, // actively evade
// -----------------
@@ -568,7 +569,6 @@ pub enum Skill {
Hex,
Haste,
HasteStrike,
Slow,
// used by tests, no cd, 100% multiplier
TestAttack,
@@ -627,7 +627,7 @@ impl Skill {
Skill::Block => 1,
Skill::Parry => 1,
Skill::Clutch => 1,
Skill::Debuff => 3,
Skill::Reflect => 1,
Skill::Injure => 2,
@@ -649,7 +649,6 @@ impl Skill {
Skill::Curse => 2,
Skill::Banish => 1,
Skill::Slow => 2,
Skill::Haste => 2,
Skill::Amplify => 2,
@@ -689,6 +688,7 @@ impl Skill {
pub fn base_cd(&self) -> Cooldown {
match self {
Skill::Attack => None,
Skill::Debuff => Some(1),
Skill::Strike => None,
Skill::StrikeII => None,
Skill::StrikeIII => None,
@@ -721,7 +721,6 @@ impl Skill {
Skill::Haste => Some(2),
Skill::HasteStrike => None, // Used in haste
Skill::Slow => None,
Skill::Reflect => Some(2),
Skill::Recharge => Some(2),
Skill::Ruin => Some(3),
@@ -797,7 +796,7 @@ impl Skill {
Skill::Purge => Category::Blue,
Skill::Banish => Category::Blue,
Skill::Hex => Category::Blue,
Skill::Slow => Category::Blue,
Skill::Debuff => Category::Blue,
Skill::Ruin => Category::Blue,
Skill::Hostility => Category::Blue,
Skill::Corrupt => Category::Blue,
@@ -1128,7 +1127,7 @@ fn haste(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill:
return results;;
}
fn slow(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
fn debuff(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
let effect = CrypEffect::new(Effect::Slow, skill.duration());
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)));
return results;;
@@ -1638,7 +1637,7 @@ mod tests {
amplify(&mut x.clone(), &mut x, vec![], Skill::Amplify);
assert!(x.effects.iter().any(|e| e.effect == Effect::Amplify));
assert_eq!(x.blue_damage(), 100);
assert_eq!(x.blue_damage(), 75);
}
#[test]
+1 -3
View File
@@ -86,7 +86,6 @@ pub enum Var {
Silence,
Slay,
Sleep,
Slow,
Snare,
Strangle,
Strike,
@@ -196,6 +195,7 @@ impl Var {
Var::Block => Some(Skill::Block),
Var::Chaos => Some(Skill::Chaos),
Var::Curse => Some(Skill::Curse),
Var::Debuff => Some(Skill::Debuff),
Var::Decay => Some(Skill::Decay),
Var::Haste => Some(Skill::Haste),
Var::Heal => Some(Skill::Heal),
@@ -213,7 +213,6 @@ impl Var {
Var::Silence => Some(Skill::Silence),
Var::Slay => Some(Skill::Slay),
Var::Sleep => Some(Skill::Sleep),
Var::Slow => Some(Skill::Slow),
Var::Siphon => Some(Skill::Siphon),
Var::Snare => Some(Skill::Snare),
Var::Strangle => Some(Skill::Strangle),
@@ -290,7 +289,6 @@ impl From<Skill> for Var {
Skill::Siphon => Var::Siphon,
Skill::Slay => Var::Slay,
Skill::Sleep => Var::Sleep,
Skill::Slow => Var::Slow,
Skill::Snare => Var::Snare,
Skill::Strangle => Var::Strangle,
Skill::Strike => Var::Strike,