def talk_callback(self, value, index) -> NoReturn: player = game.game_instance.player if index == 1: player.open_dialogue(hud.Dialog("dialog.poke_center_no", speed_skip=True, need_morph_text=True), over=True) else: self.have_start_song = False self.__action = utils.current_milli_time() self.__player.open_dialogue(hud.Dialog("dialog.poke_center_yes", need_morph_text=True, none_skip=True), over=True) self.__player.heal_team() return True
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
def cycling_press(self): if self.current_dialogue: pass if self.current_menu: self.current_menu.on_key_bike() elif self.current_battle: pass elif game.game_instance.level.can_cycling: self.is_cycling = not self.is_cycling else: self.open_dialogue(hud.Dialog("dialog.cant_bike", speed=20, speed_skip=True, need_morph_text=True, style=2), over=False)
def tick(self, display: pygame.Surface) -> bool: if not self._init: self._init = True if 0 <= self.__i < 6: sound_manager.start_in_first_empty_taunt(sounds.LEVEL_UP) game.game_instance.player.open_dialogue( hud.Dialog( "battle.xp.poke_level_up", need_morph_text=True, none_skip=True, style=2, speed=25, text_var=[self.poke.get_name(True), self.poke.lvl])) else: self.action = 2 draw_xp_pokemon(display, [(key, value and value[0] > 0) for key, value in zip(self.__xp_tab, self.__edit)]) if self.action == 1: if self.__i != -1: self.action += 1 self._start = utils.current_milli_time() else: self.action = 3 if 0 <= self.__i < 6: fusion = 1 if self.action > 1: fusion = 1 - min( (utils.current_milli_time() - self._start) / 200, 1) draw_pokemon_stats(display, self.poke, self.__edit[self.__i][1], fusion) if self.action > 2: if self.__i != -1: self._bat.TO_SHOW.insert( 0, lambda: self._bat.start_new_animation( PokemonWonAttackAnimation( self._bat, self.__xp_tab, self.__i_, self.__edit, self.get_next_i(self.__i), self.attack_edit))) # self._bat.TO_SHOW.append(lambda: self._bat.start_new_animation(XpAnimationAdd( # self._bat, self.__xp_tab, self.get_next_i(self.__i), self.__edit))) game.game_instance.player.close_dialogue() return True return False
def tick(self, display: pygame.Surface) -> bool: if not self._init: self._init = True # self.start = utils.current_milli_time() game.game_instance.player.open_dialogue( hud.Dialog("battle.xp.team_won_xp", speed=25, need_morph_text=True, none_skip=True, style=2)) draw_xp_pokemon(display, None) # draw_pokemon_stats(display, game.game_instance.player.team[0], {st: 5 for st in pokemon.STATS}, ) if self.action: self._bat.TO_SHOW.insert( 0, lambda: self._bat.start_new_animation( XpAnimationAdd(self._bat, self.__xp_tab, None))) game.game_instance.player.close_dialogue() return True return False
def tick_render(self, display: pygame.Surface) -> NoReturn: if self.__action: dif_t = utils.current_milli_time() - self.__action if dif_t > 1000: dif_t -= 1000 self.__image_to_show = self.__heal_facing_image nb_poke = self.__player.get_non_null_team_number() nb_poke_to_show = dif_t // 1000 for i in range(min(nb_poke, nb_poke_to_show)): display.blit(self.__player.team[i].poke_ball.small_image, self.get_where_pose(i)) if nb_poke_to_show > nb_poke and dif_t % 400 > 200: display.blit(self.__glow, self.get_where_pose(i)) if nb_poke_to_show > nb_poke: if not self.have_start_song: self.have_start_song = True sound_manager.start_in_first_empty_taunt(pygame.mixer.Sound(sounds.HEAL.path)) if dif_t - 1000 * nb_poke > 3000: self.__image_to_show = self.facing_image self.__action = None self.__player.open_dialogue( hud.Dialog("dialog.poke_center_end", speed_skip=True, need_morph_text=True), over=True)
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