From 157bca66584864740b5c711197bc0fac30ac0ea3 Mon Sep 17 00:00:00 2001 From: ntr Date: Tue, 10 Dec 2019 17:00:04 +1000 Subject: [PATCH] siphon test --- core/src/game.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/core/src/game.rs b/core/src/game.rs index abf3165c..170862e3 100644 --- a/core/src/game.rs +++ b/core/src/game.rs @@ -1703,4 +1703,29 @@ mod tests { _ => false, })); } + + #[test] + fn siphon_test() { + let mut game = create_2v2_test_game(); + let player_id = game.players[0].id; + let source = game.players[0].constructs[0].id; + let target = game.players[1].constructs[0].id; + + game.resolve(Cast::new(source, player_id, target, Skill::Siphon)); + + let last = game.resolutions.len() - 1; + let resolutions = &game.resolutions[last]; + + assert!(resolutions.iter().any(|r| match r.event { + Event::Damage { construct, colour, amount, mitigation: _, display: _ } => + construct == target && amount > 0 && colour == Colour::Blue, + _ => false, + })); + + assert!(resolutions.iter().any(|r| match r.event { + Event::Healing { construct, colour, amount, overhealing: _ } => + construct == source && amount > 0 && colour == Colour::Green, + _ => false, + })); + } }