more game tests
This commit is contained in:
parent
9e7a99f04d
commit
206d207452
122
core/src/game.rs
122
core/src/game.rs
@ -1109,94 +1109,94 @@ mod tests {
|
||||
return game.resolve_phase_start();
|
||||
}
|
||||
|
||||
// #[test]
|
||||
// fn phase_test() {
|
||||
// let mut game = create_test_game();
|
||||
#[test]
|
||||
fn phase_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();
|
||||
|
||||
// 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();
|
||||
|
||||
// assert!(game.skill_phase_finished());
|
||||
assert!(game.skill_phase_finished());
|
||||
|
||||
// game = game.resolve_phase_start();
|
||||
game = game.resolve_phase_start();
|
||||
|
||||
// assert!([Phase::Skill, Phase::Finished].contains(&game.phase));
|
||||
assert!([Phase::Skill, Phase::Finished].contains(&game.phase));
|
||||
|
||||
// return;
|
||||
// }
|
||||
return;
|
||||
}
|
||||
|
||||
// #[test]
|
||||
// fn stun_test() {
|
||||
// let mut game = create_test_game();
|
||||
#[test]
|
||||
fn stun_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();
|
||||
|
||||
// while game.construct_by_id(x_construct.id).unwrap().skill_on_cd(Skill::Stun).is_some() {
|
||||
// game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns();
|
||||
// }
|
||||
while game.construct_by_id(x_construct.id).unwrap().skill_on_cd(Skill::Stun).is_some() {
|
||||
game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns();
|
||||
}
|
||||
|
||||
// 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.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();
|
||||
|
||||
// assert!(game.skill_phase_finished());
|
||||
// game = game.resolve_phase_start();
|
||||
assert!(game.skill_phase_finished());
|
||||
game = game.resolve_phase_start();
|
||||
|
||||
// // 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).constructs[0].is_stunned());
|
||||
// // assert!(game.player_by_id(y_player.id).skills_required() == 0);
|
||||
// }
|
||||
// assert!(game.player_by_id(y_player.id).constructs[0].is_stunned());
|
||||
// assert!(game.player_by_id(y_player.id).skills_required() == 0);
|
||||
}
|
||||
|
||||
// #[test]
|
||||
// fn ko_resolution_test() {
|
||||
// let mut game = create_test_game();
|
||||
#[test]
|
||||
fn ko_resolution_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();
|
||||
|
||||
// game.player_by_id(y_player.id).unwrap().construct_by_id(y_construct.id).unwrap().red_power.force(1000000000);
|
||||
// game.player_by_id(y_player.id).unwrap().construct_by_id(y_construct.id).unwrap().speed.force(1000000000);
|
||||
game.player_by_id(y_player.id).unwrap().construct_by_id(y_construct.id).unwrap().red_power.force(1000000000);
|
||||
game.player_by_id(y_player.id).unwrap().construct_by_id(y_construct.id).unwrap().speed.force(1000000000);
|
||||
|
||||
// while game.construct_by_id(x_construct.id).unwrap().skill_on_cd(Skill::Stun).is_some() {
|
||||
// game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns();
|
||||
// }
|
||||
while game.construct_by_id(x_construct.id).unwrap().skill_on_cd(Skill::Stun).is_some() {
|
||||
game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns();
|
||||
}
|
||||
|
||||
// // just in case
|
||||
// // remove all mitigation
|
||||
// game.player_by_id(x_player.id).unwrap().construct_by_id(x_construct.id).unwrap().red_life.force(0);
|
||||
// just in case
|
||||
// remove all mitigation
|
||||
game.player_by_id(x_player.id).unwrap().construct_by_id(x_construct.id).unwrap().red_life.force(0);
|
||||
|
||||
// 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.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();
|
||||
|
||||
// assert!(game.skill_phase_finished());
|
||||
// game = game.resolve_phase_start();
|
||||
assert!(game.skill_phase_finished());
|
||||
game = game.resolve_phase_start();
|
||||
|
||||
// assert!(!game.player_by_id(y_player.id).unwrap().constructs[0].is_stunned());
|
||||
// assert!(game.phase == Phase::Finished);
|
||||
// }
|
||||
assert!(!game.player_by_id(y_player.id).unwrap().constructs[0].is_stunned());
|
||||
assert!(game.phase == Phase::Finished);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cooldown_test() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user