示例#1
0
 def trigger(self, pos: Tuple[int, int], face: str) -> NoReturn:
     player = game.game_instance.player
     if player.is_action_press and self.__status == 0:
         yes = game.game_instance.get_message("yes")
         no = game.game_instance.get_message("no")
         dialog = hud.QuestionDialog("dialog.poke_center", self.talk_callback, (yes, no), speed_skip=True,
                                     need_morph_text=True)
         player.open_dialogue(dialog, 1000, over=False)
示例#2
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
示例#3
0
 def trigger(self, data) -> NoReturn:
     if (not data[0]) or game.game_instance.player.is_action_press and (
             not game.game_instance.player.current_dialogue):
         game.game_instance.player.open_dialogue(hud.QuestionDialog(
             hud.Dialog.split(game.game_instance.get_message("test")),
             self.callback, ["oui", "non", "jsp"],
             speed_skip=True),
                                                 over=False,
                                                 check_last_open=1000)
示例#4
0
 def ask_cancel(self):
     self.__on_question = True
     self.player.open_dialogue(
         hud.QuestionDialog(
             "battle.xp.forget_menu.confirm_no",
             callback=lambda v, i: self.ask_callback(False, i),
             ask=self.__ask,
             speed_skip=True,
             speed=25,
             need_morph_text=True,
             style=2,
             text_var=[self.__ab.ability.get_name()]))
示例#5
0
 def on_key_action(self) -> NoReturn:
     if not self.__on_question:
         if self.selected < 4:
             ab = self.__poke.get_ability(self.selected)
             self.__on_question = True
             self.player.open_dialogue(
                 hud.QuestionDialog(
                     "battle.xp.forget_menu.confirm_yes",
                     callback=lambda v, i: self.ask_callback(True, i),
                     ask=self.__ask,
                     speed_skip=True,
                     speed=25,
                     need_morph_text=True,
                     style=2,
                     text_var=[
                         ab.ability.get_name() if ab else '---',
                         self.__ab.ability.get_name()
                     ]))
         else:
             self.ask_cancel()
     elif self.__on_question == -1:
         self.__on_question = False
示例#6
0
 def tick(self, display: pygame.Surface) -> bool:
     if not self._init:
         self._init = True
         if self.__poke:
             if self.__type == 0:
                 self.__poke.add_ability(0, self.__c_ability)
                 sound_manager.start_in_first_empty_taunt(sounds.LEVEL_UP)
                 game.game_instance.player.open_dialogue(
                     hud.Dialog("battle.xp.learn",
                                need_morph_text=True,
                                none_skip=True,
                                style=2,
                                speed=25,
                                text_var=[
                                    abilitys_.ABILITYS[
                                        self.__c_ability].get_name()
                                ]))
             else:
                 game.game_instance.player.open_dialogue(
                     hud.Dialog("battle.xp.want_lean",
                                need_morph_text=True,
                                none_skip=True,
                                style=2,
                                speed=25,
                                text_var=[
                                    abilitys_.ABILITYS[
                                        self.__c_ability].get_name()
                                ]))
         else:
             self.next()
             return True
     draw_xp_pokemon(display,
                     [(key, value and value[0] > 0)
                      for key, value in zip(self.__xp_tab, self.__edit)])
     if self.__type == 0:
         if self.action:
             self.next()
             return True
     else:
         if self.action == 1:
             if self.__type == 0:
                 self.next()
                 return True
             self.action += 1
             ask = game.game_instance.get_message("battle.xp.forget_ability.yes"), \
                      game.game_instance.get_message("battle.xp.forget_ability.no")
             game.game_instance.player.open_dialogue(
                 hud.QuestionDialog(
                     "battle.xp.forget_ability.text",
                     self.question_callback,
                     ask,
                     need_morph_text=True,
                     style=2,
                     speed=25,
                     text_var=[
                         abilitys_.ABILITYS[self.__c_ability].get_name()
                     ]),
                 over=True,
             )
         elif self.action == 2 and self.__answer is not None:
             self.action += 1
             if self.__answer == 0:
                 game.game_instance.player.open_menu(
                     forget_ability_menu.ForgetAbility(
                         game.game_instance.player, self.__poke,
                         self.__c_ability, self.menu_callback))
             else:
                 game.game_instance.player.open_dialogue(
                     hud.Dialog("battle.xp.haven_t_lean",
                                need_morph_text=True,
                                none_skip=True,
                                style=2,
                                speed=25,
                                text_var=[
                                    self.__poke.get_name(True),
                                    abilitys_.ABILITYS[
                                        self.__c_ability].get_name()
                                ]))
         elif self.action == 4:
             self.action += 1
             if self.__answer == 0:
                 if self.__menu_answer == -1:
                     game.game_instance.player.open_dialogue(
                         hud.Dialog("battle.xp.haven_t_lean",
                                    need_morph_text=True,
                                    none_skip=True,
                                    style=2,
                                    speed=25,
                                    text_var=[
                                        self.__poke.get_name(True),
                                        abilitys_.ABILITYS[
                                            self.__c_ability].get_name()
                                    ]))
                 else:
                     self.__old_ab = self.__poke.get_ability(
                         self.__menu_answer)
                     self.__poke.add_ability(self.__menu_answer,
                                             self.__c_ability)
                     sound_manager.start_in_first_empty_taunt(
                         sounds.LEVEL_UP)
                     game.game_instance.player.open_dialogue(
                         hud.Dialog("battle.xp.learn_2",
                                    need_morph_text=True,
                                    none_skip=True,
                                    style=2,
                                    speed=100))
             else:
                 self.next()
                 return True
         elif self.action == 6:
             self.action += 1
             if self.__menu_answer == -1:
                 self.next()
                 return True
             else:
                 game.game_instance.player.open_dialogue(
                     hud.Dialog("battle.xp.learn_2_end",
                                need_morph_text=True,
                                none_skip=True,
                                style=2,
                                speed=25,
                                text_var=[
                                    self.__poke.get_name(True),
                                    self.__old_ab.ability.get_name()
                                    if self.__old_ab else '----',
                                    abilitys_.ABILITYS[
                                        self.__c_ability].get_name()
                                ]))
         elif self.action >= 8:
             self.next()
             return True
     return False