Esempio n. 1
0
 def randomize(self):
   options_completed = 0
   yield("Modifying game code...", options_completed)
   
   if not self.dry_run:
     self.apply_necessary_tweaks()
     
     if self.options.get("swift_sail"):
       tweaks.make_sail_behave_like_swift_sail(self)
     if self.options.get("instant_text_boxes"):
       tweaks.make_all_text_instant(self)
     if self.options.get("reveal_full_sea_chart"):
       tweaks.apply_patch(self, "reveal_sea_chart")
     if self.options.get("add_shortcut_warps_between_dungeons"):
       tweaks.add_inter_dungeon_warp_pots(self)
     if self.options.get("invert_camera_x_axis"):
       tweaks.apply_patch(self, "invert_camera_x_axis")
     tweaks.update_skip_rematch_bosses_game_variable(self)
     tweaks.update_sword_mode_game_variable(self)
     if self.options.get("sword_mode") == "Swordless":
       tweaks.apply_patch(self, "swordless")
       tweaks.update_text_for_swordless(self)
   
   options_completed += 1
   yield("Randomizing...", options_completed)
   
   if self.options.get("randomize_charts"):
     charts.randomize_charts(self)
   
   if self.options.get("randomize_starting_island"):
     starting_island.randomize_starting_island(self)
   
   if self.options.get("randomize_dungeon_entrances"):
     dungeon_entrances.randomize_dungeon_entrances(self)
   
   items.randomize_items(self)
   
   options_completed += 2
   yield("Saving items...", options_completed)
   
   if not self.dry_run:
     items.write_changed_items(self)
   
   if not self.dry_run:
     self.apply_necessary_post_randomization_tweaks()
   
   options_completed += 7
   yield("Saving randomized ISO...", options_completed)
   
   if not self.dry_run:
     self.save_randomized_iso()
   
   options_completed += 9
   yield("Writing logs...", options_completed)
   
   if self.options.get("generate_spoiler_log"):
     self.write_spoiler_log()
   self.write_non_spoiler_log()
   
   yield("Done", -1)
Esempio n. 2
0
    def randomize(self):
        options_completed = 0
        yield ("Modifying game code...", options_completed)

        if not self.dry_run:
            self.apply_necessary_tweaks()

            if self.options.get("swift_sail"):
                tweaks.make_sail_behave_like_swift_sail(self)
            if self.options.get("instant_text_boxes"):
                tweaks.make_all_text_instant(self)
            if self.options.get("reveal_full_sea_chart"):
                tweaks.apply_patch(self, "reveal_sea_chart")
            if self.options.get("add_shortcut_warps_between_dungeons"):
                tweaks.add_inter_dungeon_warp_pots(self)
            if self.options.get("invert_camera_x_axis"):
                tweaks.apply_patch(self, "invert_camera_x_axis")
            tweaks.update_skip_rematch_bosses_game_variable(self)
            tweaks.update_sword_mode_game_variable(self)
            if self.options.get("sword_mode") == "Swordless":
                tweaks.apply_patch(self, "swordless")
                tweaks.update_text_for_swordless(self)
            if self.options.get("randomize_entrances") not in [
                    "Disabled", None, "Dungeons"
            ]:
                tweaks.disable_ice_ring_isle_and_fire_mountain_effects_indoors(
                    self)
            tweaks.update_starting_gear(self)
            if self.options.get("disable_tingle_chests_with_tingle_bombs"):
                tweaks.apply_patch(self,
                                   "disable_tingle_bombs_on_tingle_chests")

            if self.test_room_args is not None:
                tweaks.test_room(self)

        options_completed += 1
        yield ("Randomizing...", options_completed)

        if self.options.get("randomize_charts"):
            charts.randomize_charts(self)

        if self.options.get("randomize_starting_island"):
            starting_island.randomize_starting_island(self)

        if self.options.get("randomize_entrances") not in ["Disabled", None]:
            entrances.randomize_entrances(self)

        if self.options.get("randomize_bgm"):
            bgm.randomize_bgm(self)

        items.randomize_items(self)

        options_completed += 2
        yield ("Saving items...", options_completed)

        if not self.dry_run:
            items.write_changed_items(self)

        if not self.dry_run:
            self.apply_necessary_post_randomization_tweaks()

        options_completed += 7
        yield ("Saving randomized ISO...", options_completed)

        if not self.dry_run:
            self.save_randomized_iso()

        options_completed += 9
        yield ("Writing logs...", options_completed)

        if self.options.get("generate_spoiler_log"):
            self.write_spoiler_log()
        self.write_non_spoiler_log()

        yield ("Done", -1)
