def change_servant(self, org: int, tar: int): while not util.standby("images/order_change.png"): print("[M_Skill] Waiting for order change") time.sleep(0.2) pos = self.cfg['servent']['s%s', org] pos = pos.split(',') util.list_tap(pos) time.sleep(0.1) pos = self.cfg['servent']['a%s', tar] pos = pos.split(',') util.list_tap(pos) time.sleep(0.1) util.tap(650, 620) # confirm btn
def select_servant_skill(self, skill: int, tar: int = 0): while not util.standby("images/attack.png"): print("[BATTLE] Waiting for Attack button", end="\r") time.sleep(1) pos = self.cfg['skills']['%s' % skill] pos = pos.split(',') util.tap(pos[0], pos[1]) if tar != 0: print("[Skill] Use servent", str(int((skill-1)/3 + 1)), "skill", str((skill-1) % 3 + 1), "to servent", tar) time.sleep(1) self.select_servant(tar) else: print("[Skill] Use servent", str(int((skill-1)/3 + 1)), "skill", str((skill-1) % 3 + 1)) time.sleep(1)
def select_task(self, ckp: str): print("[INFO] Waiting Task selected") while not util.standby(self.checkpoint): time.sleep(0.2) util.tap(1100, 170) time.sleep(1) if util.standby("images/noap.png"): print("[INFO] Out of AP!") if self.counts > 0: self.counts -= 1 self.eat_apple() elif self.counts == -1: util.tap(635, 610) self.wait_ap(self.timer) self.select_task(self.checkpoint) else: print("[INFO] Out of appale count") raise Exception("[INFO]Out of AP!") print("[INFO] Task selected.")
def finish_battle(self): while not util.standby("images/next.png"): print("[FINISH] Waiting next button") util.tap(920, 45) self.needattack() time.sleep(0.2) util.tap(1105, 670) flag = 0 while not util.standby(self.checkpoint): if flag == 0 and util.standby("images/friendrequest.png"): print("[FINISH] Check friend request screen") util.tap(330, 610) print("[FINISH] Reject friend request") flag = 1 elif flag == 1: util.tap(920, 45) else: util.tap(920, 45) time.sleep(1) print("[INFO] Battle Finished.")
def eat_apple(self): print("[INFO]Select apple:", end='') if self.apple == 'au': print("Au") util.tap(375, 320) elif self.apple == 'ag': print("Ag") util.tap(375, 470) elif self.apple == 'sq': print("Sq") util.tap(375, 170) time.sleep(0.2) util.tap(830, 560) print("[INFO] Remain apple counts:", self.counts)
def update_support(self): if util.standby("images/update.png"): util.tap(835, 125) time.sleep(0.5) if util.standby("images/close.png"): util.tap(640, 560) print("[INFO] Wait to refresh friend list") time.sleep(2) else: util.tap(840, 560) print("[INFO] friend list refresh") time.sleep(0.5)
def waiting_phase(self, phase: int): if phase == 1: while not util.standby("images/phase1.png", 0.78): util.tap(920, 45) if self.debug: print("Waiting for phase1") time.sleep(0.2) elif phase == 2: while not util.standby("images/phase2.png", 0.78): util.tap(920, 45) if self.debug: print("Waiting for phase2") self.needattack() time.sleep(0.2) elif phase == 3: while not util.standby("images/phase3.png", 0.78): util.tap(920, 45) if self.debug: print("Waiting for phase3") self.needattack() time.sleep(0.2)
def tap(self, crd: (int, int), i: int = 10, j: int = 10): x = crd[0] + self.shifts[0] y = crd[1] + self.shifts[1] util.tap(util.shifter((x, y), i, j))
def start_battle(self): while not util.standby("images/start.png"): time.sleep(0.2) util.tap(1180, 670) print("[INFO] Battle started.")