def deal_sos_sign(): adb = AutoAdb() adb.wait('temp_images/sos/sos-signal.png').click() # 将已经开启的潜艇关卡解决掉 goto_stage_page = adb.click('temp_images/sos/goto-stage-page.png') if goto_stage_page: # 有些情况会直接进入关卡,因此不需要“点击关卡” print('发现已经开启的关卡,即将进入战斗。。。') if PageUtils.in_enemy_page(): StageFight.fight_all_enemy() else: StageFight.fight_stage(['temp_images/sos/stage-icon.png']) return True # 搜索新的信号 print('搜索新的信号。。。') adb.click('temp_images/sos/search-signal.png') while True: if adb.check('temp_images/sos/no-chance.png'): print('已经没有新的信号,SOS关卡执行完毕,脚本退出') PageUtils.to_stage_page() exit() # 如果有确认按钮,则点击确认,前往关卡 adb.click('temp_images/confirm-btn.png') # 如果已经发现了关卡按钮,则点击 click_stage = adb.click('temp_images/sos/stage-icon.png') if click_stage: print('进入SOS关卡战斗。。。') confirmed = StageFight.confirm_stage_team() if not confirmed: continue return True
def run(): StageFight.wind_up_stage_fight() adb = AutoAdb(test_device=True) temp_list = PathUtils.get_temp_rel_path_list( 'temp_images/target-stage-hard') while True: # 如果发现次数为0,则终止 if adb.click('temp_images/stage/no-chance-for-hard.png'): print('困难关卡机会已用尽,程序终止') break StageFight.fight_stage(temp_list) print('困难关卡已经结束')
def run(): # 计数 num = 0 # 最大通关次数 max_stage_fight_times = int(ConfigUtils.get('max_stage_fight_times')) # 循环战斗 while True: # 选择关卡 开始战斗 target_stage_list = PathUtils.get_temp_rel_path_list('temp_images/target-stage') StageFight.fight_stage(target_stage_list) # 计数 num += 1 print('通关次数累计:%d' % num, end='\n\n') if max_stage_fight_times is not None and num >= max_stage_fight_times: print('已达最大通关次数 %d,结束运行' % max_stage_fight_times) exit()
def run(): # 计数 fight_recorder = FightRecorder() # 最大通关次数 max_stage_fight_times = int(ConfigUtils.get('max_stage_fight_times')) # 循环战斗 while True: # 选择关卡 开始战斗 target_stage_list = PathUtils.get_temp_rel_path_list('temp_images/target-stage') fight_result = StageFight.fight_stage(target_stage_list) # 计数 fight_recorder.append(fight_result) fight_recorder.print_recorder() # 连续失败两次就停止战斗 if fight_recorder.get_last_fail_count() >= 2: print('连续 2 次关卡战斗失败, 为了避免更多损失脚本自动退出') exit() if max_stage_fight_times is not None and fight_recorder.get_total_count() >= max_stage_fight_times: print('已达最大通关次数 %d,结束运行' % max_stage_fight_times) exit()