コード例 #1
0
ファイル: confuse_ray.py プロジェクト: Kyrokx/PygaMone
    def render(self, display: pygame.Surface, target: list[tuple[int, int,
                                                                 int]],
               launcher: tuple[int, int,
                               int], ps_t: int, first_time: bool) -> NoReturn:
        if first_time:
            sound_manager.start_in_first_empty_taunt(self.sound)

        x1, y1 = launcher[0] + 40, launcher[1] - 50
        x2, y2 = target[0][0], target[0][1] - 30
        a = (y2 - y1) / (x2 - x1)
        b = y1 - a * x1
        max_delta_x = x2 - x1

        color = (*utils.hexa_color_to_rgb(COLORS[((ps_t % 100) // 10) *
                                                 (1 if
                                                  (ps_t // 100) % 2 else -1)]),
                 180)

        im = utils.color_image(self.orb.copy(), color)

        if ps_t < 1900:
            x = min((ps_t / 1900), 1) * max_delta_x + x1
            y = (a * x + b) + (0.0005 * (x - x1) * (x - x2))

            display.blit(im, (x - 32, y - 32))
        else:
            p = min(((ps_t - 1900) / 550), 1.0) * math.pi * 2
            x, y = math.cos(p) * 20, math.sin(p) * 10
            display.blit(im, (x2 - 32 + x, y2 - 32 + y))
コード例 #2
0
ファイル: bide.py プロジェクト: Rix565/PygaMone
 def render(self, display: pygame.Surface, target: list[tuple[int, int,
                                                              int]],
            launcher: tuple[int, int,
                            int], ps_t: int, first_time: bool) -> NoReturn:
     if first_time:
         self.current_vars_2 = [False, False, False]
         self.contact_gif = gif_manger.CONTACT.get().display(
             (target[0][0] - 24, target[0][1] - 60), speed=170)
         self.bide_gif = gif_manger.BIDE.get().display((0, 0), speed=10)
     if self.render_type == 0 or self.render_type == 1:
         if not self.current_vars_2[self.render_type]:
             self.current_vars_2[self.render_type] = True
             sound_manager.start_in_first_empty_taunt(self.sound)
         for i in range(len(COORDS)):
             if (2000 / len(COORDS)) * i < ps_t < (2000 /
                                                   len(COORDS)) * i + 110:
                 co = COORDS[i]
                 self.bide_gif.render(
                     display,
                     (launcher[0] + co[0] - 64, launcher[1] - co[1] - 64))
     else:
         if not self.current_vars_2[self.render_type]:
             self.current_vars_2[self.render_type] = True
             sound_manager.start_in_first_empty_taunt(self.sound_2)
         if 400 < ps_t < 1300:
             self.contact_gif.render(display)
コード例 #3
0
 def render(self, display: pygame.display, target: list[type[int, int, int]],
            launcher: tuple[int, int, int], ps_t: int, first_time: bool) -> NoReturn:
     if first_time:
         self.g_i = self.gif.display(target[0])
         sound_manager.start_in_first_empty_taunt(self.sound)
     for t in target:
         self.g_i.render(display, (t[0] - 40, t[1] - 120))
コード例 #4
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))
コード例 #5
0
ファイル: cut.py プロジェクト: Kyrokx/PygaMone
    def render(self, display: pygame.display, target: list[type[int, int,
                                                                int]],
               launcher: tuple[int, int,
                               int], ps_t: int, first_time: bool) -> NoReturn:
        if first_time:
            sound_manager.start_in_first_empty_taunt(self.sound)
            self.random_vec = [(random.uniform(-1, 1), random.uniform(-1, 1),
                                random.randint(0,
                                               100), random.randint(300, 400))
                               for _ in range(10)]

        for t in target:
            if 150 < ps_t < 600:
                x_start, y_start = t[0] + 90, t[1] - 150
                edit = (ps_t - 150) / 600 * 80
                display.blit(
                    self.cut,
                    (x_start - self.cut.get_size()[0] - edit, y_start + edit))
            if ps_t > 250:
                ps_t -= 250
                x_start, y_start = t[0], t[1] - 40
                for bu in self.random_vec:
                    vec = [bu[0], bu[1]]
                    if 0 < (n_pst_t := ps_t - bu[2]) < bu[3]:
                        adv = (n_pst_t / bu[3])
                        vec[0] *= adv * 150
                        vec[1] *= adv * 150
                        display.blit(
                            self.ball,
                            (x_start - 16 + vec[0], y_start - 16 + vec[1]))
コード例 #6
0
ファイル: pokedex.py プロジェクト: Kyrokx/PygaMone
 def on_key_y(self, value: float, press: bool) -> NoReturn:
     if press and value < 0 and self.selected > 0:
         self.selected -= 1
         sound_manager.start_in_first_empty_taunt(sounds.PLINK_2)
     elif press and value > 0 and self.selected < pokemon.NB_POKEMON - 1:
         self.selected += 1
         sound_manager.start_in_first_empty_taunt(sounds.PLINK_2)
コード例 #7
0
    def render(self, display: pygame.display, target: list[tuple[int, int,
                                                                 int]],
               launcher: tuple[int, int,
                               int], ps_t: int, first_time: bool) -> NoReturn:
        if first_time:
            sound_manager.start_in_first_empty_taunt(self.sound)
            self.g_i = gif_manger.CONTACT.get().display(
                (target[0][0] - 60, target[0][1] - 60), 25)

        x1, y1 = launcher[0] + 40, launcher[1] - 50
        x2, y2 = target[0][0], target[0][1] - 30
        a = (y2 - y1) / (x2 - x1)
        b = y1 - a * x1
        max_delta_x = x2 - x1
        if 100 < ps_t < 1000 or 2600 < ps_t < 3500:
            x = min(
                ((ps_t -
                  (100 if ps_t < 1000 else 2600)) / 900), 1) * max_delta_x + x1
            y = (a * x + b) + (0.002 * (x - x1) * (x - x2))
            display.blit(
                pygame.transform.rotate(self.bone, (ps_t % 300) / 300 * 360),
                (x - 32, y - 32))
        elif 1000 <= ps_t <= 1700 or 3500 <= ps_t <= 4200:
            x = x2 - min(
                ((ps_t -
                  (1000 if ps_t <= 1700 else 3500)) / 700), 1) * max_delta_x
            y = (a * x + b) + (-0.002 * (x - x1) * (x - x2))
            display.blit(
                pygame.transform.rotate(self.bone, (ps_t % 300) / 300 * 360),
                (x - 32, y - 32))
コード例 #8
0
 def on_key_escape(self) -> NoReturn:
     if self.action_selected != -1:
         self.action_selected = -1
     elif not self.is_death:
         self.call_back(False, self.selected)
     else:
         sound_manager.start_in_first_empty_taunt(sounds.BLOCK.sound)
コード例 #9
0
    def render(self, display: pygame.display, target: list[type[int, int, int]],
               launcher: tuple[int, int, int], ps_t: int, first_time: bool) -> NoReturn:
        if first_time:
            sound_manager.start_in_first_empty_taunt(self.sound)
            self.random_vec = [
                (random.uniform(-2, 2), random.uniform(-2, 2), random.randint(0, 1000), random.randint(400, 1000)) for _
                in range(20)]

        for t in target:
            if ps_t < 1000:
                x1, y1 = launcher[0] + 40, launcher[1] - 50
                x2, y2 = t[0], t[1] - 30
                a = (y2 - y1) / (x2 - x1)
                b = y1 - a * x1
                max_delta_x = x2 - x1
                x = min((ps_t / 1000), 1) * max_delta_x + x1
                y = (a * x + b) + (0.002 * (x - x1) * (x - x2))
                display.blit(pygame.transform.scale(self.bubble, (64, 64)), (x - 32, y - 32))
            else:
                ps_t -= 1000
                x_start, y_start = t[0], t[1] - 40
                for bu in self.random_vec:
                    vec = [bu[0], bu[1]]
                    if 0 < (n_pst_t := ps_t - bu[2]) < bu[3]:
                        adv = (n_pst_t / bu[3])
                        vec[0] *= adv * 150
                        vec[1] *= adv * 150
                        display.blit(self.bubble, (x_start - 16 + vec[0], y_start - 16 + vec[1]))
コード例 #10
0
    def render(self, display: pygame.display, target: list[tuple[int, int,
                                                                 int]],
               launcher: tuple[int, int,
                               int], ps_t: int, first_time: bool) -> NoReturn:
        if first_time:
            self.current_vars = [[False] * self.last_nb_hit,
                                 [(random.randint(-50,
                                                  50), random.randint(-50, 50))
                                  for _ in range(15)]]

        c_hit = min(self.last_nb_hit - 1, ps_t // 1000)
        if not self.current_vars[0][c_hit]:
            self.current_vars[0][c_hit] = True
            sound_manager.start_in_first_empty_taunt(self.sound)

        for t_i in range(len(target)):

            x, y = target[t_i][0], target[t_i][1] - 55

            for i in range(15):
                i_60 = int((i / 15) * ((1000 * (c_hit + 1)) - SPEED))
                if i_60 < ps_t < i_60 + SPEED:
                    rdm = self.current_vars[1][i]
                    display.blit(
                        self.img_y if (ps_t - i_60) // 50 else self.img_g,
                        (x + rdm[0] - 14, y + rdm[1] - 14))
コード例 #11
0
ファイル: menu.py プロジェクト: vingt100-82/PygaMone
 def on_key_action(self):
     if self.move != -1:
         if self.selected == self.move:
             self.move = -1
         else:
             self.player.switch_pokemon(self.move, self.selected)
             # reopen to actualise data
             self.player.open_menu(TeamMenu(self.player))
     elif self.action_selected == -1:
         sound_manager.start_in_first_empty_taunt(sounds.PLINK)
         self.action_selected = 0
     else:
         if self.action_selected != 4:
             sound_manager.start_in_first_empty_taunt(sounds.PLINK)
         if self.action_selected == 0:
             self.player.open_menu(StatusMenu(self.player, self.selected))
         elif self.action_selected == 1:
             self.move, self.action_selected = self.selected, -1
         elif self.action_selected == 2:
             # todo heal
             pass
         elif self.action_selected == 3:
             # todo object
             pass
         elif self.action_selected == 4:
             self.action_selected = -1
コード例 #12
0
    def render(self, display: pygame.Surface, target: list[type[int, int,
                                                                int]],
               launcher: tuple[int, int,
                               int], ps_t: int, first_time: bool) -> NoReturn:

        if first_time:
            self.current_vars = [random.randint(-40, 40) for _ in range(80)]
            sound_manager.start_in_first_empty_taunt(self.sound)

        for t_i in range(len(target)):

            x1, x2, y2 = launcher[0] + 40, target[t_i][0], target[t_i][1] - 30

            for i in range(80):
                i_60 = int((i / 80) * (2300 - SPEED))
                if i_60 < ps_t < i_60 + SPEED:
                    y1 = launcher[1] - 50
                    a = (y2 - y1) / (x2 - x1)
                    b = y1 - a * x1
                    max_delta_x = x2 - x1
                    size = (self.ball, 32, 32)
                    x = x1 + (
                        (ps_t - i_60) / SPEED) * max_delta_x - size[1] // 2
                    y = a * x + b - size[1] // 2 + self.current_vars[i]
                    display.blit(size[0], (x, y))
コード例 #13
0
ファイル: defense_curl.py プロジェクト: Kyrokx/PygaMone
    def render(self, display: pygame.Surface, target: list[type[int, int,
                                                                int]],
               launcher: tuple[int, int,
                               int], ps_t: int, first_time: bool) -> NoReturn:

        if first_time:
            sound_manager.start_in_first_empty_taunt(self.sound)
コード例 #14
0
 def on_key_escape(self):
     sound_manager.start_in_first_empty_taunt(sounds.BACK)
     if self.poke_select != -1:
         self.poke_select = -1
     elif self.action_selected != -1:
         self.action_selected = -1
     else:
         self.player.open_menu(hud_menu.MainMenu(self.player))
コード例 #15
0
ファイル: menu.py プロジェクト: vingt100-82/PygaMone
 def on_key_action(self):
     sound_manager.start_in_first_empty_taunt(sounds.PLINK)
     if self.selected == 4:
         self.player.open_menu(SaveMenu(self.player))
     elif self.selected == 1:
         self.player.open_menu(TeamMenu(self.player))
     elif self.selected == 0:
         self.player.open_menu(menu_pokedex.PokeDex(self.player))
コード例 #16
0
 def pres_y(self, up: bool) -> NoReturn:
     if self._current_line == len(self._text) - 1 and self._need_enter:
         if up:
             self.__select = self.__select = max(self.__select - 1, 0)
             sound_manager.start_in_first_empty_taunt(sounds.PLINK_2)
         else:
             self.__select = min(self.__select + 1, len(self.__ask) - 1)
             sound_manager.start_in_first_empty_taunt(sounds.PLINK_2)
コード例 #17
0
 def on_key_y(self, value: float, press: bool) -> NoReturn:
     if press and not self.__on_question:
         if value < 0 and self.selected > 0:
             self.selected -= 1
             sound_manager.start_in_first_empty_taunt(sounds.PLINK_2)
         elif value > 0 and self.selected < 4:
             self.selected += 1
             sound_manager.start_in_first_empty_taunt(sounds.PLINK_2)
コード例 #18
0
ファイル: pc_hud.py プロジェクト: Kyrokx/PygaMone
 def on_key_menu_x(self, value: float, press: bool) -> NoReturn:
     if press:
         if value < 0 and self.box > 0:
             sound_manager.start_in_first_empty_taunt(sounds.PLINK)
             self.box -= 1
         elif value > 0 and self.box < player.NB_BOX - 1:
             sound_manager.start_in_first_empty_taunt(sounds.PLINK)
             self.box += 1
コード例 #19
0
ファイル: pc_hud.py プロジェクト: Kyrokx/PygaMone
 def on_key_x(self, value: float, press: bool) -> NoReturn:
     if press:
         if value < 0 and self.selected[0] > -1:
             sound_manager.start_in_first_empty_taunt(sounds.PLINK_2)
             self.selected[0] -= 1
         elif value > 0 and self.selected[0] < 5:
             sound_manager.start_in_first_empty_taunt(sounds.PLINK_2)
             self.selected[0] += 1
コード例 #20
0
    def tick(self, display: Surface) -> bool:
        if not self._init:
            self._init = True

            ask = game.game_instance.get_message("yes"), \
                  game.game_instance.get_message("no")
            game.game_instance.player.open_dialogue(
                hud.QuestionDialog('battle.evolution_ask',
                                   self.callback,
                                   ask,
                                   speed=20,
                                   need_morph_text=True,
                                   style=2,
                                   text_var=[self.poke.get_name(True)]))
        if self.question_answer is not None:
            # no
            if self.question_answer == 1:
                return True
            # yes
            else:
                ps_t = utils.current_milli_time() - self._start
                # if ps_t < 10_000:
                display.blit(self.bg, (0, 0))
                if ps_t < 8_000:
                    x = ps_t / (8000 / 10)
                    f = lambda x: math.cos(x * 10) + 0.2 * x - 1
                    img = displayer.get_poke(
                        PATH(
                            str(self.new_base_poke.id_ if f(x) >= 0 else self.
                                base_poke.id_)), 3)
                    display.blit(img, (530 - img.get_size()[0] // 2,
                                       300 - img.get_size()[1] // 2))
                else:
                    img = displayer.get_poke(PATH(str(self.new_base_poke.id_)),
                                             3)
                    display.blit(img, (530 - img.get_size()[0] // 2,
                                       300 - img.get_size()[1] // 2))
                    if not self.action:
                        sound_manager.start_in_first_empty_taunt(
                            sounds.EVOLUTION)
                        self.action = True
                        game.game_instance.player.open_dialogue(
                            hud.Dialog("battle.evolution",
                                       speed=100,
                                       need_morph_text=True,
                                       callback=self.end_callback,
                                       text_var=[
                                           self.poke.get_name(True),
                                           self.new_base_poke.get_name(True)
                                       ]))
                        self.poke.set_id(self.new_id)

                    elif self.need_end:
                        game.game_instance.player.close_dialogue()
                        del self.bg
                        sounds.EVOLUTION.un_load()
                        return True
            return False
コード例 #21
0
 def render(self, display: pygame.display, target: list[type[int, int,
                                                             int]],
            launcher: tuple[int, int,
                            int], ps_t: int, first_time: bool) -> NoReturn:
     if first_time:
         self.g_i = self.gif.display(
             (target[0][0] - 60, target[0][1] - 155), speed=50)
         sound_manager.start_in_first_empty_taunt(self.sound)
     self.g_i.render(display)
コード例 #22
0
ファイル: clamp.py プロジェクト: Kyrokx/PygaMone
    def render(self, display: pygame.display, target: list[type[int, int, int]],
               launcher: tuple[int, int, int], ps_t: int, first_time: bool) -> NoReturn:
        if first_time:
            sound_manager.start_in_first_empty_taunt(self.sound)

        move = (ps_t / 600) * 120

        for t in target:
            display.blit(self.img_l, (t[0] - 100 + move, t[1] - 40))
            display.blit(self.img_r, (t[0] + 100 - move, t[1] - 40))
コード例 #23
0
ファイル: bag.py プロジェクト: Rix565/PygaMone
 def on_key_x(self, value: float, press: bool) -> NoReturn:
     if press and self.action_selected == -1:
         if value < 0 and self.category_select > 0:
             self.category_select -= 1
             self.item_selected = 0
             sound_manager.start_in_first_empty_taunt(sounds.PLINK_2)
             self.set_items()
         elif value > 0 and self.category_select < len(self.categories) - 1:
             self.category_select += 1
             self.item_selected = 0
             sound_manager.start_in_first_empty_taunt(sounds.PLINK_2)
             self.set_items()
コード例 #24
0
    def render(self, display: pygame.Surface, target: list[tuple[int, int, int]],
               launcher: tuple[int, int, int], ps_t: int, first_time: bool) -> NoReturn:
        if first_time:
            sound_manager.start_in_first_empty_taunt(self.sound)

        size = ps_t / 1500
        if size < 1:
            display.blit(pygame.transform.scale(self.glass, (int(self.glass.get_size()[0] * size),
                                                             int(self.glass.get_size()[1] * size))),
                         (launcher[0] + 20 - 64 * size, launcher[1] - 80 - 64 * size))
        else:
            display.blit(self.glass, (launcher[0] - 44, launcher[1] - 144))
コード例 #25
0
ファイル: counter.py プロジェクト: Kyrokx/PygaMone
    def render(self, display: pygame.Surface, target: list[type[int, int, int]],
               launcher: tuple[int, int, int], ps_t: int, first_time: bool) -> NoReturn:

        if first_time:
            sound_manager.start_in_first_empty_taunt(self.sound)
        if ps_t > 850:
            ps_t -= 850
            size = (1 - min(ps_t / 1000, 1)) * 4 + 1
            sizes = self.img_y.get_size()
            sizes = (int(sizes[0] * size), int(sizes[1] * size))
            im = pygame.transform.scale(self.img_y, sizes)
            for t in target:
                display.blit(im, (t[0] - sizes[0] // 2, t[1] - 40 - sizes[1] // 2))
コード例 #26
0
 def on_key_action(self):
     if self.action_selected == -1:
         self.action_selected = 0
     else:
         if self.action_selected == 0:
             if pk := self.player.team[self.selected]:
                 if pk.heal > 0 and not pk.use:
                     self.call_back(True, self.selected)
                 else:
                     sound_manager.start_in_first_empty_taunt(sounds.BLOCK.sound)
         elif self.action_selected == 1 and not self.is_death:
             # todo heal
             pass
コード例 #27
0
ファイル: acid_armor.py プロジェクト: Kyrokx/PygaMone
    def render(self, display: pygame.display, target: list[tuple[int, int, int]],
               launcher: tuple[int, int, int], ps_t: int, first_time: bool) -> NoReturn:
        if first_time:
            self.current_vars = [(random.randint(-100, 0), random.randint(0, 30)) for _ in range(15)]
            sound_manager.start_in_first_empty_taunt(self.sound)

        if ps_t > 1000:
            for i in range(15):
                i_15 = int((i / 15) * (1000 - SPEED_2))
                if i_15 + 1000 < ps_t < i_15 + SPEED_2 + 1000:
                    x = launcher[0] + 40 + self.current_vars[i][0]
                    y = launcher[1] - 50 + self.current_vars[i][1] - ((ps_t - 1000 - i_15) / SPEED_2) * 80
                    display.blit(self.ball, (x, y))
コード例 #28
0
    def render(self, display: pygame.display, target: list[tuple[int, int,
                                                                 int]],
               launcher: tuple[int, int,
                               int], ps_t: int, first_time: bool) -> NoReturn:
        if first_time:
            self.g_i = []
            gif = gif_manger.CONTACT.get()
            sound_manager.start_in_first_empty_taunt(self.sound)
            for t in target:
                self.g_i.append(gif.display((t[0] - 24, t[1] - 60), speed=170))

        if 400 < ps_t < 1300:
            for g in self.g_i:
                g.render(display)
コード例 #29
0
ファイル: menu.py プロジェクト: Rix565/PygaMone
 def on_key_action(self):
     if self.move != -1:
         if self.selected == self.move:
             self.move = -1
         else:
             self.player.switch_pokemon(self.move, self.selected)
             # reopen to actualise data
             self.player.open_menu(TeamMenu(self.player))
     elif self.action_selected == -1:
         sound_manager.start_in_first_empty_taunt(sounds.PLINK)
         if self.choice_call_back is None:
             self.action_selected = 0
         else:
             self.choice_call_back(self.selected)
     else:
         if self.action_type == 0:
             if self.action_selected != 4:
                 sound_manager.start_in_first_empty_taunt(sounds.PLINK)
             if self.action_selected == 0:
                 self.player.open_menu(StatusMenu(self.player, self.selected))
             elif self.action_selected == 1:
                 self.move, self.action_selected = self.selected, -1
             elif self.action_selected == 2:
                 poke = self.player.team[self.selected]
                 if poke:
                     self.player.open_menu(bag.Bag(self.player, (item.HEAL, item.BERRIES), target=poke,
                                                   condition=bag.CONDITION_HEAL))
             elif self.action_selected == 3:
                 self.action_type = 1
                 self.action_selected = 0
             elif self.action_selected == 4:
                 self.action_selected = -1
         else:
             if self.action_selected == 0:
                 poke = self.player.team[self.selected]
                 if poke:
                     self.player.open_menu(bag.Bag(self.player, (), target=poke,
                                                   condition=bag.CONDITION_GIVE))
                 else:
                     self.action_selected = -1
                     self.action_type = 0
             elif self.action_selected == 1:
                 poke = self.player.team[self.selected]
                 if poke and poke.item:
                     poke.set_item(None)
                 self.action_selected = 0
                 self.action_type = 0
             elif self.action_selected == 2:
                 self.action_selected = 0
                 self.action_type = 0
コード例 #30
0
 def on_key_action(self) -> NoReturn:
     if self.action_selected == -1:
         nb_items = len(self.items)
         if nb_items > 0:
             # crash prof
             if self.item_selected >= nb_items:
                 self.item_selected = 0
             it = self.items[self.item_selected]
             if it:
                 if nb := it[0].is_giveable(self.condition) + it[0].is_usable(self.condition):
                     sound_manager.start_in_first_empty_taunt(sounds.PLINK)
                     self.action_selected = 0
                     self.nb_action = nb + 1
                 else:
                     sound_manager.start_in_first_empty_taunt(sounds.BLOCK)