Esempio n. 3
0
    def randomize(self):
        options_completed = 0
        yield ("Modifying game code...", options_completed)

        customizer.decide_on_link_model(self)

        if not self.dry_run:
            self.apply_necessary_tweaks()

            if self.options.get("swift_sail"):
                tweaks.make_sail_behave_like_swift_sail(self)
            if self.options.get("instant_text_boxes"):
                tweaks.make_all_text_instant(self)
            if self.options.get("reveal_full_sea_chart"):
                tweaks.apply_patch(self, "reveal_sea_chart")
            if self.options.get("add_shortcut_warps_between_dungeons"):
                tweaks.add_inter_dungeon_warp_pots(self)
            if self.options.get("invert_camera_x_axis"):
                tweaks.apply_patch(self, "invert_camera_x_axis")
            tweaks.update_skip_rematch_bosses_game_variable(self)
            tweaks.update_sword_mode_game_variable(self)
            if self.options.get("sword_mode") == "Swordless":
                tweaks.apply_patch(self, "swordless")
                tweaks.update_text_for_swordless(self)
            if self.options.get("randomize_entrances") not in [
                    "Disabled", None, "Dungeons"
            ]:
                tweaks.disable_ice_ring_isle_and_fire_mountain_effects_indoors(
                    self)
            tweaks.update_starting_gear(self)
            if self.options.get("disable_tingle_chests_with_tingle_bombs"):
                tweaks.apply_patch(self,
                                   "disable_tingle_bombs_on_tingle_chests")
            if self.options.get("remove_title_and_ending_videos"):
                tweaks.remove_title_and_ending_videos(self)
            if self.options.get("remove_music"):
                tweaks.apply_patch(self, "remove_music")
            if self.map_select:
                tweaks.apply_patch(self, "map_select")
            if IS_RUNNING_FROM_SOURCE:
                tweaks.enable_developer_mode(self)

            if self.test_room_args is not None:
                tweaks.test_room(self)
        options_completed += 1

        yield ("Randomizing...", options_completed)

        if self.options.get("randomize_charts"):
            charts.randomize_charts(self)

        if self.options.get("randomize_starting_island"):
            starting_island.randomize_starting_island(self)

        if self.options.get("randomize_entrances") not in ["Disabled", None]:
            entrances.randomize_entrances(self)

        if self.options.get("randomize_music"):
            music.randomize_music(self)

        options_completed += 1

        # Enemies must be randomized before items in order for the enemy logic to properly take into account what items you do and don't start with.
        if self.options.get("randomize_enemies"):
            yield ("Randomizing enemy locations...", options_completed)
            enemies.randomize_enemies(self)

        if self.options.get("randomize_enemy_palettes"):
            yield ("Randomizing enemy colors...", options_completed)
            palettes.randomize_enemy_palettes(self)
            options_completed += 10

        # Reset RNG before doing item randomization so other randomization options don't affect item layout.
        self.rng = self.get_new_rng()

        yield ("Randomizing items...", options_completed)
        if self.randomize_items:
            items.randomize_items(self)

        options_completed += 2

        yield ("Saving items...", options_completed)
        if self.randomize_items and not self.dry_run:
            items.write_changed_items(self)

        if not self.dry_run:
            self.apply_necessary_post_randomization_tweaks()
        options_completed += 7

        yield ("Saving randomized ISO...", options_completed)
        if not self.dry_run:
            self.save_randomized_iso()
        options_completed += 9
        yield ("Writing logs...", options_completed)

        if self.randomize_items:
            if not self.options.get("do_not_generate_spoiler_log"):
                self.write_spoiler_log()
            self.write_non_spoiler_log()

        yield ("Done", -1)
