()
| 2736 | |
| 2737 | #[test] |
| 2738 | fn test_mage_blink() { |
| 2739 | // Create the game world. |
| 2740 | let mut world = GameWorld::test_world(); |
| 2741 | |
| 2742 | // Unlock mage's blink ability through research. |
| 2743 | let unlock_level = 4; |
| 2744 | let rounds = 200; |
| 2745 | |
| 2746 | for _ in 0..unlock_level { |
| 2747 | let my_research = world.my_research_mut(); |
| 2748 | assert!(my_research.add_to_queue(&Branch::Mage)); |
| 2749 | for _ in 0..rounds { |
| 2750 | my_research.end_round(); |
| 2751 | } |
| 2752 | } |
| 2753 | |
| 2754 | // Create mage. |
| 2755 | let loc_a = MapLocation::new(Planet::Earth, 0, 0); |
| 2756 | let loc_b = MapLocation::new(Planet::Earth, 0, 1); |
| 2757 | let loc_c = MapLocation::new(Planet::Earth, 0, 20); |
| 2758 | let mage = world.create_unit(Team::Red, loc_a, UnitType::Mage).unwrap(); |
| 2759 | |
| 2760 | // Mage blink is ready. |
| 2761 | assert!(!world.is_blink_ready(mage)); |
| 2762 | world.end_round(); |
| 2763 | assert!(world.is_blink_ready(mage)); |
| 2764 | |
| 2765 | // Mage should not be able to blink to target location outside of range. |
| 2766 | assert!(!world.can_blink(mage, loc_c)); |
| 2767 | |
| 2768 | // Mage should be able to blink to target location within range. |
| 2769 | assert!(world.can_blink(mage, loc_b)); |
| 2770 | |
| 2771 | // Blink moves mage to new location. |
| 2772 | assert_eq!(world.get_unit(mage).unwrap().location(), OnMap(loc_a)); |
| 2773 | assert!(world.blink(mage, loc_b).is_ok()); |
| 2774 | assert_eq!(world.get_unit(mage).unwrap().location(), OnMap(loc_b)); |
| 2775 | assert!(!world.is_blink_ready(mage)); |
| 2776 | } |
| 2777 | |
| 2778 | #[test] |
| 2779 | fn test_ranger_snipe() { |
nothing calls this directly
no test coverage detected