def test__get_distance_from_target(self): # Arrange name = 'NShip' type_ = 'Battle' align = 'them' x_location = 3 y_location = 3 # Act ship = Ship(name, type_, x_location, y_location, align) ship._range = 10 ship._max_health = 100 ship._attack_power = 10 target = Cruiser('Cruise1', 'Cruiser', 0, 7, 'us') result = ship._get_distance_from_target(target) print(result) # Assert self.assertEqual(5, result)
def test_attack_chaotic_alignment_and_in_range(self): # Arrange name = 'NShip' type_ = 'Battle' align = 'chaotic' x_location = 3 y_location = 3 # Act ship = Ship(name, type_, x_location, y_location, align) ship._range = 10 ship._max_health = 100 ship._current_health = 90 ship._attack_power = 10 target = Battle('BattleEnemy', 'Battle', 0, 7, 'them') target._current_health = 50 ship.attack(target) print(target._current_health) print(ship._current_health) # Assert self.assertEqual(40, target._current_health)