reflect is back

This commit is contained in:
ntr 2019-03-24 23:01:59 +11:00
parent 3a20de13e8
commit aa2832f4d8
2 changed files with 22 additions and 31 deletions

View File

@ -388,11 +388,6 @@ impl Cryp {
self
}
// pub fn rez(&mut self) -> &mut Cryp {
// self.hp.set(self.hp.base);
// self
// }
// Stats
pub fn red_damage(&self) -> u64 {
let red_damage_mods = self.effects.iter()
@ -424,7 +419,6 @@ impl Cryp {
return modified_green_damage;
}
pub fn skill_speed(&self, s: Skill) -> u64 {
self.speed().saturating_mul(s.speed() as u64)
}

View File

@ -605,14 +605,13 @@ impl Skill {
return results;
}
// if target.is_reflecting() {
// // guard against overflow
// if source.is_reflecting() {
// return results;
// }
// let mut copy = source.clone();
// return self.resolve(&mut copy, source);
// }
if target.is_reflecting() {
// guard against overflow
if source.is_reflecting() {
return results;
}
return self.resolve(target, source);
}
match self {
Skill::Amplify => amplify(source, target, results), // increase magic damage
@ -1045,28 +1044,26 @@ mod tests {
};
}
// #[test]
// fn reflect_test() {
// let mut x = Cryp::new()
// .named(&"muji".to_string());
#[test]
fn reflect_test() {
let mut x = Cryp::new()
.named(&"muji".to_string());
// let mut y = Cryp::new()
// .named(&"camel".to_string());
let mut y = Cryp::new()
.named(&"camel".to_string());
// reflect(&mut y.clone(), &mut y, vec![]);
// assert!(y.is_reflecting());
reflect(&mut y.clone(), &mut y, vec![]);
assert!(y.is_reflecting());
// // heal should deal green damage
// let mut cast = Cast::new(Uuid::nil(), Uuid::nil(), Uuid::nil(), Skill::Attack);
// cast.resolve(&mut x, &mut y);
let results = Skill::Attack.resolve(&mut x, &mut y);
// assert!(x.hp() == 768);
assert!(x.hp() == 768);
// match cast.results[0] {
// ResolutionResult::Damage { amount, mitigation: _, category: _ } => assert_eq!(amount, 256),
// _ => panic!("not damage"),
// };
// }
match results[0] {
ResolutionResult::Damage { amount, mitigation: _, category: _ } => assert_eq!(amount, 256),
_ => panic!("not damage"),
};
}
#[test]
fn triage_test() {