예제 #1
0
 def on_key_action(self):
     if self.selected == 0:
         sound_manager.start_in_first_empty_taunt(pygame.mixer.Sound(sounds.SAVE.path))
         game.get_game_instance().save()
         self.player.close_menu()
     else:
         self.player.open_menu(MainMenu(self.player))
예제 #2
0
    def render(self, display):
        if time.time() - self.open_time < 0.2:
            display.fill((255, 255, 255))
        else:
            display.fill((55, 193, 193))
            pygame.draw.polygon(display, (225, 223, 234), s_poly_1)
            pygame.draw.polygon(display, (51, 171, 169), s_poly_2)

            display.blit(self.cat_image, (10, 10))
            display.blit(game.FONT_BOLD_58.render(
                game.get_game_instance().get_message("save").upper(), True, (0, 0, 0)), (74, 10))

            _x = SURFACE_SIZE[0] * 0.55
            _y = SURFACE_SIZE[1] * 0.38

            for i in range(4):
                display.blit(self.text_2[i], (_x, _y))
                _y += SURFACE_SIZE[1] * 0.07

            _x = SURFACE_SIZE[0] * 0.76
            _y = SURFACE_SIZE[1] * 0.38

            time_f = game.FONT_16.render(str(datetime.fromtimestamp(time.time()).strftime('%d/%m/%y %H:%M')), True,
                                         (0, 0, 0))
            display.blit(time_f, (_x, _y))
            _y += SURFACE_SIZE[1] * 0.07
            display.blit(game.FONT_16.render(game.get_game_instance().level.get_translate_name(), True, (0, 0, 0)),
                         (_x, _y))
            _y += SURFACE_SIZE[1] * 0.07
            display.blit(self.time_play, (_x, _y))
            _y += SURFACE_SIZE[1] * 0.07
            display.blit(self.pokedex, (_x, _y))

            display.blit(self.last_save_f, (SURFACE_SIZE[0] * 0.85 - self.last_save_size, SURFACE_SIZE[1] * 0.95))
            display.blit(self.last_save, (SURFACE_SIZE[0] * 0.86, SURFACE_SIZE[1] * 0.95))

            _x = SURFACE_SIZE[0] * 0.6
            _y = SURFACE_SIZE[1] * 0.75

            for i in range(2):

                color = (0, 0, 0) if self.selected == i else (255, 255, 255)
                tex_color = (255, 255, 255) if self.selected == i else (0, 0, 0)
                pygame.draw.circle(display, color, (_x + 10, _y + SURFACE_SIZE[1] * 0.025), SURFACE_SIZE[1] * 0.025)
                pygame.draw.circle(display, color, (_x + 10 + SURFACE_SIZE[0] * 0.3, _y + SURFACE_SIZE[1] * 0.025),
                                   SURFACE_SIZE[1] * 0.025)
                pygame.draw.rect(display, color,
                                 pygame.Rect(_x + 10, _y, SURFACE_SIZE[0] * 0.3, SURFACE_SIZE[1] * 0.05))

                t_i = game.FONT_16.render(self.text[i], True, tex_color)
                x_min = (len(self.text[i]) / 2) * game.FONT_SIZE_16[0]
                display.blit(t_i, (_x + 10 + (SURFACE_SIZE[0] * 0.3) / 2 - x_min, _y + 6))

                if self.selected == i:
                    display.blit(self.arrow, (_x - 10, _y))
                _y += SURFACE_SIZE[1] * 0.07
예제 #3
0
파일: pokedex.py 프로젝트: Kyrokx/PygaMone
    def __init__(self, player, selected):
        super().__init__(player)
        self.selected = selected

        self.keys = {
            game.get_game_instance().get_message("back"): option.KEY_QUITE,
            game.get_game_instance().get_message("previous"): option.KEY_FORWARDS,
            game.get_game_instance().get_message("next"): option.KEY_BACK,
            game.get_game_instance().get_message("cry"): option.KEY_ACTION
        }
        self.white_pokeball = utils.change_image_color(utils.GRAY_POKEBALL.copy(), (255, 255, 255))
        self.play_sound()
