hybrid test
This commit is contained in:
parent
7ecf8daa6d
commit
2d4f5e0a70
@ -2146,6 +2146,63 @@ mod tests {
|
||||
assert!(game.players[1].constructs[0].effects.len() == 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hybrid_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.players[1].constructs[0].blue_life.force(0);
|
||||
|
||||
|
||||
game.resolve(Cast::new(source, player_id, source, Skill::Hybrid));
|
||||
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.skill {
|
||||
Skill::HybridBlast => true,
|
||||
_ => false
|
||||
}));
|
||||
|
||||
assert!(resolutions.iter().filter(|r| match r.event {
|
||||
Event::Damage { construct: _, colour: _, amount: _, mitigation: _, display: _ } => true,
|
||||
_ => false,
|
||||
}).count() == 2);
|
||||
|
||||
|
||||
let siphon_dmg = resolutions.iter().find_map(|r| match r.skill {
|
||||
Skill::Siphon => {
|
||||
match r.event {
|
||||
Event::Damage { construct: _, colour: _, amount, mitigation: _, display: _ } => Some(amount),
|
||||
_ => None,
|
||||
}
|
||||
},
|
||||
_ => None
|
||||
}).expect("no siphon dmg");
|
||||
|
||||
let hybrid_dmg = resolutions.iter().find_map(|r| match r.skill {
|
||||
Skill::HybridBlast => {
|
||||
match r.event {
|
||||
Event::Damage { construct: _, colour: _, amount, mitigation: _, display: _ } => Some(amount),
|
||||
_ => None,
|
||||
}
|
||||
},
|
||||
_ => None
|
||||
}).expect("no hybrid dmg");
|
||||
|
||||
assert!(resolutions.iter().any(|r| match r.event {
|
||||
Event::Healing { construct, colour, amount, overhealing, display: _ } => {
|
||||
construct == source && (amount + overhealing) == siphon_dmg && colour == Colour::Green
|
||||
// this works
|
||||
// construct == source && (amount + overhealing) == (siphon_dmg + hybrid_dmg) && colour == Colour::Green
|
||||
},
|
||||
_ => false,
|
||||
}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reflect_test() {
|
||||
let mut game = create_2v2_test_game();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user