Exemplo n.º 1
0
 def on_preset_changed(self, preset: Preset):
     keys = preset.configuration.sky_temple_keys
     if isinstance(keys.value, int):
         self.skytemple_slider.setValue(keys.value)
         data = int
     else:
         data = keys
     set_combo_with_value(self.skytemple_combo, data)
    def on_preset_changed(self, preset: Preset):
        config = preset.configuration
        assert isinstance(config, EchoesConfiguration)

        for identifier, combo in self._combo_for_gate.items():
            set_combo_with_value(
                combo, config.translator_configuration.
                translator_requirement[identifier])
Exemplo n.º 3
0
    def on_preset_changed(self, preset: Preset):
        layout = preset.configuration

        self.multi_pickup_placement_check.setChecked(layout.multi_pickup_placement)
        self.local_first_progression_check.setChecked(layout.first_progression_must_be_local)
        self.check_major_minor.setChecked(
            layout.available_locations.randomization_mode == RandomizationMode.MAJOR_MINOR_SPLIT)

        self.trick_level_minimal_logic_check.setChecked(layout.trick_level.minimal_logic)
        common_qt_lib.set_combo_with_value(self.dangerous_combo, layout.logical_resource_action)

        common_qt_lib.set_combo_with_value(self.damage_strictness_combo, preset.configuration.damage_strictness)
Exemplo n.º 4
0
    def on_preset_changed(self, preset: Preset):
        for extra_tab in self._extra_tabs:
            extra_tab.on_preset_changed(preset)

        # Variables
        config = preset.configuration

        # Title
        common_qt_lib.set_edit_if_different(self.name_edit, preset.name)

        # Trick Level
        trick_level_configuration = preset.configuration.trick_level
        self.trick_level_minimal_logic_check.setChecked(trick_level_configuration.minimal_logic)

        for trick, slider in self._slider_for_trick.items():
            assert self._slider_for_trick[trick] is slider
            slider.setValue(trick_level_configuration.level_for_trick(trick).as_number)
            slider.setEnabled(not trick_level_configuration.minimal_logic)

        # Damage
        set_combo_with_value(self.damage_strictness_combo, config.damage_strictness)
        self.energy_tank_capacity_spin_box.setValue(config.energy_per_tank)

        if self.game_enum == RandovaniaGame.PRIME2:
            self.dangerous_tank_check.setChecked(config.dangerous_energy_tank)
            self.safe_zone_logic_heal_check.setChecked(config.safe_zone.fully_heal)
            self.safe_zone_regen_spin.setValue(config.safe_zone.heal_per_second)
            self.varia_suit_spin_box.setValue(config.varia_suit_damage)
            self.dark_suit_spin_box.setValue(config.dark_suit_damage)

        elif self.game_enum == RandovaniaGame.PRIME1:
            self.progressive_damage_reduction_check.setChecked(config.progressive_damage_reduction)
            self.heated_damage_varia_check.setChecked(config.heat_protection_only_varia)
            self.heated_damage_spin.setValue(config.heat_damage)

        # Elevator
        self.on_preset_changed_elevators(preset)

        # Starting Area
        self.on_preset_changed_starting_area(preset)

        # Location Pool
        available_locations = config.available_locations
        set_combo_with_value(self.randomization_mode_combo, available_locations.randomization_mode)

        self._during_batch_check_update = True
        for node, check in self._location_pool_for_node.items():
            check.setChecked(node.pickup_index not in available_locations.excluded_indices)
            check.setEnabled(available_locations.randomization_mode == RandomizationMode.FULL or node.major_location)
        self._during_batch_check_update = False
Exemplo n.º 5
0
    def on_preset_changed(self, preset: Preset):
        dock_rando = preset.configuration.dock_rando
        common_qt_lib.set_combo_with_value(self.mode_combo, dock_rando.mode)
        self.mode_description.setText(dock_rando.mode.description)

        for dock_type, weakness_checks in self.type_checks.items():
            state = dock_rando.types_state[dock_type]
            for weakness, checks in weakness_checks.items():
                if "can_change_from" in checks:
                    checks["can_change_from"].setChecked(
                        weakness in state.can_change_from)
                if "can_change_to" in checks:
                    checks["can_change_to"].setChecked(
                        weakness in state.can_change_to)
