()
| 2777 | |
| 2778 | #[test] |
| 2779 | fn test_ranger_snipe() { |
| 2780 | // Create the game world. |
| 2781 | let mut world = GameWorld::test_world(); |
| 2782 | |
| 2783 | // Unlock mage's blink ability through research. |
| 2784 | let unlock_level = 3; |
| 2785 | let rounds = 200; |
| 2786 | |
| 2787 | for _ in 0..unlock_level { |
| 2788 | let my_research = world.my_research_mut(); |
| 2789 | assert!(my_research.add_to_queue(&Branch::Ranger)); |
| 2790 | for _ in 0..rounds { |
| 2791 | my_research.end_round(); |
| 2792 | } |
| 2793 | } |
| 2794 | |
| 2795 | // Create ranger and target robot. |
| 2796 | let loc_a = MapLocation::new(Planet::Earth, 0, 0); |
| 2797 | let loc_b = MapLocation::new(Planet::Earth, 0, 1); |
| 2798 | let loc_c = MapLocation::new(Planet::Mars, 0, 20); |
| 2799 | let ranger = world.create_unit(Team::Red, loc_a, UnitType::Ranger).unwrap(); |
| 2800 | let robot = world.create_unit(Team::Red, loc_b,UnitType::Knight).unwrap(); |
| 2801 | // Ranger should not be able to snipe target location on a different planet. |
| 2802 | world.end_round(); |
| 2803 | assert_err!(world.begin_snipe(ranger, loc_c), GameError::LocationOffMap); |
| 2804 | |
| 2805 | // Ranger begins to snipe a location. |
| 2806 | assert!(world.begin_snipe(ranger, loc_b).is_ok()); |
| 2807 | |
| 2808 | // Enough rounds pass where Ranger's snipe is processed |
| 2809 | let rounds = 200; |
| 2810 | for _ in 0..4*rounds { |
| 2811 | world.end_turn(FILLER_TIME); |
| 2812 | } |
| 2813 | |
| 2814 | // Robot at sniped location should take damage |
| 2815 | let robot_damaged_health = 215; |
| 2816 | assert_eq!(world.get_unit(robot).unwrap().health(), robot_damaged_health); |
| 2817 | } |
| 2818 | |
| 2819 | #[test] |
| 2820 | fn test_healer_overcharge() { |
nothing calls this directly
no test coverage detected