def get_layout_configuration_from_args(args) -> LayoutConfiguration: return LayoutConfiguration.from_params( trick_level=LayoutTrickLevel(args.trick_level), sky_temple_keys=LayoutSkyTempleKeyMode(args.sky_temple_keys), elevators=LayoutRandomizedFlag.VANILLA, pickup_quantities={}, starting_location=StartingLocation.default(), starting_resources=StartingResources.from_item_loss( not args.skip_item_loss), )
def _on_sky_temple_key_combo_changed(self): combo_enum = self.skytemple_combo.currentData() with self._options: if combo_enum is int: self.skytemple_slider.setEnabled(True) self._options.layout_configuration_sky_temple_keys = LayoutSkyTempleKeyMode( self.skytemple_slider.value()) else: self.skytemple_slider.setEnabled(False) self._options.layout_configuration_sky_temple_keys = combo_enum
def get_layout_configuration_from_args(args) -> LayoutConfiguration: try: sky_temple_keys = int(args.sky_temple_keys) except ValueError: sky_temple_keys = args.sky_temple_keys # TODO: support for item loss return LayoutConfiguration.from_params( trick_level_configuration=TrickLevelConfiguration( LayoutTrickLevel(args.trick_level)), sky_temple_keys=LayoutSkyTempleKeyMode(sky_temple_keys), elevators=LayoutElevators.VANILLA, starting_location=StartingLocation.default(), )
def add_layout_configuration_arguments(parser: ArgumentParser): parser.add_argument("--trick-level", type=str, choices=[layout.value for layout in LayoutTrickLevel], default=LayoutTrickLevel.NO_TRICKS.value, help="The level of tricks to use.") parser.add_argument( "--sky-temple-keys", type=str, choices=[str(mode.value) for mode in LayoutSkyTempleKeyMode], default=LayoutSkyTempleKeyMode.default().value, help="The Sky Temple Keys randomization mode.") parser.add_argument( "--skip-item-loss", action="store_true", help="Disables the item loss cutscene, disabling losing your items.")
def test_sky_temple_key_distribution_logic_with_quantity( echoes_resource_database, quantity: int): # Run results = sky_temple_keys.add_sky_temple_key_distribution_logic( echoes_resource_database, LayoutSkyTempleKeyMode(quantity)) item_pool, pickup_assignment, initial_items = results # Assert assert item_pool == [ pickup_creator.create_sky_temple_key(i, echoes_resource_database) for i in range(quantity) ] assert pickup_assignment == {} assert initial_items == { ItemResourceInfo( randovania.games.prime.echoes_items.SKY_TEMPLE_KEY_ITEMS[i - 1], f'Sky Temple Key {i}', f'TempleKey{i}', 1, None): 1 for i in range(quantity + 1, 10) }
from randovania.interface_common.preset_editor import PresetEditor from randovania.layout.layout_configuration import LayoutConfiguration, LayoutElevators, \ LayoutSkyTempleKeyMode from randovania.layout.starting_location import StartingLocation from randovania.layout.trick_level import LayoutTrickLevel, TrickLevelConfiguration @pytest.fixture(name="editor") def _editor() -> PresetEditor: return PresetEditor(MagicMock()) _sample_layout_configurations = [ { "trick_level_configuration": TrickLevelConfiguration(trick_level), "sky_temple_keys": LayoutSkyTempleKeyMode.default(), "elevators": LayoutElevators.TWO_WAY_RANDOMIZED, } for trick_level in [LayoutTrickLevel.NO_TRICKS, LayoutTrickLevel.HARD, LayoutTrickLevel.MINIMAL_RESTRICTIONS] ] @pytest.fixture(params=_sample_layout_configurations, name="initial_layout_configuration_params") def _initial_layout_configuration_params(request) -> dict: return request.param @pytest.mark.parametrize("new_trick_level", [LayoutTrickLevel.NO_TRICKS, LayoutTrickLevel.TRIVIAL, LayoutTrickLevel.HYPERMODE]) def test_edit_layout_trick_level(editor: PresetEditor, initial_layout_configuration_params: dict,
# Assert assert result == { "version": randovania.interface_common.persisted_options. _CURRENT_OPTIONS_FILE_VERSION, "options": { "last_changelog_displayed": str(update_checker.strict_current_version()), } } _sample_layout_configurations = [{ "trick_level_configuration": TrickLevelConfiguration(trick_level), "sky_temple_keys": LayoutSkyTempleKeyMode.default(), "elevators": LayoutElevators.RANDOMIZED, "starting_location": StartingLocation.default(), } for trick_level in [ LayoutTrickLevel.NO_TRICKS, LayoutTrickLevel.HARD, LayoutTrickLevel.MINIMAL_RESTRICTIONS ]] @pytest.fixture(params=_sample_layout_configurations, name="initial_layout_configuration_params") def _initial_layout_configuration_params(request) -> dict: return request.param