Exemple #1
0
def fight_tester():
    captures = os.listdir(CAPTURES_DIR)
    get_fight_num = lambda f: re.match('\d+', f).group()
    fight_nums = list({get_fight_num(f) for f in captures})
    fight_nums.sort(key=lambda n: int(n))
    # n = fight_nums[int(random.random() * len(fight_nums))]
    # n = '0001'
    modes = {}
    for i, n in enumerate(fight_nums[16:]):
        print(f'{"*" * 80}\n{n}')
        card_screen = Image.open(
            os.path.join(CAPTURES_DIR, n + '.2.LOBBY_CARDS.png'))
        fight_start_screen = Image.open(
            os.path.join(CAPTURES_DIR, n + '.3.FIGHT_START.png'))
        # fight_end_screen = Image.open(os.path.join(CAPTURES_DIR, n + '.4.FIGHT_END.png'))
        # try:
        #     fight_results_screen = Image.open(os.path.join(CAPTURES_DIR, n + '.5.FIGHT_RESULTS_SOLO.png'))
        # except FileNotFoundError:
        #     fight_results_screen = Image.open(os.path.join(CAPTURES_DIR, n + '.5.FIGHT_RESULTS_TEAM.png'))

        game = smash_game.Game(1)
        game.read_card_screen(card_screen)
        if game.mode in modes:
            modes[game.mode].append(i)
        else:
            modes[game.mode] = [i]
        break
    for mode in modes:
        print(f'{mode}: {modes[mode]}')
        game.read_start_screen(fight_start_screen)
        print(game.serialize(images_bool=False))
Exemple #2
0
def game_color():
    game = smash_game.Game()
    game.player_count = 4
    img = Image.open(os.path.join('captures', '0001.3.FIGHT_START.png'))
    for edge in ut.COORDS['GAME']['PLAYER']['INFO'][game.player_count]:
        color_coords = list(ut.COORDS['GAME']['PLAYER']['COLOR'])
        color_coords[0] = edge - color_coords[0]
        color_coords[2] = edge - color_coords[2]
        crop = img.crop(color_coords)
        print(ut.match_color(pixel=crop, mode='GAME'))
Exemple #3
0
def crop_char_game():
    cap = ut.capture_screen()
    game = smash_game.Game(1)
    game.player_count = 3
    name_images = game.get_character_name_game(cap)
    for img in name_images:
        bw, _ = ut.convert_to_bw(img)
        name_as_read = ut.read_image(bw).lower()
        name = difflib.get_close_matches(name_as_read,
                                         smash_game.CHARACTER_NAMES,
                                         n=1)
        print(name)
 def reset(self):
     if not self.locked:
         self.current_type_index = 0
     self.list_limit = 3
     self.sim_lists = [[0] * self.list_limit
                       for _ in range(len(self.id_coords))]
     self.cont = True
     self.current_game_num = len(ut.load_game_data()) + 1
     self.game = smash_game.Game(self.current_game_num)
     self.timer_detected = False
     self.timer_visible = False
     self.timer_running = False
     self.timer_running_templates = (None, None)
     self.timer_sim_hits = 0
Exemple #5
0
def crop_char_lobby():
    cap = ut.capture_screen()
    game = smash_game.Game(1)
    game.player_count = 4
    game.read_cards(cap)