Esempio n. 4
0
 def randomize(self):
   options_completed = 0
   yield("Modifying game code...", options_completed)
   
   customizer.decide_on_link_model(self)
   
   if not self.dry_run:
     self.apply_necessary_tweaks()
     
     if self.options.get("swift_sail"):
       tweaks.make_sail_behave_like_swift_sail(self)
     if self.options.get("instant_text_boxes"):
       tweaks.make_all_text_instant(self)
     if self.options.get("reveal_full_sea_chart"):
       patcher.apply_patch(self, "reveal_sea_chart")
     if self.options.get("add_shortcut_warps_between_dungeons"):
       tweaks.add_inter_dungeon_warp_pots(self)
     if self.options.get("invert_camera_x_axis"):
       patcher.apply_patch(self, "invert_camera_x_axis")
     tweaks.update_skip_rematch_bosses_game_variable(self)
     tweaks.update_sword_mode_game_variable(self)
     if self.options.get("sword_mode") == "Swordless":
       patcher.apply_patch(self, "swordless")
       tweaks.update_text_for_swordless(self)
     if self.options.get("randomize_entrances") not in ["Disabled", None, "Dungeons"]:
       tweaks.disable_ice_ring_isle_and_fire_mountain_effects_indoors(self)
     tweaks.update_starting_gear(self)
     if self.options.get("disable_tingle_chests_with_tingle_bombs"):
       patcher.apply_patch(self, "disable_tingle_bombs_on_tingle_chests")
     if self.options.get("remove_title_and_ending_videos"):
       tweaks.remove_title_and_ending_videos(self)
     if self.options.get("remove_music"):
       patcher.apply_patch(self, "remove_music")
     if self.map_select:
       patcher.apply_patch(self, "map_select")
     if IS_RUNNING_FROM_SOURCE or "BETA" in VERSION_WITHOUT_COMMIT:
       tweaks.enable_developer_mode(self)
     if self.heap_display:
       tweaks.enable_heap_display(self)
     
     if self.test_room_args is not None:
       tweaks.test_room(self)
   options_completed += 1
   
   yield("Randomizing...", options_completed)
   
   if self.options.get("randomize_charts"):
     self.reset_rng()
     charts.randomize_charts(self)
   
   if self.options.get("randomize_starting_island"):
     self.reset_rng()
     starting_island.randomize_starting_island(self)
   
   if self.options.get("randomize_entrances") not in ["Disabled", None]:
     self.reset_rng()
     entrances.randomize_entrances(self)
   
   if self.options.get("randomize_music"):
     self.reset_rng()
     music.randomize_music(self)
   
   options_completed += 1
   
   # Enemies must be randomized before items in order for the enemy logic to properly take into account what items you do and don't start with.
   if self.options.get("randomize_enemies"):
     yield("Randomizing enemy locations...", options_completed)
     self.reset_rng()
     enemies.randomize_enemies(self)
   
   if self.options.get("randomize_enemy_palettes"):
     yield("Randomizing enemy colors...", options_completed)
     self.reset_rng()
     palettes.randomize_enemy_palettes(self)
     options_completed += 10
   
   yield("Randomizing items...", options_completed)
   if self.randomize_items:
     self.reset_rng()
     items.randomize_items(self)
   
   options_completed += 2
   
   yield("Saving items...", options_completed)
   if self.randomize_items and not self.dry_run:
     items.write_changed_items(self)
     tweaks.randomize_and_update_hints(self)
   
   if not self.dry_run:
     self.apply_necessary_post_randomization_tweaks()
   options_completed += 7
   
   yield("Saving randomized ISO...", options_completed)
   if not self.dry_run:
     generator = self.save_randomized_iso()
     while True:
       # Need to use a while loop to go through the generator instead of a for loop, as a for loop would silently exit if a StopIteration error ever happened for any reason.
       next_progress_text, files_done = next(generator)
       if files_done == -1:
         break
       percentage_done = files_done/len(self.gcm.files_by_path)
       yield("Saving randomized ISO...", options_completed+int(percentage_done*9))
   options_completed += 9
   yield("Writing logs...", options_completed)
   
   if self.randomize_items:
     if not self.options.get("do_not_generate_spoiler_log"):
       self.write_spoiler_log()
     self.write_non_spoiler_log()
   
   yield("Done", -1)