SkillEffect -> CrypEffect

This commit is contained in:
Mashy 2019-05-22 15:03:31 +10:00
parent bcd89e24d0
commit ddfe40d7c1

View File

@ -693,23 +693,22 @@ impl Skill {
}), }),
*/ */
pub fn effect(&self) -> SkillEffect { pub fn effect(&self) -> CrypEffect {
// Buff -> Effect, Multiplier, duration // Buff -> Effect, Multiplier, duration
match self { match self {
// Modifiers // Modifiers
Skill::Amplify => SkillEffect::Modifier {effect: Effect::Amplify, multiplier: 150, duration: 2}, Skill::Amplify => CrypEffect {effect: Effect::Amplify, duration: 2, meta: Some(EffectMeta::Multiplier(150)), tick: None},
Skill::Block => SkillEffect::Modifier {effect: Effect::Block, multiplier: 50, duration: 1}, Skill::Block => CrypEffect {effect: Effect::Block, duration: 1, meta: Some(EffectMeta::Multiplier(50)), tick: None},
Skill::Buff => SkillEffect::Modifier {effect: Effect::Buff, multiplier: 125, duration: 2}, Skill::Buff => CrypEffect {effect: Effect::Buff, duration: 2, meta: Some(EffectMeta::Multiplier(125)), tick: None },
Skill::Curse => SkillEffect::Modifier {effect: Effect::Curse, multiplier: 150, duration: 2}, Skill::Curse => CrypEffect {effect: Effect::Curse, duration: 2, meta: Some(EffectMeta::Multiplier(150)), tick: None},
Skill::Debuff => SkillEffect::Modifier {effect: Effect::Slow, multiplier: 50, duration: 3}, Skill::Debuff => CrypEffect {effect: Effect::Slow, duration: 3, meta: Some(EffectMeta::Multiplier(50)), tick: None },
Skill::Decay => SkillEffect::Modifier {effect: Effect::Wither, multiplier: 50, duration: 3}, Skill::Decay => CrypEffect {effect: Effect::Wither, duration: 3, meta: Some(EffectMeta::Multiplier(50)), tick: None },
Skill::Impurity => SkillEffect::Modifier {effect: Effect::Impurity, multiplier: 150, duration: 3}, Skill::Impurity => CrypEffect {effect: Effect::Impurity, duration: 3, meta: Some(EffectMeta::Multiplier(150)), tick: None },
Skill::Haste => SkillEffect::Modifier {effect: Effect::Haste, multiplier: 150, duration: 2}, Skill::Haste => CrypEffect {effect: Effect::Haste, duration: 2, meta: Some(EffectMeta::Multiplier(150)), tick: None },
Skill::Throw => SkillEffect::Modifier {effect: Effect::Vulnerable, multiplier: 150, duration: 3}, Skill::Throw => CrypEffect {effect: Effect::Vulnerable, duration: 3, meta: Some(EffectMeta::Multiplier(150)), tick: None},
// Disables // Disables
Skill::Stun => SkillEffect::Disable {effect: Effect::Stun, duration: 2}, Skill::Stun => CrypEffect {effect: Effect::Stun, duration: 2, meta: None, tick: None},
_ => { _ => {
panic!("no skill effect"); panic!("no skill effect");
@ -989,21 +988,6 @@ impl Skill {
} }
} }
fn apply_modifier(skill: Skill, source: &mut Cryp, target: &mut Cryp) -> Resolution {
let skillEffect = skill.effect();
match skillEffect {
SkillEffect::Modifier { effect, multiplier, duration } => {
let crypEffect = CrypEffect::new(effect, duration)
.set_meta(EffectMeta::Multiplier(multiplier));
return Resolution::new(source, target).event(target.add_effect(skill, crypEffect));
}
SkillEffect::Disable { effect, duration } => {
let crypEffect = CrypEffect::new(effect, duration);
return Resolution::new(source, target).event(target.add_effect(skill, crypEffect));
}
}
}
fn touch(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions { fn touch(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
target.deal_red_damage(skill, 0) target.deal_red_damage(skill, 0)
.into_iter() .into_iter()
@ -1076,7 +1060,7 @@ fn taunt(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill:
fn throw(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions { fn throw(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
let stun = CrypEffect::new(Effect::Stun, skill.duration()); let stun = CrypEffect::new(Effect::Stun, skill.duration());
results.push(Resolution::new(source, target).event(target.add_effect(skill, stun))); results.push(Resolution::new(source, target).event(target.add_effect(skill, stun)));
results.push(apply_modifier(skill, source, target)); results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect())));
return results; return results;
} }
@ -1111,12 +1095,12 @@ fn strangle_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions,
} }
fn block(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions { fn block(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
results.push(apply_modifier(skill, source, target)); results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect())));
return results; return results;
} }
fn buff(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions { fn buff(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
results.push(apply_modifier(skill, source, target)); results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect())));
return results; return results;
} }
@ -1226,17 +1210,17 @@ fn blast(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill:
} }
fn amplify(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions { fn amplify(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
results.push(apply_modifier(skill, source, target)); results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect())));
return results;; return results;;
} }
fn haste(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions { fn haste(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
results.push(apply_modifier(skill, source, target)); results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect())));
return results;; return results;;
} }
fn debuff(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 {
results.push(apply_modifier(skill, source, target)); results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect())));
return results;; return results;;
} }
@ -1245,7 +1229,7 @@ fn decay(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill:
.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(apply_modifier(skill, source, target)); results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect())));
return decay_tick(source, target, results, Skill::DecayTick); return decay_tick(source, target, results, Skill::DecayTick);
} }
@ -1310,12 +1294,12 @@ fn hatred(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, reflec
} }
fn curse(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions { fn curse(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
results.push(apply_modifier(skill, source, target)); results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect())));
return results;; return results;;
} }
fn impurity(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions { fn impurity(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
results.push(apply_modifier(skill, source, target)); results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect())));
return results;; return results;;
} }