예제 #4
0
    def __init__(self, player: 'Player', call_back: Callable[[bool, int], NoReturn], is_death: bool = False):
        super().__init__(player)
        self.is_death = is_death
        self.call_back = call_back
        self.selected = 0
        self.action_selected = -1

        # self.arrow = utils.get_part_i(MENU_IMAGE, (0, 64, 22, 91), (33, 41))
        self.arrow = utils.ARROW
        self.open_time = utils.current_milli_time()
        self.text_2 = [(game.FONT_20.render(game.get_game_instance().get_message(t), True, (0, 0, 0)),
                        game.FONT_20.render(game.get_game_instance().get_message(t), True, (255, 255, 255)))
                       for t in (["use", "back"] if is_death else ["use", "heal", "back"])]
예제 #5
0
파일: pokedex.py 프로젝트: Kyrokx/PygaMone
    def __init__(self, player, selected=0):
        super().__init__(player)
        self.selected = selected

        self.arrow = utils.ARROW
        self.nb_caught = sum(map(game.POKEDEX_CATCH.__eq__, game.get_game_instance().get_pokedex_catch_status_values()))
        self.nb_saw = sum(map(game.POKEDEX_SEEN.__eq__, game.get_game_instance().get_pokedex_catch_status_values()))
        self.black_pokeball = utils.change_image_color(utils.GRAY_POKEBALL.copy(), (0, 0, 0))
        self.white_pokeball = utils.change_image_color(utils.GRAY_POKEBALL.copy(), (255, 255, 255))
        self.light_orange_point = utils.change_image_color(utils.POINT_POKEBALL.copy(), (199, 90, 57))

        self.keys = {
            game.get_game_instance().get_message("back"): option.KEY_QUITE,
            game.get_game_instance().get_message("information"): option.KEY_ACTION
        }
예제 #6
0
    def __init__(self, player,
                 white_list_category: tuple = (),
                 sort: int = SORT_NONE,
                 target: Optional['player_pokemon.PlayerPokemon'] = None,
                 condition: int = CONDITION_NORMAL,
                 use_callback: Optional[Callable[['item.Item', 'player_pokemon.PlayerPokemon'], NoReturn]] = None
                 ):
        super().__init__(player)
        self.use_callback = use_callback
        self.condition = condition
        self.target = target
        self.sort = sort
        self.cat_image = utils.color_image(utils.get_part_i(utils.MENU_IMAGE, (64, 0, 128, 64)), (0, 0, 0, 255))

        if len(white_list_category) > 0:
            black_list_category = item.CATEGORY.copy()
            for e in white_list_category:
                black_list_category.remove(e)
        else:
            black_list_category = ()
        self.black_list_category = black_list_category
        self.open_time = utils.current_milli_time()
        self.keys = {
            game.get_game_instance().get_message("back"): option.KEY_QUITE,
            game.get_game_instance().get_message("sort"): option.KEY_BIKE,
            game.get_game_instance().get_message("select"): option.KEY_ACTION
        }
        self.action_selected = -1
        self.nb_action = 0
        self.category_select = 0
        self.item_selected = 0
        self.poke_select = -1
        self.categories_surface = []
        for a in range(2):
            line = []
            for i in range(len(item.CATEGORY)):
                if item.CATEGORY[i] not in black_list_category:
                    line.append(utils.get_part_i(utils.MENU_IMAGE, (i * 32, 128 + a * 32, i * 32 + 32, 160 + a * 32)))
            self.categories_surface.append(line)
        self.categories = item.CATEGORY.copy()
        for i in black_list_category:
            self.categories.remove(i)
        self.items: list[tuple[item.Item, int]] = []
        self.set_items()

        self.box_text = [(game.FONT_20.render(game.get_game_instance().get_message(t), True, (0, 0, 0)),
                          game.FONT_20.render(game.get_game_instance().get_message(t), True, (255, 255, 255)))
                         for t in ["give", "use", "back"]]
