コード例 #1
0
ファイル: player_pokemon.py プロジェクト: Kyrokx/PygaMone
    def __init__(self,  **data):
        self.id_ = data["_id"]
        self.xp = data.get("xp", 1)
        self.poke = pokemon.get_pokemon(self.id_)
        self.lvl = self.get_lvl()
        self.ivs = ivs_from_int(data["ivs"]) if "ivs" in data else random_ivs()
        self.heal = data.get("heal", -1)
        self.shiny = data.get("shiny", False)
        self.female = data.get("female")
        self.uuid = data.get("uuid", uuid.uuid4())
        it = data.get("item", None)
        self.item: Optional['item.item.Item'] = item.items.ITEMS.get(it, None) if it is not None and it != "none" else None

        self.front_image = f'assets/textures/pokemon/{("shiny/" if self.shiny else "")}{("female/" if self.female and self.poke.have_female_image else "")}{(self.id_)}.png'
        self.back_image = f'assets/textures/pokemon/back/{("shiny/" if self.shiny else "")}{("female/" if self.female and self.poke.have_female_image else "")}{(self.id_)}.png'
        self.front_image_y = self.get_first_color(self.front_image)
        self.back_image_y = self.get_first_color(self.back_image)

        self.stats = {}
        #combat_stats
        self.combat_status: 'pokemon_status.PokeStatus' = pokemon_status.PokeStatus(self, data.get("status", []))
        self.pokemon_stats_modifier: 'psm.PokeStatsModifier' = psm.PokeStatsModifier(self)
        self.calculate_stats()
        self.ability: List[PokemonAbility] = [PokemonAbility.deserialisation(a) for a in data["ability"]]

        self.poke_ball: 'item.pokeball.Pokeball' = item.items.ITEMS[data.get("pokeball", "poke_ball")]
        self.use = False
        self.ram_data = {}

        # heal check
        if self.heal == -1 or self.heal > self.get_max_heal():
            self.heal = self.get_max_heal()
コード例 #2
0
ファイル: player_pokemon.py プロジェクト: Kyrokx/PygaMone
 def set_id(self, id_):
     self.id_ = id_
     self.poke = pokemon.get_pokemon(self.id_)
     self.calculate_stats()
     self.front_image = f'assets/textures/pokemon/{("shiny/" if self.shiny else "")}{("female/" if self.female and self.poke.have_female_image else "")}{(self.id_)}.png'
     self.back_image = f'assets/textures/pokemon/back/{("shiny/" if self.shiny else "")}{("female/" if self.female and self.poke.have_female_image else "")}{(self.id_)}.png'
     game.game_instance.set_pokedex_catch(id_)
コード例 #3
0
    def __init__(self, _id: int, xp: int, ivs: Dict[str, int], heal: int,
                 ability: List[PokemonAbility], poke_ball: 'item.Item',
                 shiny: bool, female: bool, status: list[str],
                 uuid_: Optional[uuid.UUID]):
        self.id_ = _id
        self.xp = xp
        self.poke = pokemon.get_pokemon(self.id_)
        self.lvl = self.get_lvl()
        self.ivs = ivs
        self.heal = heal
        self.shiny = shiny
        self.female = female
        self.uuid = uuid_ if uuid_ else uuid.uuid4()

        self.front_image = f'assets/textures/pokemon/{("shiny/" if shiny else "")}{("female/" if female and self.poke.have_female_image else "")}{(self.id_)}.png'
        self.back_image = f'assets/textures/pokemon/back/{("shiny/" if shiny else "")}{("female/" if female and self.poke.have_female_image else "")}{(self.id_)}.png'
        self.front_image_y = self.get_first_color(self.front_image)
        self.back_image_y = self.get_first_color(self.back_image)

        self.stats = {}
        #combat_stats
        self.combat_status: 'pokemon_status.PokeStatus' = pokemon_status.PokeStatus(
            self, status)
        self.pokemon_stats_modifier: 'psm.PokeStatsModifier' = psm.PokeStatsModifier(
            self)
        self.calculate_stats()
        self.ability: List[PokemonAbility] = ability

        self.poke_ball: 'poke_item.Pokeball' = poke_ball
        self.use = False
        self.ram_data = {}

        # heal check
        if self.heal == -1 or self.heal > self.get_max_heal():
            self.heal = self.get_max_heal()
コード例 #4
0
 def __init__(self, bat: 'battle.Battle', poke: 'player_pokemon.PlayerPokemon', new_id: int):
     self.new_id = new_id
     self._bat = bat
     self._init = False
     self.action = False
     self._start = 0
     self.poke = poke
     self.base_poke = self.poke.poke
     self.new_base_poke = pokemon.get_pokemon(new_id)
     self.question_answer = None
     self.bg = None
     self.need_end = False
コード例 #5
0
ファイル: player_pokemon.py プロジェクト: Kyrokx/PygaMone
 def create_pokemon(_id: int, lvl: int, poke_ball: 'item.Item' = None):
     if poke_ball is None:
         poke_ball = item.items.POKE_BALL
     poke = pokemon.get_pokemon(_id)
     xp = poke.get_xp(lvl)
     # shiny = random.randint(0, 9191) == 0
     shiny = random.random() <= 0.0001220703125
     female = random.random() <= poke.female_rate
     ability = poke.get_4_last_ability(lvl)
     _ability = []
     for i in range(min(len(ability), 4)):
         _ability.append(PokemonAbility.new_ability(ability[i]))
     _ability = [a.serialisation() for a in _ability]
     return PlayerPokemon(_id=_id, xp=xp, ability=_ability, pokeball=poke_ball.identifier, shiny=shiny, female=female)
     pass
コード例 #6
0
 def create_pokemon(_id: int,
                    lvl: int,
                    poke_ball: 'item.Item' = items.POKE_BALL):
     poke = pokemon.get_pokemon(_id)
     xp = poke.get_xp(lvl)
     ivs = random_ivs()
     # shiny = random.randint(0, 9191) == 0
     shiny = random.random() <= 0.0001220703125
     female = random.random() <= poke.female_rate
     ability = poke.get_4_last_ability(lvl)
     _ability = []
     for i in range(min(len(ability), 4)):
         _ability.append(PokemonAbility.new_ability(ability[i]))
     return PlayerPokemon(_id, xp, ivs, -1, _ability, poke_ball, shiny,
                          female, [], None)
     pass
コード例 #7
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)
            )
コード例 #8
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