cooldown test back

This commit is contained in:
ntr 2019-12-12 16:43:34 +10:00
parent 14be48da24
commit 9e7a99f04d

View File

@ -1198,48 +1198,48 @@ mod tests {
// assert!(game.phase == Phase::Finished);
// }
// #[test]
// fn cooldown_test() {
// let mut game = create_test_game();
#[test]
fn cooldown_test() {
let mut game = create_test_game();
// let x_player = game.players[0].clone();
// let y_player = game.players[1].clone();
let x_player = game.players[0].clone();
let y_player = game.players[1].clone();
// let x_construct = x_player.constructs[0].clone();
// let y_construct = y_player.constructs[0].clone();
let x_construct = x_player.constructs[0].clone();
let y_construct = y_player.constructs[0].clone();
// // should auto progress back to skill phase
// assert!(game.phase == Phase::Skill);
// should auto progress back to skill phase
assert!(game.phase == Phase::Skill);
// assert!(game.player_by_id(y_player.id).unwrap().constructs[0].skill_on_cd(Skill::Block).is_none());
// assert!(game.player_by_id(y_player.id).unwrap().constructs[0].skill_on_cd(Skill::Stun).is_some());
// assert!(game.player_by_id(x_player.id).unwrap().constructs[0].skill_on_cd(Skill::Block).is_none());
assert!(game.player_by_id(y_player.id).unwrap().constructs[0].skill_on_cd(Skill::Stun).is_some());
assert!(game.player_by_id(x_player.id).unwrap().constructs[0].skill_on_cd(Skill::Block).is_none());
// game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Attack).unwrap();
// game.add_skill(y_player.id, y_construct.id, x_construct.id, Skill::Attack).unwrap();
game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Attack).unwrap();
game.add_skill(y_player.id, y_construct.id, x_construct.id, Skill::Attack).unwrap();
// game.player_ready(x_player.id).unwrap();
// game.player_ready(y_player.id).unwrap();
game.player_ready(x_player.id).unwrap();
game.player_ready(y_player.id).unwrap();
// game = game.resolve_phase_start();
game = game.resolve_phase_start();
// // should auto progress back to skill phase
// assert!(game.phase == Phase::Skill);
// assert!(game.player_by_id(y_player.id).unwrap().constructs[0].skill_on_cd(Skill::Stun).is_some());
// should auto progress back to skill phase
assert!(game.phase == Phase::Skill);
assert!(game.player_by_id(y_player.id).unwrap().constructs[0].skill_on_cd(Skill::Stun).is_none());
// // second round
// // now we block and it should go back on cd
// // game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Stun).unwrap();
// game.add_skill(y_player.id, y_construct.id, x_construct.id, Skill::Attack).unwrap();
// second round
// now we block and it should go back on cd
game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Stun).unwrap();
game.add_skill(y_player.id, y_construct.id, x_construct.id, Skill::Attack).unwrap();
// game.player_ready(x_player.id).unwrap();
// game.player_ready(y_player.id).unwrap();
game.player_ready(x_player.id).unwrap();
game.player_ready(y_player.id).unwrap();
// game = game.resolve_phase_start();
game = game.resolve_phase_start();
// assert!(game.player_by_id(x_player.id).unwrap().constructs[0].skill_on_cd(Skill::Stun).is_none());
// assert!(game.player_by_id(y_player.id).unwrap().constructs[0].skill_on_cd(Skill::Block).is_none());
// }
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());
}
// #[test]
// fn sleep_cooldown_test() {