Exemplo n.º 6
0
    def on_preset_changed_elevators(self, preset: Preset):
        config = preset.configuration

        set_combo_with_value(self.elevators_combo, config.elevators.mode)
        can_shuffle_target = config.elevators.mode not in (TeleporterShuffleMode.VANILLA,
                                                           TeleporterShuffleMode.TWO_WAY_RANDOMIZED,
                                                           TeleporterShuffleMode.TWO_WAY_UNCHECKED)
        static_areas = set(
            teleporter
            for teleporter in config.elevators.static_teleporters.keys()
        )

        for origin, destination in self._elevator_source_destination.items():
            origin_check = self._elevator_source_for_location[origin]
            dest_check = self._elevator_source_for_location.get(destination)

            is_locked = origin in static_areas
            if not can_shuffle_target:
                is_locked = is_locked or destination in static_areas

            origin_check.setEnabled(not config.elevators.is_vanilla and not is_locked)
            origin_check.setChecked(origin not in config.elevators.excluded_teleporters.locations and not is_locked)

            origin_check.setToolTip("The destination for this teleporter is locked due to other settings."
                                    if is_locked else "")

            if dest_check is None:
                if not can_shuffle_target:
                    origin_check.setEnabled(False)
                continue

            dest_check.setEnabled(can_shuffle_target and destination not in static_areas)
            if can_shuffle_target:
                dest_check.setChecked(destination not in config.elevators.excluded_teleporters.locations
                                      and destination not in static_areas)
            else:
                dest_check.setChecked(origin_check.isChecked())

        self.elevators_target_group.setEnabled(config.elevators.has_shuffled_target)
        self.skip_final_bosses_check.setChecked(config.elevators.skip_final_bosses)
        self.elevators_allow_unvisited_names_check.setChecked(config.elevators.allow_unvisited_room_names)
        self._update_area_list(
            config.elevators.excluded_targets.locations,
            True,
            self._elevator_target_for_world,
            self._elevator_target_for_area,
        )
Exemplo n.º 7
0
 def on_preset_changed(self, preset: Preset):
     set_combo_with_value(self.hint_sky_temple_key_combo, preset.configuration.hints.sky_temple_keys)
Exemplo n.º 8
0
 def on_preset_changed(self, preset: Preset):
     set_combo_with_value(self.hint_artifact_combo,
                          preset.configuration.hints.artifacts)
     set_combo_with_value(self.phazon_suit_hint_combo,
                          preset.configuration.hints.phazon_suit)
Exemplo n.º 9
0
 def on_preset_changed(self, preset: Preset):
     translator_configuration = preset.configuration.translator_configuration
     for gate, combo in self._combo_for_gate.items():
         set_combo_with_value(
             combo, translator_configuration.translator_requirement[gate])
Exemplo n.º 10
0
    def on_preset_changed(self, preset: Preset):
        self._main_rules.on_preset_changed(preset)
        self._game_patches.on_preset_changed(preset)

        # Variables
        layout_config = preset.layout_configuration
        patcher_config = preset.patcher_configuration

        # Title
        common_qt_lib.set_edit_if_different(self.name_edit, preset.name)

        # Trick Level
        trick_level_configuration = preset.layout_configuration.trick_level_configuration
        trick_level = trick_level_configuration.global_level

        set_combo_with_value(self.logic_combo_box, trick_level)
        self.logic_level_label.setText(
            _get_trick_level_description(trick_level))

        for (trick, checkbox), slider in zip(self._checkbox_for_trick.items(),
                                             self._slider_for_trick.values()):
            assert self._slider_for_trick[trick] is slider

            has_specific_level = trick_level_configuration.has_specific_level_for_trick(
                trick)

            checkbox.setEnabled(
                trick_level != LayoutTrickLevel.MINIMAL_RESTRICTIONS)
            slider.setEnabled(has_specific_level)
            slider.setValue(
                trick_level_configuration.level_for_trick(trick).as_number)
            checkbox.setChecked(has_specific_level)

        # Damage
        set_combo_with_value(self.damage_strictness_combo,
                             layout_config.damage_strictness)
        self.energy_tank_capacity_spin_box.setValue(
            layout_config.energy_per_tank)
        self.varia_suit_spin_box.setValue(patcher_config.varia_suit_damage)
        self.dark_suit_spin_box.setValue(patcher_config.dark_suit_damage)

        # Elevator
        set_combo_with_value(self.elevators_combo, layout_config.elevators)

        # Sky Temple Keys
        keys = layout_config.sky_temple_keys
        if isinstance(keys.value, int):
            self.skytemple_slider.setValue(keys.value)
            data = int
        else:
            data = keys
        set_combo_with_value(self.skytemple_combo, data)

        # Starting Area
        starting_locations = layout_config.starting_location.locations

        self._during_batch_check_update = True
        for world in self.game_description.world_list.worlds:
            for area in world.areas:
                is_checked = AreaLocation(
                    world.world_asset_id,
                    area.area_asset_id) in starting_locations
                self._starting_location_for_area[
                    area.area_asset_id].setChecked(is_checked)
        self._during_batch_check_update = False

        # Location Pool
        available_locations = layout_config.available_locations
        set_combo_with_value(self.randomization_mode_combo,
                             available_locations.randomization_mode)

        self._during_batch_check_update = True
        for node, check in self._location_pool_for_node.items():
            check.setChecked(
                node.pickup_index not in available_locations.excluded_indices)
            check.setEnabled(available_locations.randomization_mode
                             == RandomizationMode.FULL or node.major_location)
        self._during_batch_check_update = False

        # Translator Gates
        translator_configuration = preset.layout_configuration.translator_configuration
        for gate, combo in self._combo_for_gate.items():
            set_combo_with_value(
                combo, translator_configuration.translator_requirement[gate])

        # Hints
        set_combo_with_value(self.hint_sky_temple_key_combo,
                             preset.layout_configuration.hints.sky_temple_keys)

        # Beam Configuration
        self.on_preset_changed_beam_configuration(preset)
