Opt: Optimize bleesing imports

This commit is contained in:
LmeSzinc 2023-10-05 18:52:55 +08:00
parent b74551afd6
commit 7af080bd49
6 changed files with 11 additions and 8 deletions

View File

@ -6,14 +6,14 @@ from module.base.filter import MultiLangFilter
from module.base.timer import Timer
from module.base.utils import get_color
from module.logger import logger
from module.ocr.ocr import Ocr, OcrResultButton, DigitCounter, Digit
from module.ocr.ocr import Digit, DigitCounter, Ocr, OcrResultButton
from module.ocr.utils import split_and_pair_buttons
from tasks.rogue.assets.assets_rogue_blessing import *
from tasks.rogue.assets.assets_rogue_ui import BLESSING_CONFIRM
from tasks.rogue.keywords import *
from tasks.rogue.bleesing.preset import *
from tasks.rogue.bleesing.selector import RogueSelector
from tasks.rogue.bleesing.utils import get_regex_from_keyword_name, parse_name, is_card_selected
from tasks.rogue.bleesing.utils import get_regex_from_keyword_name, is_card_selected, parse_name
from tasks.rogue.keywords import *
# normal blessing filter
# path name
@ -133,6 +133,7 @@ class RogueBlessingSelector(RogueSelector):
if blessing_count != len(results):
logger.warning(f"The OCR result does not match the blessing count. "
f"Expect {blessing_count}, but recognized {len(results)} only.")
exit(1)
for result in results:
if result in enhanced_blessing:
result.matched_keyword.enhancement = KEYWORDS_ROGUE_ENHANCEMENT.Already_Enhanced.enhancement_keyword

View File

@ -5,10 +5,10 @@ from module.logger import logger
from module.ocr.ocr import OcrResultButton
from tasks.rogue.assets.assets_rogue_blessing import OCR_ROGUE_BUFF
from tasks.rogue.assets.assets_rogue_bonus import BONUS_BOTTOM_WHITE_BAR, BONUS_CONFIRM
from tasks.rogue.keywords import RogueBonus
from tasks.rogue.bleesing.selector import RogueSelector
from tasks.rogue.bleesing.ui import RogueBonusOcr
from tasks.rogue.bleesing.utils import is_card_selected
from tasks.rogue.keywords import RogueBonus
class RogueBonusSelector(RogueSelector):

View File

@ -7,12 +7,12 @@ from module.base.timer import Timer
from module.base.utils import get_color
from module.logger import logger
from module.ocr.ocr import Ocr, OcrResultButton
from tasks.rogue.assets.assets_rogue_curio import *
from tasks.rogue.assets.assets_rogue_curio import CURIO_ENFORCE, OCR_ROGUE_CURIO
from tasks.rogue.assets.assets_rogue_ui import BLESSING_CONFIRM
from tasks.rogue.keywords import RogueCurio
from tasks.rogue.bleesing.preset import CURIO_PRESET_1
from tasks.rogue.bleesing.selector import RogueSelector
from tasks.rogue.bleesing.utils import get_regex_from_keyword_name, parse_name
from tasks.rogue.keywords import RogueCurio
CURIO_FILTER_ATTR = tuple()
CURIO_ATTR_NAME = 'curio_name'

View File

@ -4,7 +4,7 @@ from module.base.utils import area_offset
from module.ocr.ocr import Digit, Ocr, OcrResultButton
from tasks.base.ui import UI
from tasks.rogue.assets.assets_rogue_ui import *
from tasks.rogue.keywords import *
from tasks.rogue.keywords import RoguePath
class RogueBonusOcr(Ocr):

View File

@ -252,8 +252,8 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent):
direction = self.predict_door_by_name(self.device.image)
direction_limit = 55
if direction is not None:
logger.warning(f'Unexpected direction to go: {direction}, limited in {direction_limit}')
if abs(direction) > direction_limit:
logger.warning(f'Unexpected direction to go: {direction}, limited in {direction_limit}')
if direction > 0:
direction = direction_limit
elif direction < 0:

View File

@ -200,6 +200,8 @@ class RogueExit(CombatInteract):
logger.warning('Found multiple doors but has unique domain in it')
logger.info(f'Goto next domain: {domain}')
return direction
logger.attr('DomainStrategy', self.config.RoguePath_DomainStrategy)
if self.config.RoguePath_DomainStrategy == 'leave':
for expect in [
KEYWORDS_MAP_PLANE.Rogue_DomainTransaction,