def get_magic_shield_status(self) -> str:
        for name in MAGIC_SHIELD_SPEC:
            specs = []
            if isinstance(MAGIC_SHIELD_SPEC[name][0], list):
                specs = [spec(*_spec) for _spec in MAGIC_SHIELD_SPEC[name]]
            else:
                specs = spec(*MAGIC_SHIELD_SPEC[name])

            if self.matches_screen(MAGIC_SHIELD_COORDS, specs):
                return name
        # There are only 3 possible states: recently cast, off cooldown and
        # on cooldown.
        return MagicShieldStatus.ON_COOLDOWN
 def test_can_get_unknown_action_ring_by_spec(self):
     # given
     action_spec = color_spec.spec("1", "1", "1", "1")
     # when
     name = color_spec.RING_REPOSITORY.get_action_name(action_spec)
     # then
     self.assertEqual(color_spec.RingName.UNKNOWN, name)
 def test_can_get_unknown_action_amulet_by_spec(self):
     # given
     action_spec = color_spec.spec("1", "1", "1", "1")
     # when
     name = color_spec.AMULET_REPOSITORY.get_action_name(action_spec)
     # then
     self.assertEqual(color_spec.AmuletName.UNKNOWN, name)
 def test_can_get_unknown_equipped_ring_by_spec(self):
     # given
     eq_spec = color_spec.spec("1", "1", "1", "1")
     # when
     name = color_spec.RING_REPOSITORY.get_equipment_name(eq_spec)
     # then
     self.assertEqual(color_spec.AmuletName.UNKNOWN, name)
 def get_equipped_ring_name(self) -> RingName:
     color_spec = spec(*self.get_pixels(EQUIPPED_RING_COORDS))
     return RING_REPOSITORY.get_equipment_name(color_spec)
 def get_emergency_action_bar_ring_name(self) -> RingName:
     color_spec = spec(*self.get_pixels(EMERGENCY_ACTION_BAR_RING_COORDS))
     return RING_REPOSITORY.get_action_name(color_spec)
 def get_equipped_amulet_name(self) -> AmuletName:
     color_spec = spec(*self.get_pixels(EQUIPPED_AMULET_COORDS))
     return AMULET_REPOSITORY.get_equipment_name(color_spec)
 def get_emergency_action_bar_amulet_name(self) -> AmuletName:
     color_spec = spec(*self.get_pixels(EMERGENCY_ACTION_BAR_AMULET_COORDS))
     return AMULET_REPOSITORY.get_action_name(color_spec)