dots and hots

This commit is contained in:
ntr 2018-11-09 15:33:17 +11:00
parent 567b1b7ee9
commit 2ab5009fe1

View File

@ -456,6 +456,8 @@ impl Skill {
Skill::Stun => 2,
Skill::Block => 1,
Skill::Decay => 3,
Skill::TestBlock => 1,
Skill::TestStun => 2,
_ => panic!("{:?} does not have a duration", self),
@ -557,6 +559,30 @@ mod tests {
println!("{:?}", resolution);
}
#[test]
fn decay_test() {
let mut x = Cryp::new()
.named(&"muji".to_string())
.level(8)
.learn(Skill::Decay)
.create();
let mut y = Cryp::new()
.named(&"camel".to_string())
.level(8)
.create();
let mut resolution = Resolution { base: 0, result: None, text: String::new() };
decay(&mut x, &mut y, &mut resolution);
assert!(y.effects.iter().any(|e| e.effect == Effect::Decay));
y.reduce_effect_durations();
let decay = y.effects.iter().find(|e| e.effect == Effect::Decay);
assert!(y.hp.value == y.stamina.value.saturating_sub(decay.unwrap().tick.unwrap().amount));
}
}
// #[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]