Skip to content

Commit

Permalink
fix switching level
Browse files Browse the repository at this point in the history
  • Loading branch information
fga401 committed Apr 3, 2023
1 parent 0779690 commit 7c6e4b6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tableturf/manager/tableturf.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ def run(self, profile: Profile, closer: Closer = None, debug=False):
self.run_once(task.deck, closer=task_closer, debug=debug)
if closer.close(self.job_stats):
return
self.__switch_level()
current_level += 1
current_win = 0
self.__switch_level()
if current_level == task.target_level:
to_win = task.target_win - current_win
if to_win > 0:
Expand Down Expand Up @@ -310,7 +310,7 @@ def __close(self, close: bool):
self.__controller.press_buttons([Controller.Button.A])
target = 0 if close else 1
count = 0
while True:
for i in range(101):
current = self.__multi_detect(detection.replay_cursor)(debug=self.__session['debug'])
if current == target:
break
Expand All @@ -330,11 +330,14 @@ def __start(self):
while not self.__multi_detect(detection.level)(debug=self.__session['debug']):
self.__controller.press_buttons([Controller.Button.A])
sleep(2)
self.__controller.press_buttons([Controller.Button.DPAD_RIGHT])
self.__controller.press_buttons([Controller.Button.DPAD_RIGHT])
while not self.__multi_detect(detection.start)(debug=self.__session['debug']):
self.__controller.press_buttons([Controller.Button.DPAD_DOWN])
sleep(0.5)
self.__controller.press_buttons([Controller.Button.A])
self.__controller.press_buttons([Controller.Button.A]) # in case command is lost
sleep(2)
# while self.__multi_detect(detection.deck_cursor)(debug=self.__session['debug']) == -1:
# self.__controller.press_buttons([Controller.Button.A])
# sleep(0.5)
Expand All @@ -344,11 +347,14 @@ def __switch_level(self):
while not self.__multi_detect(detection.level)(debug=self.__session['debug']):
self.__controller.press_buttons([Controller.Button.A])
sleep(2)
self.__controller.press_buttons([Controller.Button.DPAD_RIGHT])
self.__controller.press_buttons([Controller.Button.DPAD_RIGHT])
while not self.__multi_detect(detection.start)(debug=self.__session['debug']):
self.__controller.press_buttons([Controller.Button.DPAD_DOWN])
sleep(0.5)
self.__controller.press_buttons([Controller.Button.A])
self.__controller.press_buttons([Controller.Button.A]) # in case command is lost
sleep(2)
# while self.__multi_detect(detection.deck_cursor)(debug=self.__session['debug']) == -1:
# self.__controller.press_buttons([Controller.Button.A])
# sleep(0.5)
Expand Down

0 comments on commit 7c6e4b6

Please sign in to comment.