Merge branch 'core' into core-actions

This commit is contained in:
ntr 2019-12-13 11:25:55 +10:00
commit b1f03a0981
2 changed files with 75 additions and 2 deletions

View File

@ -4,3 +4,4 @@ game ready not auto starting resolve phase
purify conditional healing
set static speed for dot ticks
infinite counter loop

View File

@ -1236,7 +1236,7 @@ mod tests {
game = game.resolve_phase_start();
println!("{:?}", game.player_by_id(x_player.id).unwrap().constructs[0]);
// println!("{:?}", game.player_by_id(x_player.id).unwrap().constructs[0]);
assert!(game.player_by_id(x_player.id).unwrap().constructs[0].skill_on_cd(Skill::Stun).is_some());
assert!(game.player_by_id(y_player.id).unwrap().constructs[0].skill_on_cd(Skill::Block).is_none());
}
@ -1893,6 +1893,78 @@ mod tests {
} == 320.pct(Skill::Blast.multiplier()) - 125);
}
#[test]
fn multi_reflect_test() {
let mut game = create_2v2_test_game();
let player_id = game.players[0].id;
let target_player_id = game.players[1].id;
let source = game.players[0].constructs[0].id;
let target = game.players[1].constructs[0].id;
game.resolve(Cast::new(source, player_id, source, Skill::Reflect), vec![]);
game.resolve(Cast::new(target, target_player_id, target, Skill::Reflect), vec![]);
game.resolve(Cast::new(source, player_id, target, Skill::Blast), vec![]);
assert!(game.players[0].constructs[0].is_ko() == false);
assert!(game.players[1].constructs[0].is_ko() == false);
}
// refer fixme.md (infinite counterattack loop)
/*#[test]
fn multi_counter_test() {
let mut game = create_2v2_test_game();
let player_id = game.players[0].id;
let target_player_id = game.players[1].id;
let source = game.players[0].constructs[0].id;
let target = game.players[1].constructs[0].id;
game.resolve(Cast::new(source, player_id, source, Skill::Counter), vec![]);
game.resolve(Cast::new(target, target_player_id, target, Skill::Counter), vec![]);
game.resolve(Cast::new(source, player_id, target, Skill::Attack), vec![]);
assert!(game.players[0].constructs[0].is_ko() == false);
assert!(game.players[1].constructs[0].is_ko() == false);
}*/
#[test]
fn intercept_test() {
let mut game = create_2v2_test_game();
let player_id = game.players[0].id;
let other_player_id = game.players[1].id;
let source = game.players[0].constructs[0].id;
let target = game.players[1].constructs[0].id;
let interceptor = game.players[1].constructs[1].id;
// Cast intercept
game.resolve(Cast::new(interceptor, other_player_id, interceptor, Skill::Intercept), vec![]);
// Enemy casts skill on target which as a teammate intercepting
game.resolve(Cast::new(source, player_id, target, Skill::Attack), vec![]);
// Intercepting teammate attacks someone on same team
game.resolve(Cast::new(interceptor, other_player_id, target, Skill::Attack), vec![]);
let last = game.resolutions.len() - 1;
let resolutions = &game.resolutions[last];
// There should be no damage events on the target
assert!(resolutions.iter().any(|r| match r.event {
Event::Damage { construct, colour, amount, mitigation, display: _ } =>
construct == target && (amount > 0 || mitigation > 0) && colour == Colour::Red,
_ => false,
}) == false);
// Should be damage events on the interceptor
assert!(resolutions.iter().any(|r| match r.event {
Event::Damage { construct, colour, amount, mitigation, display: _ } =>
construct == interceptor && (amount > 0 || mitigation > 0) && colour == Colour::Red,
_ => false,
}));
}
/*
#[test]
fn tick_speed_tests() {