From 6c9678cf87613881935b30ae55cf2f6571659cd5 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Wed, 18 Oct 2023 21:28:17 +0800 Subject: [PATCH] Fix: Handle blessing randomized by curio --- assets/share/rogue/ui/BLESSING_LOST.png | Bin 0 -> 5743 bytes tasks/rogue/assets/assets_rogue_ui.py | 10 ++++++++++ tasks/rogue/bleesing/curio.py | 6 +++++- tasks/rogue/bleesing/ui.py | 5 +++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 assets/share/rogue/ui/BLESSING_LOST.png diff --git a/assets/share/rogue/ui/BLESSING_LOST.png b/assets/share/rogue/ui/BLESSING_LOST.png new file mode 100644 index 0000000000000000000000000000000000000000..f8928391b27ac8883096223bc4c81702af143d7e GIT binary patch literal 5743 zcmeI0=Tj3*w8odF6e-d|kuJO{9YGPLiv*?jUZoR22qg#zB7!0iIw6EE&47X^h&1UK zx`I^cL<|^;5RrD{A8^0kxgXe>J!famhqKRbW@n!{&kXgo8R>cG0RW6T(A&lU(2$Rm z!?cv-q$Y5ef}H65p;mzaFtGjG6d)&;3jlgOPfbljLk~Z=U!aGdzo3q$rl5a-pPQ$T zD*&NW7?TjoG!m!E9Lbg0Tw`LhCd(%p2#a88ds(cCSW@B4Ufn)<{XJ2y^B?ok#T99QG*X~Z!1;8d1A~X{IM)i>5wI84a{$o-XS$h^vVj2y_ zEP!ANm=|WnGf*InL9di)FFWYv0&h&--lqrY0QexnHH1MWBUt~fqe25FD$-^kV4~~0!OoGV+qQ(c2Iy-6PBWGtEPyudM~F<8P!Y!f|D$f%xaDx3Z)^@ z4+Iq{fhIrO0F|IFRe{WC>wJZSe{2Jk0<_^W2D0vrUS)5{80HDt-ke_)T5R{J(QtxX zW^toi7S7E=i?BiQRJw!b0N~jl`E;zPio~xjFRZ%ZeTcuiijKWE{e)G7w&sqTUQkj4 z7X2aOl*7u(IF)}7#haj3?+P0*Wez;%_U*1t(-m0L4~Ok1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R4<_nc(fi!0Viw3QbPU=Q5 z8jr{+)k$4Ov{+X?FZuyj>R1>yB=;*10Xut%~3|ih+O8Um;U&6h}3)?zk`rNNo3(7Tk~Bfm7`iC zR$0#R|C7?{3r?m`G-R1=CrhgTH2$w@0R?$%bh=In{NEC|)kS`f;N*k~n3GL-ap{QZ Pzy3N}`nRh!93TG=<~QK* literal 0 HcmV?d00001 diff --git a/tasks/rogue/assets/assets_rogue_ui.py b/tasks/rogue/assets/assets_rogue_ui.py index b07e0f751..ebd887be1 100644 --- a/tasks/rogue/assets/assets_rogue_ui.py +++ b/tasks/rogue/assets/assets_rogue_ui.py @@ -23,6 +23,16 @@ BLESSING_ENHANCED = ButtonWrapper( button=(630, 351, 651, 370), ), ) +BLESSING_LOST = ButtonWrapper( + name='BLESSING_LOST', + share=Button( + file='./assets/share/rogue/ui/BLESSING_LOST.png', + area=(51, 530, 81, 552), + search=(31, 510, 101, 572), + color=(248, 248, 248), + button=(51, 530, 81, 552), + ), +) BLESSING_OBTAINED = ButtonWrapper( name='BLESSING_OBTAINED', share=Button( diff --git a/tasks/rogue/bleesing/curio.py b/tasks/rogue/bleesing/curio.py index abc97cd23..6da4868a8 100644 --- a/tasks/rogue/bleesing/curio.py +++ b/tasks/rogue/bleesing/curio.py @@ -8,7 +8,7 @@ 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 CURIO_ENFORCE, OCR_ROGUE_CURIO -from tasks.rogue.assets.assets_rogue_ui import BLESSING_CONFIRM, BLESSING_ENHANCED, BLESSING_OBTAINED +from tasks.rogue.assets.assets_rogue_ui import BLESSING_CONFIRM, BLESSING_ENHANCED, BLESSING_LOST, BLESSING_OBTAINED 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 @@ -62,6 +62,7 @@ class RogueCurioSelector(RogueSelector): Case 3: is_page_choose_blessing() Case 4: BLESSING_ENHANCED Case 5: BLESSING_OBTAINED + Case 6: BLESSING_LOST """ if self.main.is_in_main(): logger.info("Main page checked") @@ -78,6 +79,9 @@ class RogueCurioSelector(RogueSelector): if self.main.appear(BLESSING_OBTAINED): logger.info("BLESSING_OBTAINED checked") return True + if self.main.appear(BLESSING_LOST): + logger.info("BLESSING_LOST checked") + return True return False enforce = False diff --git a/tasks/rogue/bleesing/ui.py b/tasks/rogue/bleesing/ui.py index ced0b7bb9..8460aacf1 100644 --- a/tasks/rogue/bleesing/ui.py +++ b/tasks/rogue/bleesing/ui.py @@ -76,4 +76,9 @@ class RogueUI(UI): logger.info(f'{BLESSING_ENHANCED} -> {BLESSING_CONFIRM}') self.device.click(BLESSING_CONFIRM) return True + # Lost and re-obtain blessing, randomized by curio + if self.appear(BLESSING_LOST, interval=2): + logger.info(f'{BLESSING_LOST} -> {BLESSING_CONFIRM}') + self.device.click(BLESSING_CONFIRM) + return True return False