Exemplo n.º 11
0
    def on_preset_changed(self, preset: Preset):
        self._main_rules.on_preset_changed(preset)
        self._game_patches.on_preset_changed(preset)

        # Variables
        layout_config = preset.layout_configuration
        patcher_config = preset.patcher_configuration

        # Title
        common_qt_lib.set_edit_if_different(self.name_edit, preset.name)

        # Trick Level
        trick_level_configuration = preset.layout_configuration.trick_level_configuration
        self.trick_level_minimal_logic_check.setChecked(
            trick_level_configuration.minimal_logic)

        for trick, slider in self._slider_for_trick.items():
            assert self._slider_for_trick[trick] is slider
            slider.setValue(
                trick_level_configuration.level_for_trick(trick).as_number)
            slider.setEnabled(not trick_level_configuration.minimal_logic)

        # Damage
        set_combo_with_value(self.damage_strictness_combo,
                             layout_config.damage_strictness)
        self.energy_tank_capacity_spin_box.setValue(
            layout_config.energy_per_tank)
        self.safe_zone_logic_heal_check.setChecked(
            layout_config.safe_zone.fully_heal)
        self.safe_zone_regen_spin.setValue(
            layout_config.safe_zone.heal_per_second)
        self.varia_suit_spin_box.setValue(patcher_config.varia_suit_damage)
        self.dark_suit_spin_box.setValue(patcher_config.dark_suit_damage)

        # Elevator
        set_combo_with_value(self.elevators_combo, layout_config.elevators)

        # Sky Temple Keys
        keys = layout_config.sky_temple_keys
        if isinstance(keys.value, int):
            self.skytemple_slider.setValue(keys.value)
            data = int
        else:
            data = keys
        set_combo_with_value(self.skytemple_combo, data)

        # Starting Area
        starting_locations = layout_config.starting_location.locations

        self._during_batch_check_update = True
        for world in self.game_description.world_list.worlds:
            for is_dark_world in [False, True]:
                all_areas = True
                no_areas = True
                areas = [
                    area for area in world.areas
                    if area.in_dark_aether == is_dark_world
                ]
                correct_name = world.correct_name(is_dark_world)
                for area in areas:
                    if area.valid_starting_location:
                        is_checked = AreaLocation(
                            world.world_asset_id,
                            area.area_asset_id) in starting_locations
                        if is_checked:
                            no_areas = False
                        else:
                            all_areas = False
                        self._starting_location_for_area[
                            area.area_asset_id].setChecked(is_checked)
                if all_areas:
                    self._starting_location_for_world[
                        correct_name].setCheckState(Qt.Checked)
                elif no_areas:
                    self._starting_location_for_world[
                        correct_name].setCheckState(Qt.Unchecked)
                else:
                    self._starting_location_for_world[
                        correct_name].setCheckState(Qt.PartiallyChecked)
        self._during_batch_check_update = False

        # Location Pool
        available_locations = layout_config.available_locations
        set_combo_with_value(self.randomization_mode_combo,
                             available_locations.randomization_mode)

        self._during_batch_check_update = True
        for node, check in self._location_pool_for_node.items():
            check.setChecked(
                node.pickup_index not in available_locations.excluded_indices)
            check.setEnabled(available_locations.randomization_mode
                             == RandomizationMode.FULL or node.major_location)
        self._during_batch_check_update = False

        # Translator Gates
        translator_configuration = preset.layout_configuration.translator_configuration
        for gate, combo in self._combo_for_gate.items():
            set_combo_with_value(
                combo, translator_configuration.translator_requirement[gate])

        # Hints
        set_combo_with_value(self.hint_sky_temple_key_combo,
                             preset.layout_configuration.hints.sky_temple_keys)

        # Beam Configuration
        self.on_preset_changed_beam_configuration(preset)
 def on_new_cosmetic_patches(self, patches: CSCosmeticPatches):
     set_combo_with_value(self.music_type_combo, patches.music_rando.randomization_type)
     self._set_mychar(patches.mychar)
     self._read_songs(patches.music_rando.song_status)