Merge branch 'remove-categories' of ssh://cryps.gg:40022/~/cryps into remove-categories

This commit is contained in:
ntr 2019-05-22 15:10:03 +10:00
commit 585bafe45e

View File

@ -543,6 +543,7 @@ impl Effect {
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]
pub enum SkillEffect {
Modifier {effect: Effect, multiplier: u64, duration: u8},
Disable {effect: Effect, duration: u8},
}
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
@ -688,18 +689,22 @@ impl Skill {
}),
*/
pub fn effect(&self) -> SkillEffect {
pub fn effect(&self) -> CrypEffect {
// Buff -> Effect, Multiplier, duration
match self {
Skill::Amplify => SkillEffect::Modifier {effect: Effect::Amplify, multiplier: 150, duration: 2},
Skill::Block => SkillEffect::Modifier {effect: Effect::Block, multiplier: 50, duration: 1},
Skill::Buff => SkillEffect::Modifier {effect: Effect::Buff, multiplier: 125, duration: 2},
Skill::Curse => SkillEffect::Modifier {effect: Effect::Curse, multiplier: 150, duration: 2},
Skill::Debuff => SkillEffect::Modifier {effect: Effect::Slow, multiplier: 50, duration: 3},
Skill::Decay => SkillEffect::Modifier {effect: Effect::Wither, multiplier: 50, duration: 3},
Skill::Impurity => SkillEffect::Modifier {effect: Effect::Impurity, multiplier: 150, duration: 3},
Skill::Haste => SkillEffect::Modifier {effect: Effect::Haste, multiplier: 150, duration: 2},
Skill::Throw => SkillEffect::Modifier {effect: Effect::Vulnerable, multiplier: 150, duration: 3},
// Modifiers
Skill::Amplify => CrypEffect {effect: Effect::Amplify, duration: 2, meta: Some(EffectMeta::Multiplier(150)), tick: None},
Skill::Block => CrypEffect {effect: Effect::Block, duration: 1, meta: Some(EffectMeta::Multiplier(50)), tick: None},
Skill::Buff => CrypEffect {effect: Effect::Buff, duration: 2, meta: Some(EffectMeta::Multiplier(125)), tick: None },
Skill::Curse => CrypEffect {effect: Effect::Curse, duration: 2, meta: Some(EffectMeta::Multiplier(150)), tick: None},
Skill::Debuff => CrypEffect {effect: Effect::Slow, duration: 3, meta: Some(EffectMeta::Multiplier(50)), tick: None },
Skill::Decay => CrypEffect {effect: Effect::Wither, duration: 3, meta: Some(EffectMeta::Multiplier(50)), tick: None },
Skill::Impurity => CrypEffect {effect: Effect::Impurity, duration: 3, meta: Some(EffectMeta::Multiplier(150)), tick: None },
Skill::Haste => CrypEffect {effect: Effect::Haste, duration: 2, meta: Some(EffectMeta::Multiplier(150)), tick: None },
Skill::Throw => CrypEffect {effect: Effect::Vulnerable, duration: 3, meta: Some(EffectMeta::Multiplier(150)), tick: None},
// Disables
Skill::Stun => CrypEffect {effect: Effect::Stun, duration: 2, meta: None, tick: None},
_ => {
panic!("no skill effect");
@ -709,7 +714,6 @@ impl Skill {
pub fn duration(&self) -> u8 {
match self {
Skill::Block => 1,
Skill::Parry => 2,
Skill::Clutch => 1,
Skill::Reflect => 1,
@ -984,17 +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));
}
}
}
fn touch(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill: Skill) -> Resolutions {
target.deal_red_damage(skill, 0)
.into_iter()
@ -1067,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 {
let stun = CrypEffect::new(Effect::Stun, skill.duration());
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;
}
@ -1102,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 {
results.push(apply_modifier(skill, source, target));
results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect())));
return results;
}
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;
}
@ -1217,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 {
results.push(apply_modifier(skill, source, target));
results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect())));
return results;;
}
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;;
}
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;;
}
@ -1236,8 +1229,7 @@ fn decay(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill:
.set_tick(Cast::new_tick(source, target, Skill::DecayTick));
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);
}
@ -1301,12 +1293,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 {
results.push(apply_modifier(skill, source, target));
results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect())));
return results;;
}
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;;
}