예제 #1
0
def training():
    lst = png_lst(cfg_path)
    for file in lst:
        name, ext = os.path.splitext(file)
        if 'train' in name:
            split_in_battle(cfg_path + f'/{file}')
            crd = Card()
            crd.servant_logo()
예제 #2
0
    def servant_num(self):
        num = 0

        lst = png_lst(cfg_path)  # list all files in this folder
        lst.sort()

        for pic_file in lst:
            name, extension = os.path.splitext(pic_file)
            num += int('servant' in name)

        return num
예제 #3
0
def match_item(img, item):
    # item = 'support'
    lst = png_lst(support_path)

    res = 0
    for file in lst:
        if item in file:
            fimg = cv2.imread(f'{support_path}/{file}', 0)
            if analyze(img, fimg):
                res = 1

    return res
예제 #4
0
    def init_parm(self):

        lst = png_lst('./db/d-materials/')
        self.items_parm1_materials = []
        for file in lst:
            name, ext = os.path.splitext(file)
            self.items_parm1_materials.append(name)
        self.items_parm1_materials.sort()
        # print(self.items_parm1_materials)
        # exit()


        # 菜单选项
        self.items_parm1_mode = [
            ('普通', 0),
            ('材料', 1),
            ('苹果', 2),
        ]

        self.items_parm1_apple = ['金苹果', '银苹果']

        self.items_parm2_servant = ['跳过', '自定义', '孔明', '梅林']
        self.items_parm2_skill = ['跳过', '自定义']
        self.items_parm2_craft = ['跳过', '自定义', '午餐']
        self.items_parm2_craft_mode = ['满破', '满破/未满破', '满破/未满破/无']

        self.items_parm3_unit = [
            ('ROUND', 0),
            ('TURN', 1)
        ]

        # 1 运行模式
        # 2 助战选择
        # 3 战斗选择

        # 默认值
        self.parm1_mode = 0
        self.parm1_apple = '银苹果'
        self.parm1_times = 1

        self.parm2_servant = '跳过'
        self.parm2_skill = '跳过'
        self.parm2_craft = '跳过'
        self.parm2_craft_mode = '满破/未满破/无'
        self.parm2_refresh = 1
        self.parm2_rank = '0'

        self.parm3_skill = ''
        self.parm3_final = ''
        self.parm3_unit = 'round'
        self.parm3_chain = '1'
        self.parm3_speed = 1
예제 #5
0
def infinity_pool():

    psn = PSN()
    path = './lib/func/infinity_pool'

    psn.INFI_M1()
    time.sleep(1)
    lst = png_lst(path)

    while 1:
        screenshot()
        for file in lst:
            # thd = 0.85
            flg = picture_tap(path + '/' + file)
            if flg == 1:
                print(file)
                break
예제 #6
0
def cp_cfg_2_lib():
    """
    将 cfg 中 task/material/support/craft/skill 等需要拷贝的文件,拷贝到对应的路径
    :return:
    """
    # TODO:add servant,craft,skill to lib
    # supportx.png/craftx.png -> support_path
    lst = png_lst(cfg_path)
    for file in lst:
        name, ext = os.path.splitext(file)
        if 'task' in name:
            shutil.copyfile(cfg_path + f'/{file}', task_path + f'/{file}')
            shutil.copyfile(cfg_path + f'/{file}', scenes_path + f'/{file}')
        elif 'material' in name:
            shutil.copyfile(cfg_path + f'/{file}', win_path + f'/{file}')
        elif 'servant' in name or 'skill' in name or 'craft' in name or 'manpo' in name:
            shutil.copyfile(cfg_path + f'/{file}', support_path + f'/{file}')
예제 #7
0
def withdrawn():
    lst = png_lst(fail_path)
    for file in lst:
        # thd = 0.85
        picture_tap(fail_path + '/' + file)
예제 #8
0
def attack():
    
    if not rd_tmp_ini('battle', 'round'):
        wt_tmp_ini('battle', 'round', 0)
    
    if not rd_tmp_ini('battle', 'turn'):
        wt_tmp_ini('battle', 'turn', 0)

    lst = png_lst(cfg_path)
    svt_priority = get_cfg('priority', 'servant')
    for file in lst:
        # name, ext = os.path.splitext(file)
        if 'servant' in file and not svt_priority:
            os.remove(cfg_path + '/' + file)

    # 获取 skill 和 final ..并转换为新的变量
    if not rd_tmp_ini('battle', 'skill_list'):
        wt_tmp_ini('battle', 'skill_list', cfgstr2lst(skill_string_trans(get_cfg('skill', 'value'))))
    if not rd_tmp_ini('battle', 'ultimate_list'):
        wt_tmp_ini('battle', 'ultimate_list', cfgstr2lst(get_cfg('ultimate', 'value')))

    
    psn = PSN()

    # 获取当前 round 数
    round = curr_round()

    # 获取当前回合数,并更新, +=1 是因为文件内是从 0 开始计算的,需要转换一下
    turn = int(rd_tmp_ini('battle', 'turn'))
    turn += 1
    wt_tmp_ini('battle', 'turn', turn)

    sys_log('current @ round : %1d, turn : %-2d' % (round, turn))

    # 获取 turn / round 参数
    op_unit = get_cfg('skill', 'unit')  # round / turn
    if op_unit == 'round':
        td_idx = round  # turn_round_idx
    else:
        td_idx = turn

    # 获取设定某些回合技能输入 20201117
    skill_lst = eval(rd_tmp_ini('battle', 'skill_list'))
    if td_idx <= len(skill_lst):
        turn_skill(skill_lst[td_idx - 1])
        skill_lst[td_idx - 1] = ''
        wt_tmp_ini('battle', 'skill_list', skill_lst)

    # 点击 ATTACK 按钮,更新截图
    psn.ATK()
    time.sleep(1)
    screenshot()

    # 获取指令卡属性
    cards_attr = turn_attribute()
    cards_sort = turn_sorted(cards_attr)

    # 这里可以控制前面的输出来进行简化
    ultimate_list = eval(rd_tmp_ini('battle', 'ultimate_list'))
    if td_idx <= len(ultimate_list):
        ins = ultimate_list[td_idx - 1].upper()
    else:
        ins = ''

    if td_idx <= len(ultimate_list) and ins != 'XXX' and ins != '':
        lst = tap_crd(cards_sort, 2)
        idx = 0
        for char in ins:
            if char == 'X':
                crd = lst[idx]
                tap(crd.px, crd.py)
                time.sleep(1)
                idx += 1
            else:
                eval('psn.E%s()' % char)
                ultimate_list[td_idx - 1] = ''
                wt_tmp_ini('battle', 'ultimate_list', ultimate_list)
    else:
        lst = tap_crd(cards_sort, 3)
        for crd in lst:
            tap(crd.px, crd.py)
            time.sleep(1)