예제 #7
0
    def __init__(self, player):
        super().__init__(player)

        self.selected = 0
        self.action_selected = -1
        self.move = -1
        self.keys = {
            game.get_game_instance().get_message("back"): option.KEY_QUITE,
            game.get_game_instance().get_message("move_pokemon"):
            option.KEY_BIKE,
            game.get_game_instance().get_message("select"): option.KEY_ACTION
        }
        # self.arrow = utils.get_part_i(MENU_IMAGE, (0, 64, 22, 91), (33, 41))
        self.arrow = utils.ARROW
        self.open_time = utils.current_milli_time()
        self.progress = []
        self.display_small = []
        self.display_large = []
        self.text = []
        self.poke_ball = []
        self.text_2 = [
            (game.FONT_20.render(game.get_game_instance().get_message(t), True,
                                 (0, 0, 0)),
             game.FONT_20.render(game.get_game_instance().get_message(t), True,
                                 (255, 255, 255)))
            for t in ["summary", "move", "heal", "object", "back"]
        ]
        for poke in self.player.team:
            if not poke:
                break
            heal = poke.heal, poke.get_max_heal()
            self.progress.append(heal)
            self.display_small.append(poke.get_front_image(0.5))
            self.display_large.append(poke.get_front_image(4))
            self.text.append([
                game.FONT_16.render("{}/{}".format(heal[0], heal[1]), True,
                                    (0, 0, 0)),
                game.FONT_16.render("{}/{}".format(heal[0], heal[1]), True,
                                    (255, 255, 255)),
                game.FONT_24.render("N.{}".format(poke.lvl), True, (0, 0, 0)),
                game.FONT_24.render("N.{}".format(poke.lvl), True,
                                    (255, 255, 255)),
                game.FONT_20.render(poke.get_name(True), True, (0, 0, 0)),
                game.FONT_20.render(poke.get_name(True), True,
                                    (255, 255, 255)),
            ])
            self.poke_ball.append(
                pygame.transform.scale(poke.poke_ball.image, (16, 16)))
