def apply_middle_effect(self, game_state: GameState, buffed_entity: WorldEntity, buffed_npc: NonPlayerCharacter, time_passed: Millis): self.time_since_start += time_passed if not self.has_spawn_happened and self.time_since_start > DELAY / 2: self.has_spawn_happened = True game_state.game_world.visual_effects += create_teleport_effects(buffed_entity.get_center_position()) play_sound(SoundId.ABILITY_TELEPORT)
def apply_start_effect(self, game_state: GameState, buffed_entity: WorldEntity, buffed_npc: NonPlayerCharacter): game_state.player_state.stun_status.add_one() game_state.game_world.player_entity.set_not_moving() game_state.game_world.player_entity.visible = False game_state.game_world.visual_effects += create_teleport_effects( buffed_entity.get_center_position())
def apply_middle_effect(self, game_state: GameState, buffed_entity: WorldEntity, buffed_npc: NonPlayerCharacter, time_passed: Millis): self.time_since_start += time_passed if not self.has_teleport_happened and self.time_since_start > PORTAL_DELAY / 2: self.has_teleport_happened = True game_state.warp_points = [] game_state.player_entity.set_position(self.destination) game_state.visual_effects += create_teleport_effects(buffed_entity.get_center_position()) play_sound(SoundId.WARP)
def apply_start_effect(self, game_state: GameState, buffed_entity: WorldEntity, buffed_npc: NonPlayerCharacter): game_state.player_state.stun_status.add_one() player_entity = game_state.player_entity player_entity.set_not_moving() player_entity.visible = False game_state.visual_effects += create_teleport_effects(buffed_entity.get_center_position()) player_collision_rect = (player_entity.pygame_collision_rect.w, player_entity.pygame_collision_rect.h) home_warp_point = create_warp_point(game_state.player_spawn_position, player_collision_rect) remote_warp_point = create_warp_point(player_entity.get_center_position(), player_collision_rect) game_state.warp_points = [home_warp_point, remote_warp_point]
def handle_being_close_to_portal(self, portal: Portal): # When finding a new portal out on the map, it's enough to walk close to it, to activate its sibling if portal.is_enabled: destination_portal = self.game_state.game_world.get_portal_with_id( portal.leads_to) if not destination_portal.is_enabled: play_sound(SoundId.EVENT_PORTAL_ACTIVATED) self.info_message.set_message("Portal was activated") self.activate_portal(destination_portal, portal.world_entity.sprite) self.game_state.game_world.visual_effects += create_teleport_effects( portal.world_entity.get_center_position())
def apply_middle_effect(self, game_state: GameState, buffed_entity: WorldEntity, buffed_npc: NonPlayerCharacter, time_passed: Millis): self.time_since_start += time_passed if not self.has_teleport_happened and self.time_since_start > PORTAL_DELAY / 2: self.has_teleport_happened = True for warp_point in game_state.game_world.warp_points: warp_point.make_visible() game_state.game_world.player_entity.set_position(self.destination) game_state.game_world.visual_effects += create_teleport_effects( buffed_entity.get_center_position())