Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
1. 匹配到get_ship之后不 能成功获取舰船的bug
2. 修改change_difficult逻辑,未通关简单难度仍然能使用
  • Loading branch information
veadex committed Apr 20, 2024
1 parent d1b9933 commit 02b154e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion autowsgr/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.2.23"
__version__ = "0.2.2.24"
Binary file added autowsgr/data/images/event/20240419/2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions autowsgr/fight/event/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ def get_difficulty(self):
Returns:
简单 0,困难 1
这里同时有检查 _go_map_page 是否成功的功能
如果未能检测到难度图标,但是检测到进入活动地图,默认没有通过简单难度,返回简单 0.
"""
res = self.timer.wait_images(self.common_image["hard"] + self.common_image["easy"])
if res is None:
self.logger.error("ImageNotFoundErr", "difficulty image not found")
self.logger.error("ImageNotFoundErr: difficulty image not found")
if self.timer.wait_image(self.event_image[2]):
self.logger.info("成功进入活动页面,未检测到切换难度图标,请检查是否通关简单难度")
return 0
self.timer.log_screen()
raise ImageNotFoundErr()

Expand All @@ -55,7 +59,9 @@ def change_difficulty(self, chapter, retry=True):
if r_difficulty != difficulty:
time.sleep(0.2)
if int(chapter in "Hh"):
self.timer.click_images(self.common_image["hard"])
if not self.timer.click_images(self.common_image["hard"]):
self.logger.error("请检查是否通关简单难度")
raise ImageNotFoundErr("Can't change difficulty")
else:
self.timer.click_images(self.common_image["easy"])

Expand Down
4 changes: 2 additions & 2 deletions autowsgr/game/game_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def run(self, force=False):

def get_ship(timer: Timer, max_times=1):
"""获取掉落舰船"""
timer.wait_image(IMG.symbol_image[8])
timer.wait_image([IMG.symbol_image[8]] + [IMG.symbol_image[13]])
timer.got_ship_num += 1
while timer.wait_image(IMG.symbol_image[8], timeout=0.5):
while timer.wait_image([IMG.symbol_image[8]] + [IMG.symbol_image[13]], timeout=1):
timer.Android.click(915, 515, delay=0.25, times=1)


Expand Down

0 comments on commit 02b154e

Please sign in to comment.