예제 #8
0
def draw_button_info(surface: pygame.Surface, **keys):
    pygame.draw.polygon(surface, "#000000",
                        ((0, 570), (1060, 570), (1060, 600), (0, 600)))
    x = 1040
    h = 30
    c_y = 600 - h / 2
    y = int(c_y - game.FONT_SIZE_20[1] / 2)
    is_board = game.get_game_instance(
    ).last_input_type == game.INPUT_TYPE_KEYBOARD == 0
    for name, key in keys.items():
        key_char = (pygame.key.name(key[0])
                    if is_board else GAMEPAD_KEYS[key[2]]).upper()
        txt = game.FONT_20.render(name, True, (255, 255, 255))
        x -= txt.get_size()[0]
        surface.blit(txt, (x, y))
        mt_char = len(key_char) > 1
        font = game.FONT_20 if mt_char else game.FONT_24
        key = font.render(key_char, True, (0, 0, 0))
        size = key.get_size()
        if mt_char:
            w = size[0]
            x -= w + 15
            draw_rond_rectangle(surface, x, 600 - h + 4, h - 8, w,
                                (255, 255, 255))
            surface.blit(key, (x, y))
            x -= 20
        else:
            x -= h // 2 + 2
            pygame.draw.circle(surface, (255, 255, 255), (x, c_y), h // 2 - 2)
            surface.blit(key, (x - size[0] // 2, c_y - size[1] // 2))
            x -= h // 2 + 2
예제 #9
0
 def __init__(self, player):
     super().__init__(player)
     coord = ((320, 0, 684, 64), (0, 0, 64, 64), (64, 0, 128, 64),
              (256, 0, 320, 64), (128, 0, 195, 64), (192, 0, 256, 64))
     self.image = [utils.get_part_i(utils.MENU_IMAGE, c) for c in coord]
     # self.arrow = utils.get_part_i(MENU_IMAGE, (0, 64, 22, 91))
     self.arrow = utils.ARROW
     self.selected = 0
     self.text = [
         game.get_game_instance().get_message(t).upper()
         for t in ["pokedex", "pokemon", "bag", "map", "save", "options"]
     ]
     self.keys = {
         game.get_game_instance().get_message("back"): option.KEY_QUITE,
         game.get_game_instance().get_message("save"): option.KEY_BIKE,
         game.get_game_instance().get_message("select"): option.KEY_ACTION
     }
예제 #10
0
파일: menu.py 프로젝트: Rix565/PygaMone
    def __init__(self, player,
                 escape_call_back: Optional[Callable[[], NoReturn]] = None,
                 choice_call_back: Optional[Callable[[int], NoReturn]] = None
                 ):
        super().__init__(player)

        self.escape_call_back = escape_call_back
        self.choice_call_back = choice_call_back
        self.selected = 0
        self.action_type = 0
        self.action_selected = -1
        self.move = -1
        self.keys = {
            game.get_game_instance().get_message("back"): option.KEY_QUITE,
            game.get_game_instance().get_message("move_pokemon"): option.KEY_BIKE,
            game.get_game_instance().get_message("select"): option.KEY_ACTION
        }
        self.arrow = utils.ARROW
        self.open_time = utils.current_milli_time()
        self.text_2 = [(game.FONT_20.render(game.get_game_instance().get_message(t), True, (0, 0, 0)),
                        game.FONT_20.render(game.get_game_instance().get_message(t), True, (255, 255, 255)))
                       for t in ["summary", "move", "heal", "object", "back"]]
        self.box_object = [(game.FONT_20.render(game.get_game_instance().get_message(t), True, (0, 0, 0)),
                            game.FONT_20.render(game.get_game_instance().get_message(t), True, (255, 255, 255)))
                           for t in ["open_bag", "put_in_bag", "back"]]
        self.cat_image = utils.color_image(utils.get_part_i(utils.MENU_IMAGE, (0, 0, 64, 64)), (0, 0, 0, 255))
예제 #11
0
    def __init__(self, player, poke_n: int):
        super().__init__(player)
        self.poke_n = poke_n
        # self.display_large = None
        self.get_data()
        self.text = [game.FONT_20.render(game.get_game_instance().get_message(m) + ":", True, (0, 0, 0)) for m in
                     ["name", "type", "xp_point", "next_level"]]

        self.text_width = [t.get_rect().size[0] * 0.5 for t in self.text]
예제 #12
0
 def __init__(self, player, poke: 'player_pokemon.PlayerPokemon',
              new_ab: str, callback: Callable[[int], NoReturn]):
     super().__init__(player)
     self.callback = callback
     self.__new_ab: str = new_ab
     self.__ab: 'player_pokemon.PokemonAbility' = player_pokemon.PokemonAbility.new_ability(
         new_ab)
     self.__keys = {
         game.get_game_instance().get_message("back"): option.KEY_QUITE,
         game.get_game_instance().get_message("validate"): option.KEY_ACTION
     }
     self.__poke = poke
     self.selected = 0
     self.__on_question = 0
     self.__ask = [
         game.game_instance.get_message("yes"),
         game.game_instance.get_message("no")
     ]
예제 #13
0
    def render(self, display):
        display.fill((255, 255, 255))
        pygame.draw.polygon(display, (241, 65, 78), TeamMenu.t_poly_1)
        pygame.draw.polygon(display, (206, 51, 65), TeamMenu.t_poly_2)
        pygame.draw.rect(display, (0, 0, 0), (0, 570, 1060, 30))
        display.blit(self.cat_image, (10, 10))
        display.blit(game.FONT_BOLD_58.render(
            game.get_game_instance().get_message("team").upper(), True, (0, 0, 0)), (74, 10))

        g_x = SURFACE_SIZE[0] * 0.1
        g_y = 70

        _time = utils.current_milli_time() - self.open_time
        part_time = _time % 2000
        poke_y = 0
        if part_time < 900:
            poke_y = 0
        elif part_time < 950 or 1950 <= part_time:
            poke_y = 1
        elif part_time < 1000 or 1900 <= part_time:
            poke_y = 3
        elif part_time < 1900:
            poke_y = 5

        for i in range(self.player.get_non_null_team_number()):

            if self.move != i:
                color = (0, 0, 0) if self.selected == i else (255, 255, 255)
                text_color = (0, 0, 0) if self.selected != i else (255, 255, 255)
                utils.draw_pokemon(display, self.player.team[i], (int(g_x), int(g_y)),
                                   poke_y, color=color, text_color=text_color)
            g_y += 80

        # draw move
        if self.move != -1:
            color = (0, 0, 0) if self.selected == self.move else (255, 255, 255)
            text_color = (0, 0, 0) if self.selected != self.move else (255, 255, 255)
            utils.draw_pokemon(display, self.player.team[self.move], (int(g_x + SURFACE_SIZE[0] * 0.04),
                                                                      int(self.selected * SURFACE_SIZE[1] * 0.15 +
                                                                          SURFACE_SIZE[1] * 0.05)), poke_y,
                               color=color, text_color=text_color)

        select = self.player.team[self.selected]
        if select:
            display.blit(select.get_front_image(4), (SURFACE_SIZE[0] * 0.5, SURFACE_SIZE[1] * 0.2))

        # action hud
        if self.action_selected != -1:
            _y = (-35 if self.selected == 5 else 40) + SURFACE_SIZE[1] * 0.15 * self.selected
            _x = SURFACE_SIZE[0] * 0.31
            if self.action_type == 0:
                utils.draw_select_box(display, _x, _y, self.text_2, self.action_selected, 100)
            else:
                utils.draw_select_box(display, _x, _y, self.box_object, self.action_selected, 100)

        utils.draw_button_info(display, **self.keys)
예제 #14
0
파일: pokedex.py 프로젝트: Kyrokx/PygaMone
    def on_key_y(self, value: float, press: bool) -> NoReturn:
        if press and value < 0 and self.selected > 0:
            v = self.selected
            while v > 0:
                v -= 1
                if game.get_game_instance().get_pokedex_status(v + 1) != game.POKEDEX_NEVER_SEEN:
                    self.selected = v
                    sound_manager.start_in_first_empty_taunt(sounds.PLINK_2)
                    self.play_sound()
                    break

        elif press and value > 0 and self.selected < pokemon.NB_POKEMON - 1:
            v = self.selected
            while v < pokemon.NB_POKEMON - 1:
                v += 1
                if game.get_game_instance().get_pokedex_status(v + 1) != game.POKEDEX_NEVER_SEEN:
                    self.selected = v
                    sound_manager.start_in_first_empty_taunt(sounds.PLINK_2)
                    self.play_sound()
                    break
예제 #15
0
파일: pc_hud.py 프로젝트: Kyrokx/PygaMone
 def __init__(self, player_):
     super().__init__(player_)
     self.box = 0
     self.selected = [0, 0]  # x [-1: 5] y [0: 5]
     self.move = [-2, -2]
     self.move_box = 0
     self.keys = {
         game.get_game_instance().get_message("back"): option.KEY_QUITE,
         game.get_game_instance().get_message("box_next"):
         option.KEY_MENU_RIGHT,
         game.get_game_instance().get_message("box_previous"):
         option.KEY_MENU_LEFT,
         game.get_game_instance().get_message("move"): option.KEY_ACTION
     }
     self.tab_cat = [
         game.FONT_20.render(game.game_instance.get_message(f'stats.{st}'),
                             True, (0, 0, 0)) for st in pokemon.STATS
     ]
     self.tab_cat.append(
         game.FONT_20.render(game.game_instance.get_message("object"), True,
                             (0, 0, 0)))
예제 #16
0
    def render(self, display: pygame.Surface):
        display.fill("#ecdcdf")
        pygame.draw.polygon(display, "#e7a300", Bag.poly_1)
        pygame.draw.polygon(display, "#f2b71f", Bag.poly_2)

        display.blit(self.cat_image, (10, 10))
        display.blit(game.FONT_BOLD_58.render(game.get_game_instance().get_message("bag").upper(), True, (0, 0, 0)),
                     (74, 10))

        self.draw_team(display)
        self.draw_items(display)

        utils.draw_button_info(display, **self.keys)
예제 #17
0
파일: pokedex.py 프로젝트: Kyrokx/PygaMone
    def render(self, display: pygame.Surface) -> NoReturn:
        display.fill("#ecdcdf")
        pygame.draw.polygon(display, "#f4523b", PokeDex.poly_1)
        pygame.draw.polygon(display, "#fa7248", PokeDex.poly_2)
        pygame.draw.polygon(display, "#333333", PokeDex.poly_3)
        pygame.draw.polygon(display, "#cedae0", PokeDex.poly_4)

        utils.draw_button_info(display, **self.keys)

        nb = game.FONT_24.render(game.get_game_instance().get_message("number"), True, (255, 255, 255))
        nb_s = nb.get_size()

        # 839 = (1060 - x(40)) // 2 + x(40)
        display.blit(nb, (839 - (nb_s[0] // 2), 40 - (nb_s[1] // 2)))
        nb = game.FONT_24.render(game.get_game_instance().get_message("pokedex"), True, (0, 0, 0))
        display.blit(nb, (10, 40 - (nb_s[1] // 2)))
        x_1 = 20 + nb.get_size()[0]

        pygame.draw.rect(display, "#595959", (x_1, 22, 100, 34), border_radius=10)
        display.blit(f := game.FONT_20.render(str(self.nb_caught), True, (255, 255, 255)),
                     (x_1 + 50, 40 - (f.get_size()[1] // 2)))
        display.blit(utils.RED_POKEBALL, (x_1 + 10, 23))
        pygame.draw.rect(display, "#595959", (x_1 + 110, 22, 100, 34), border_radius=10)
        display.blit(f := game.FONT_20.render(str(self.nb_saw), True, (255, 255, 255)),
                     (x_1 + 160, 40 - (f.get_size()[1] // 2)))
        display.blit(utils.POINT_POKEBALL, (x_1 + 120, 23))

        range_ = self.get_range()

        y = 90

        for id_ in range(*range_):
            self.draw_pokemon(display, id_, y)
            if self.selected == id_:
                display.blit(self.arrow, (625, y + 10))
            y += 50
예제 #18
0
 def __init__(self, player):
     super().__init__(player)
     self.selected = 0
     # self.arrow = utils.get_part_i(MENU_IMAGE, (0, 64, 22, 91), (12, 14))
     self.arrow = utils.ARROW
     self.text = [
         game.get_game_instance().get_message(t)
         for t in ["save_game", "back"]
     ]
     self.text_2 = [
         game.FONT_16.render(game.get_game_instance().get_message(t) + " :",
                             True, (0, 0, 0)) for t in [
                                 "date_hour",
                                 "actual_position",
                                 "time_play",
                                 "pokedex",
                             ]
     ]
     self.last_save_f = game.FONT_16.render(
         game.get_game_instance().get_message("last_save"), True,
         (255, 255, 255))
     self.last_save_size = game.FONT_SIZE_16[0] * len(
         game.get_game_instance().get_message("last_save"))
     self.time_play = game.FONT_16.render(
         utils.time_to_string(game.get_game_instance().get_save_value(
             "time_played", 0)), True, (0, 0, 0))
     # todo: pokedex n
     self.pokedex = game.FONT_16.render(
         str(
             sum(
                 map(
                     game.POKEDEX_CATCH.__eq__,
                     game.get_game_instance().
                     get_pokedex_catch_status_values()))), True, (0, 0, 0))
     self.last_save = game.FONT_16.render(
         str(
             datetime.fromtimestamp(game.get_game_instance().get_save_value(
                 "last_save", 0)).strftime('%d/%m/%y  %H:%M')), True,
         (255, 255, 255))
     self.open_time = time.time()
예제 #19
0
파일: pokedex.py 프로젝트: Kyrokx/PygaMone
    def draw_pokemon(self, display: pygame.Surface, id_: int, y: int) -> NoReturn:
        r_id_ = id_ + 1
        status = game.get_game_instance().get_pokedex_status(r_id_)
        color = (100, 100, 100) if status == game.POKEDEX_NEVER_SEEN else (255, 255, 255) if self.selected == id_ else (0, 0, 0)
        poke = pokemon.get_pokemon(r_id_ if status != game.POKEDEX_NEVER_SEEN else 0)

        if status != game.POKEDEX_NEVER_SEEN and self.selected == id_:
            utils.draw_split_rond_rectangle(display, (650, y + 8, 355, 31), 0.5, 0.45, "#f0501e", "#000000")
            big_im = displayer.get_poke(PokeDex.PATH(str(poke.id_)), 3)
            s_x, s_y = big_im.get_size()
            display.blit(big_im, (250 - s_x // 2, 300 - s_y // 2))

        im = displayer.get_poke(PokeDex.PATH(str(poke.id_)), 0.5)
        delta_x, delta_y = utils.get_first_color(im)
        display.blit(im, (636, y + 30 - delta_y))
        display.blit(game.FONT_24.render(f"N° {pokemon.to_3_digit(r_id_)}", True, color), (680, y + 12))
        display.blit(game.FONT_24.render(poke.get_name(True) if poke.id_ != 0 else "???", True, color), (840, y + 12))
        if status != game.POKEDEX_NEVER_SEEN:
            display.blit(
                (self.white_pokeball if self.selected == id_ else self.black_pokeball) if status == game.POKEDEX_CATCH
                else (utils.POINT_POKEBALL if self.selected == id_ else self.light_orange_point),
                (980, y + 8)
            )
예제 #20
0
def draw_pokemon_stats(display: pygame.Surface,
                       poke: 'player_pokemon.PlayerPokemon',
                       up: dict[str, int],
                       fusion: float = 1):
    pygame.draw.rect(display, "#FFFFFF", (583, 150, 350, 214), border_radius=4)
    y = 150
    for st in pokemon.STATS:
        y += 10
        display.blit(
            game.FONT_24.render(
                game.get_game_instance().get_message(f'stats.{st}'), True,
                (0, 0, 0)), (600, y))
        stats_n = poke.get_stats(st, False)
        if fusion != 0:
            stats_n -= up[st]
        display.blit(tx := game.FONT_24.render(str(stats_n), True, (0, 0, 0)),
                     (800 - tx.get_size()[0], y))
        if fusion != 0:
            add_x = 800 + 30 * fusion
            display.blit(game.FONT_24.render(f'+ {up[st]}', True, "#7e0000"),
                         (add_x, y))

        y += 24
예제 #21
0
 def on_key_bike(self) -> NoReturn:
     sound_manager.start_in_first_empty_taunt(pygame.mixer.Sound(sounds.SAVE.path))
     game.get_game_instance().save()
     self.player.close_menu()
예제 #22
0
 def get_translate_name(self) -> str:
     return game.get_game_instance().get_message("levels.{}".format(
         self.name))
예제 #23
0
 def get_pokedex(self) -> str:
     return game.get_game_instance().get_poke_message(str(
         self.id_))["pokedex"]
예제 #24
0
 def get_name(self) -> NoReturn:
     return game.get_game_instance().get_ability_message(self.id_)['name']
예제 #25
0
파일: pokedex.py 프로젝트: Kyrokx/PygaMone
 def on_key_action(self) -> NoReturn:
     status = game.get_game_instance().get_pokedex_status(self.selected + 1)
     if status != game.POKEDEX_NEVER_SEEN:
         self.player.open_menu(PokeDexInfo(self.player, self.selected))
         sound_manager.start_in_first_empty_taunt(sounds.PLINK)
예제 #26
0
 def get_description(self) -> NoReturn:
     return game.get_game_instance().get_ability_message(
         self.id_)['description']
예제 #27
0
파일: pokedex.py 프로젝트: Kyrokx/PygaMone
    def render(self, display: pygame.Surface):
        display.fill("#ecdcdf")
        pygame.draw.polygon(display, "#f4523b", PokeDexInfo.poly_1)
        pygame.draw.polygon(display, "#fa7248", PokeDexInfo.poly_2)
        pygame.draw.polygon(display, "#f4523b", PokeDexInfo.poly_3)

        utils.draw_button_info(display, **self.keys)

        poke = pokemon.get_pokemon(self.selected + 1)

        # big
        big_im = displayer.get_poke(PokeDex.PATH(str(poke.id_)), 3)
        s_x, s_y = big_im.get_size()
        display.blit(big_im, (250 - s_x // 2, 300 - s_y // 2))

        utils.draw_split_rectangle(display, (477, 60, 530, 50), 0.4, 0.35, "#f0501e", "#000000")
        utils.draw_arrow(display, True, 742, 56, (255, 255, 255), size=2)
        utils.draw_arrow(display, False, 742, 114, (255, 255, 255), size=2)
        y = 62
        im = displayer.get_poke(PokeDex.PATH(str(poke.id_)), 0.7)
        delta_x, delta_y = utils.get_first_color(im)
        x = 480
        display.blit(im, (x, y + 30 - delta_y))
        status = game.get_game_instance().get_pokedex_status(self.selected + 1)
        display.blit(game.FONT_24.render(f"N° {pokemon.to_3_digit(self.selected + 1)}", True, (255, 255, 255)), (x + 50, y + 10))
        display.blit(game.FONT_24.render(poke.get_name(True) if poke.id_ != 0 else "???", True, (255, 255, 255)), (689, y + 10))
        if status != game.POKEDEX_NEVER_SEEN:
            display.blit(
                self.white_pokeball if status == game.POKEDEX_CATCH else utils.POINT_POKEBALL,
                (950, y + 8)
            )

        x, y = 530, 150
        l = 424
        h = 40
        s = 3
        pygame.draw.rect(display, "#dbdbd9", (x, y, l, h,))
        display.blit(tx := game.FONT_24.render(poke.get_japan_name(), True, (0, 0, 0)),
                     (x + (l - tx.get_size()[0]) // 2, y + (h - tx.get_size()[1]) // 2))
        y += h + s
        tx = ("type", "size", "weight", "view")
        tx2 = (None, f'{poke.size} m', f'{poke.weight} Kg', str(game.get_game_instance().get_nb_view(self.selected + 1)))
        for i in range(4):
            pygame.draw.rect(display, "#dbdbd9", (x, y, l // 2, h))
            pygame.draw.rect(display, "#ffffff", (x + l // 2, y, l // 2, h))
            display.blit(sur := game.FONT_24.render(game.get_game_instance().get_message(tx[i]), True, (0, 0, 0)),
                         utils.get_center(sur, (x, y, l // 2, h)))
            if i != 0:
                display.blit(sur := game.FONT_24.render(tx2[i], True, (0, 0, 0)),
                             utils.get_center(sur, (x + l // 2 + 5, y, l // 2, h), center_x=False))
            else:
                _x_ = x + l // 2 + 10
                for ii in range(len(poke.types)):
                    utils.draw_type(display, _x_, y + h // 2 - 8, poke.types[ii])
                    _x_ += 106
            y += h
            if i != 3:
                pygame.draw.rect(display, "#d2d2d2", (x, y, l // 2, s))
                pygame.draw.rect(display, "#f3f3f3", (x + l // 2, y, l // 2, h))
            y += s
        pygame.draw.rect(display, "#ffffff", (x, y, l, int(h * 4.5)))
        x += 5
        y += 10
        for p_l in hud.Dialog.split(poke.get_pokedex(), 40):
            display.blit(game.FONT_20.render(p_l, True, (0, 0, 0)), (x, y))
            y += game.FONT_SIZE_20[1] + 5
예제 #28
0
 def get_japan_name(self) -> str:
     try:
         return game.get_game_instance().get_poke_message(str(
             self.id_))["japan"]
     except KeyError:
         return ""
예제 #29
0
 def get_lore(self) -> str:
     return game.get_game_instance().get_message(self.identifier + ".lore")
예제 #30
0
 def get_category_name(self) -> str:
     return game.get_game_instance().get_message(
         f'ability.categories.{self.category}')