diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab94326d8188..27ca76e41f8f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,7 +31,8 @@ jobs: - name: Install python uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '~3.12.7' + check-latest: true - name: Download run-time dependencies run: | Invoke-WebRequest -Uri https://github.com/Ijwu/Enemizer/releases/download/${Env:ENEMIZER_VERSION}/win-x64.zip -OutFile enemizer.zip @@ -111,7 +112,8 @@ jobs: - name: Get a recent python uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '~3.12.7' + check-latest: true - name: Install build-time dependencies run: | echo "PYTHON=python3.12" >> $GITHUB_ENV diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b28ec8733408..aec4f90998cf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,7 +44,8 @@ jobs: - name: Get a recent python uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '~3.12.7' + check-latest: true - name: Install build-time dependencies run: | echo "PYTHON=python3.12" >> $GITHUB_ENV diff --git a/BaseClasses.py b/BaseClasses.py index 700a21506ac8..98ada4f861ec 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -604,6 +604,49 @@ def get_spheres(self) -> Iterator[Set[Location]]: state.collect(location.item, True, location) locations -= sphere + def get_sendable_spheres(self) -> Iterator[Set[Location]]: + """ + yields a set of multiserver sendable locations (location.item.code: int) for each logical sphere + + If there are unreachable locations, the last sphere of reachable locations is followed by an empty set, + and then a set of all of the unreachable locations. + """ + state = CollectionState(self) + locations: Set[Location] = set() + events: Set[Location] = set() + for location in self.get_filled_locations(): + if type(location.item.code) is int: + locations.add(location) + else: + events.add(location) + + while locations: + sphere: Set[Location] = set() + + # cull events out + done_events: Set[Union[Location, None]] = {None} + while done_events: + done_events = set() + for event in events: + if event.can_reach(state): + state.collect(event.item, True, event) + done_events.add(event) + events -= done_events + + for location in locations: + if location.can_reach(state): + sphere.add(location) + + yield sphere + if not sphere: + if locations: + yield locations # unreachable locations + break + + for location in sphere: + state.collect(location.item, True, location) + locations -= sphere + def fulfills_accessibility(self, state: Optional[CollectionState] = None): """Check if accessibility rules are fulfilled with current or supplied state.""" if not state: @@ -1545,7 +1588,7 @@ def write_option(option_key: str, option_obj: Options.AssembleOptions) -> None: [f" {location}: {item}" for (location, item) in sphere.items()] if isinstance(sphere, dict) else [f" {item}" for item in sphere])) for (sphere_nr, sphere) in self.playthrough.items()])) if self.unreachables: - outfile.write('\n\nUnreachable Items:\n\n') + outfile.write('\n\nUnreachable Progression Items:\n\n') outfile.write( '\n'.join(['%s: %s' % (unreachable.item, unreachable) for unreachable in self.unreachables])) diff --git a/Fill.py b/Fill.py index 912b4d05bed9..86a4639c51ce 100644 --- a/Fill.py +++ b/Fill.py @@ -36,7 +36,8 @@ def sweep_from_pool(base_state: CollectionState, itempool: typing.Sequence[Item] def fill_restrictive(multiworld: MultiWorld, base_state: CollectionState, locations: typing.List[Location], item_pool: typing.List[Item], single_player_placement: bool = False, lock: bool = False, swap: bool = True, on_place: typing.Optional[typing.Callable[[Location], None]] = None, - allow_partial: bool = False, allow_excluded: bool = False, name: str = "Unknown") -> None: + allow_partial: bool = False, allow_excluded: bool = False, one_item_per_player: bool = True, + name: str = "Unknown") -> None: """ :param multiworld: Multiworld to be filled. :param base_state: State assumed before fill. @@ -63,14 +64,22 @@ def fill_restrictive(multiworld: MultiWorld, base_state: CollectionState, locati placed = 0 while any(reachable_items.values()) and locations: - # grab one item per player - items_to_place = [items.pop() - for items in reachable_items.values() if items] + if one_item_per_player: + # grab one item per player + items_to_place = [items.pop() + for items in reachable_items.values() if items] + else: + next_player = multiworld.random.choice([player for player, items in reachable_items.items() if items]) + items_to_place = [] + if item_pool: + items_to_place.append(reachable_items[next_player].pop()) + for item in items_to_place: for p, pool_item in enumerate(item_pool): if pool_item is item: item_pool.pop(p) break + maximum_exploration_state = sweep_from_pool( base_state, item_pool + unplaced_items, multiworld.get_filled_locations(item.player) if single_player_placement else None) @@ -480,7 +489,8 @@ def mark_for_locking(location: Location): if prioritylocations: # "priority fill" fill_restrictive(multiworld, multiworld.state, prioritylocations, progitempool, - single_player_placement=single_player, swap=False, on_place=mark_for_locking, name="Priority") + single_player_placement=single_player, swap=False, on_place=mark_for_locking, + name="Priority", one_item_per_player=False) accessibility_corrections(multiworld, multiworld.state, prioritylocations, progitempool) defaultlocations = prioritylocations + defaultlocations diff --git a/Generate.py b/Generate.py index 8aba72abafe9..35c39627b139 100644 --- a/Generate.py +++ b/Generate.py @@ -114,7 +114,14 @@ def main(args=None) -> Tuple[argparse.Namespace, int]: os.path.join(args.player_files_path, fname) not in {args.meta_file_path, args.weights_file_path}: path = os.path.join(args.player_files_path, fname) try: - weights_cache[fname] = read_weights_yamls(path) + weights_for_file = [] + for doc_idx, yaml in enumerate(read_weights_yamls(path)): + if yaml is None: + logging.warning(f"Ignoring empty yaml document #{doc_idx + 1} in {fname}") + else: + weights_for_file.append(yaml) + weights_cache[fname] = tuple(weights_for_file) + except Exception as e: raise ValueError(f"File {fname} is invalid. Please fix your yaml.") from e diff --git a/Launcher.py b/Launcher.py index f04d67a5aa0d..22c0944ab1a4 100644 --- a/Launcher.py +++ b/Launcher.py @@ -126,12 +126,13 @@ def handle_uri(path: str, launch_args: Tuple[str, ...]) -> None: elif component.display_name == "Text Client": text_client_component = component - from kvui import App, Button, BoxLayout, Label, Clock, Window + if client_component is None: + run_component(text_client_component, *launch_args) + return - class Popup(App): - timer_label: Label - remaining_time: Optional[int] + from kvui import App, Button, BoxLayout, Label, Window + class Popup(App): def __init__(self): self.title = "Connect to Multiworld" self.icon = r"data/icon.png" @@ -139,48 +140,25 @@ def __init__(self): def build(self): layout = BoxLayout(orientation="vertical") + layout.add_widget(Label(text="Select client to open and connect with.")) + button_row = BoxLayout(orientation="horizontal", size_hint=(1, 0.4)) - if client_component is None: - self.remaining_time = 7 - label_text = (f"A game client able to parse URIs was not detected for {game}.\n" - f"Launching Text Client in 7 seconds...") - self.timer_label = Label(text=label_text) - layout.add_widget(self.timer_label) - Clock.schedule_interval(self.update_label, 1) - else: - layout.add_widget(Label(text="Select client to open and connect with.")) - button_row = BoxLayout(orientation="horizontal", size_hint=(1, 0.4)) - - text_client_button = Button( - text=text_client_component.display_name, - on_release=lambda *args: run_component(text_client_component, *launch_args) - ) - button_row.add_widget(text_client_button) + text_client_button = Button( + text=text_client_component.display_name, + on_release=lambda *args: run_component(text_client_component, *launch_args) + ) + button_row.add_widget(text_client_button) - game_client_button = Button( - text=client_component.display_name, - on_release=lambda *args: run_component(client_component, *launch_args) - ) - button_row.add_widget(game_client_button) + game_client_button = Button( + text=client_component.display_name, + on_release=lambda *args: run_component(client_component, *launch_args) + ) + button_row.add_widget(game_client_button) - layout.add_widget(button_row) + layout.add_widget(button_row) return layout - def update_label(self, dt): - if self.remaining_time > 1: - # countdown the timer and string replace the number - self.remaining_time -= 1 - self.timer_label.text = self.timer_label.text.replace( - str(self.remaining_time + 1), str(self.remaining_time) - ) - else: - # our timer is finished so launch text client and close down - run_component(text_client_component, *launch_args) - Clock.unschedule(self.update_label) - App.get_running_app().stop() - Window.close() - def _stop(self, *largs): # see run_gui Launcher _stop comment for details self.root_window.close() @@ -246,9 +224,8 @@ def launch(exe, in_terminal=False): def run_gui(): - from kvui import App, ContainerLayout, GridLayout, Button, Label, ScrollBox, Widget + from kvui import App, ContainerLayout, GridLayout, Button, Label, ScrollBox, Widget, ApAsyncImage from kivy.core.window import Window - from kivy.uix.image import AsyncImage from kivy.uix.relativelayout import RelativeLayout class Launcher(App): @@ -281,8 +258,8 @@ def build_button(component: Component) -> Widget: button.component = component button.bind(on_release=self.component_action) if component.icon != "icon": - image = AsyncImage(source=icon_paths[component.icon], - size=(38, 38), size_hint=(None, 1), pos=(5, 0)) + image = ApAsyncImage(source=icon_paths[component.icon], + size=(38, 38), size_hint=(None, 1), pos=(5, 0)) box_layout = RelativeLayout(size_hint_y=None, height=40) box_layout.add_widget(button) box_layout.add_widget(image) diff --git a/Main.py b/Main.py index 6b94b84c278b..d105bd4ad0e5 100644 --- a/Main.py +++ b/Main.py @@ -153,45 +153,38 @@ def main(args, seed=None, baked_server_options: Optional[Dict[str, object]] = No # remove starting inventory from pool items. # Because some worlds don't actually create items during create_items this has to be as late as possible. - if any(getattr(multiworld.worlds[player].options, "start_inventory_from_pool", None) for player in multiworld.player_ids): - new_items: List[Item] = [] - old_items: List[Item] = [] - depletion_pool: Dict[int, Dict[str, int]] = { - player: getattr(multiworld.worlds[player].options, - "start_inventory_from_pool", - StartInventoryPool({})).value.copy() - for player in multiworld.player_ids - } - for player, items in depletion_pool.items(): - player_world: AutoWorld.World = multiworld.worlds[player] - for count in items.values(): - for _ in range(count): - new_items.append(player_world.create_filler()) - target: int = sum(sum(items.values()) for items in depletion_pool.values()) - for i, item in enumerate(multiworld.itempool): + fallback_inventory = StartInventoryPool({}) + depletion_pool: Dict[int, Dict[str, int]] = { + player: getattr(multiworld.worlds[player].options, "start_inventory_from_pool", fallback_inventory).value.copy() + for player in multiworld.player_ids + } + target_per_player = { + player: sum(target_items.values()) for player, target_items in depletion_pool.items() if target_items + } + + if target_per_player: + new_itempool: List[Item] = [] + + # Make new itempool with start_inventory_from_pool items removed + for item in multiworld.itempool: if depletion_pool[item.player].get(item.name, 0): - target -= 1 depletion_pool[item.player][item.name] -= 1 - # quick abort if we have found all items - if not target: - old_items.extend(multiworld.itempool[i+1:]) - break else: - old_items.append(item) - - # leftovers? - if target: - for player, remaining_items in depletion_pool.items(): - remaining_items = {name: count for name, count in remaining_items.items() if count} - if remaining_items: - logger.warning(f"{multiworld.get_player_name(player)}" - f" is trying to remove items from their pool that don't exist: {remaining_items}") - # find all filler we generated for the current player and remove until it matches - removables = [item for item in new_items if item.player == player] - for _ in range(sum(remaining_items.values())): - new_items.remove(removables.pop()) - assert len(multiworld.itempool) == len(new_items + old_items), "Item Pool amounts should not change." - multiworld.itempool[:] = new_items + old_items + new_itempool.append(item) + + # Create filler in place of the removed items, warn if any items couldn't be found in the multiworld itempool + for player, target in target_per_player.items(): + unfound_items = {item: count for item, count in depletion_pool[player].items() if count} + + if unfound_items: + player_name = multiworld.get_player_name(player) + logger.warning(f"{player_name} tried to remove items from their pool that don't exist: {unfound_items}") + + needed_items = target_per_player[player] - sum(unfound_items.values()) + new_itempool += [multiworld.worlds[player].create_filler() for _ in range(needed_items)] + + assert len(multiworld.itempool) == len(new_itempool), "Item Pool amounts should not change." + multiworld.itempool[:] = new_itempool multiworld.link_items() @@ -249,6 +242,7 @@ def main(args, seed=None, baked_server_options: Optional[Dict[str, object]] = No def write_multidata(): import NetUtils + from NetUtils import HintStatus slot_data = {} client_versions = {} games = {} @@ -273,10 +267,10 @@ def write_multidata(): for slot in multiworld.player_ids: slot_data[slot] = multiworld.worlds[slot].fill_slot_data() - def precollect_hint(location): + def precollect_hint(location: Location, auto_status: HintStatus): entrance = er_hint_data.get(location.player, {}).get(location.address, "") hint = NetUtils.Hint(location.item.player, location.player, location.address, - location.item.code, False, entrance, location.item.flags, False) + location.item.code, False, entrance, location.item.flags, auto_status) precollected_hints[location.player].add(hint) if location.item.player not in multiworld.groups: precollected_hints[location.item.player].add(hint) @@ -289,19 +283,22 @@ def precollect_hint(location): if type(location.address) == int: assert location.item.code is not None, "item code None should be event, " \ "location.address should then also be None. Location: " \ - f" {location}" + f" {location}, Item: {location.item}" assert location.address not in locations_data[location.player], ( f"Locations with duplicate address. {location} and " f"{locations_data[location.player][location.address]}") locations_data[location.player][location.address] = \ location.item.code, location.item.player, location.item.flags + auto_status = HintStatus.HINT_AVOID if location.item.trap else HintStatus.HINT_PRIORITY if location.name in multiworld.worlds[location.player].options.start_location_hints: - precollect_hint(location) + if not location.item.trap: # Unspecified status for location hints, except traps + auto_status = HintStatus.HINT_UNSPECIFIED + precollect_hint(location, auto_status) elif location.item.name in multiworld.worlds[location.item.player].options.start_hints: - precollect_hint(location) + precollect_hint(location, auto_status) elif any([location.item.name in multiworld.worlds[player].options.start_hints for player in multiworld.groups.get(location.item.player, {}).get("players", [])]): - precollect_hint(location) + precollect_hint(location, auto_status) # embedded data package data_package = { @@ -313,11 +310,10 @@ def precollect_hint(location): # get spheres -> filter address==None -> skip empty spheres: List[Dict[int, Set[int]]] = [] - for sphere in multiworld.get_spheres(): + for sphere in multiworld.get_sendable_spheres(): current_sphere: Dict[int, Set[int]] = collections.defaultdict(set) for sphere_location in sphere: - if type(sphere_location.address) is int: - current_sphere[sphere_location.player].add(sphere_location.address) + current_sphere[sphere_location.player].add(sphere_location.address) if current_sphere: spheres.append(dict(current_sphere)) diff --git a/ModuleUpdate.py b/ModuleUpdate.py index dada16cefcaf..04cf25ea5594 100644 --- a/ModuleUpdate.py +++ b/ModuleUpdate.py @@ -5,8 +5,15 @@ import warnings -if sys.version_info < (3, 10, 11): - raise RuntimeError(f"Incompatible Python Version found: {sys.version_info}. 3.10.11+ is supported.") +if sys.platform in ("win32", "darwin") and sys.version_info < (3, 10, 11): + # Official micro version updates. This should match the number in docs/running from source.md. + raise RuntimeError(f"Incompatible Python Version found: {sys.version_info}. Official 3.10.15+ is supported.") +elif sys.platform in ("win32", "darwin") and sys.version_info < (3, 10, 15): + # There are known security issues, but no easy way to install fixed versions on Windows for testing. + warnings.warn(f"Python Version {sys.version_info} has security issues. Don't use in production.") +elif sys.version_info < (3, 10, 1): + # Other platforms may get security backports instead of micro updates, so the number is unreliable. + raise RuntimeError(f"Incompatible Python Version found: {sys.version_info}. 3.10.1+ is supported.") # don't run update if environment is frozen/compiled or if not the parent process (skip in subprocess) _skip_update = bool(getattr(sys, "frozen", False) or multiprocessing.parent_process()) diff --git a/MultiServer.py b/MultiServer.py index 0db8722b5cb6..2561b0692a3c 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -975,9 +975,13 @@ def get_status_string(ctx: Context, team: int, tag: str): tagged = len([client for client in ctx.clients[team][slot] if tag in client.tags]) completion_text = f"({len(ctx.location_checks[team, slot])}/{len(ctx.locations[slot])})" tag_text = f" {tagged} of which are tagged {tag}" if connected and tag else "" - goal_text = " and has finished." if ctx.client_game_state[team, slot] == ClientStatus.CLIENT_GOAL else "." + status_text = ( + " and has finished." if ctx.client_game_state[team, slot] == ClientStatus.CLIENT_GOAL else + " and is ready." if ctx.client_game_state[team, slot] == ClientStatus.CLIENT_READY else + "." + ) text += f"\n{ctx.get_aliased_name(team, slot)} has {connected} connection{'' if connected == 1 else 's'}" \ - f"{tag_text}{goal_text} {completion_text}" + f"{tag_text}{status_text} {completion_text}" return text @@ -1925,6 +1929,11 @@ async def process_client_cmd(ctx: Context, client: Client, args: dict): [{'cmd': 'InvalidPacket', "type": "arguments", "text": 'UpdateHint: Invalid Status', "original_cmd": cmd}]) return + if status == HintStatus.HINT_FOUND: + await ctx.send_msgs(client, + [{'cmd': 'InvalidPacket', "type": "arguments", + "text": 'UpdateHint: Cannot manually update status to "HINT_FOUND"', "original_cmd": cmd}]) + return new_hint = new_hint.re_prioritize(ctx, status) if hint == new_hint: return @@ -2374,6 +2383,8 @@ def parse_args() -> argparse.Namespace: parser.add_argument('--cert_key', help="Path to SSL Certificate Key file") parser.add_argument('--loglevel', default=defaults["loglevel"], choices=['debug', 'info', 'warning', 'error', 'critical']) + parser.add_argument('--logtime', help="Add timestamps to STDOUT", + default=defaults["logtime"], action='store_true') parser.add_argument('--location_check_points', default=defaults["location_check_points"], type=int) parser.add_argument('--hint_cost', default=defaults["hint_cost"], type=int) parser.add_argument('--disable_item_cheat', default=defaults["disable_item_cheat"], action='store_true') @@ -2454,7 +2465,9 @@ def load_server_cert(path: str, cert_key: typing.Optional[str]) -> "ssl.SSLConte async def main(args: argparse.Namespace): - Utils.init_logging("Server", loglevel=args.loglevel.lower()) + Utils.init_logging(name="Server", + loglevel=args.loglevel.lower(), + add_timestamp=args.logtime) ctx = Context(args.host, args.port, args.server_password, args.password, args.location_check_points, args.hint_cost, not args.disable_item_cheat, args.release_mode, args.collect_mode, diff --git a/Options.py b/Options.py index d81f81face06..d3b2e6c1ba11 100644 --- a/Options.py +++ b/Options.py @@ -863,6 +863,8 @@ class ItemDict(OptionDict): verify_item_name = True def __init__(self, value: typing.Dict[str, int]): + if any(item_count is None for item_count in value.values()): + raise Exception("Items must have counts associated with them. Please provide positive integer values in the format \"item\": count .") if any(item_count < 1 for item_count in value.values()): raise Exception("Cannot have non-positive item counts.") super(ItemDict, self).__init__(value) @@ -1463,22 +1465,26 @@ class OptionGroup(typing.NamedTuple): def get_option_groups(world: typing.Type[World], visibility_level: Visibility = Visibility.template) -> typing.Dict[ str, typing.Dict[str, typing.Type[Option[typing.Any]]]]: """Generates and returns a dictionary for the option groups of a specified world.""" - option_groups = {option: option_group.name - for option_group in world.web.option_groups - for option in option_group.options} + option_to_name = {option: option_name for option_name, option in world.options_dataclass.type_hints.items()} + + ordered_groups = {group.name: group.options for group in world.web.option_groups} + # add a default option group for uncategorized options to get thrown into - ordered_groups = ["Game Options"] - [ordered_groups.append(group) for group in option_groups.values() if group not in ordered_groups] - grouped_options = {group: {} for group in ordered_groups} - for option_name, option in world.options_dataclass.type_hints.items(): - if visibility_level & option.visibility: - grouped_options[option_groups.get(option, "Game Options")][option_name] = option - - # if the world doesn't have any ungrouped options, this group will be empty so just remove it - if not grouped_options["Game Options"]: - del grouped_options["Game Options"] - - return grouped_options + if "Game Options" not in ordered_groups: + grouped_options = set(option for group in ordered_groups.values() for option in group) + ungrouped_options = [option for option in option_to_name if option not in grouped_options] + # only add the game options group if we have ungrouped options + if ungrouped_options: + ordered_groups = {**{"Game Options": ungrouped_options}, **ordered_groups} + + return { + group: { + option_to_name[option]: option + for option in group_options + if (visibility_level in option.visibility and option in option_to_name) + } + for group, group_options in ordered_groups.items() + } def generate_yaml_templates(target_folder: typing.Union[str, "pathlib.Path"], generate_hidden: bool = True) -> None: diff --git a/README.md b/README.md index 0e57bce53b51..2cc3c18aa09d 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ Currently, the following games are supported: * Kingdom Hearts 1 * Mega Man 2 * Yacht Dice +* Faxanadu For setup and instructions check out our [tutorials page](https://archipelago.gg/tutorial/). Downloads can be found at [Releases](https://github.com/ArchipelagoMW/Archipelago/releases), including compiled diff --git a/Utils.py b/Utils.py index f5c6ca6414f5..50adb18f42be 100644 --- a/Utils.py +++ b/Utils.py @@ -485,9 +485,9 @@ def get_text_after(text: str, start: str) -> str: loglevel_mapping = {'error': logging.ERROR, 'info': logging.INFO, 'warning': logging.WARNING, 'debug': logging.DEBUG} -def init_logging(name: str, loglevel: typing.Union[str, int] = logging.INFO, write_mode: str = "w", - log_format: str = "[%(name)s at %(asctime)s]: %(message)s", - exception_logger: typing.Optional[str] = None): +def init_logging(name: str, loglevel: typing.Union[str, int] = logging.INFO, + write_mode: str = "w", log_format: str = "[%(name)s at %(asctime)s]: %(message)s", + add_timestamp: bool = False, exception_logger: typing.Optional[str] = None): import datetime loglevel: int = loglevel_mapping.get(loglevel, loglevel) log_folder = user_path("logs") @@ -521,7 +521,8 @@ def filter(self, record: logging.LogRecord) -> bool: formatter = logging.Formatter(fmt='[%(asctime)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S') stream_handler = logging.StreamHandler(sys.stdout) stream_handler.addFilter(Filter("NoFile", lambda record: not getattr(record, "NoStream", False))) - stream_handler.setFormatter(formatter) + if add_timestamp: + stream_handler.setFormatter(formatter) root_logger.addHandler(stream_handler) # Relay unhandled exceptions to logger. @@ -556,7 +557,7 @@ def _cleanup(): import platform logging.info( f"Archipelago ({__version__}) logging initialized" - f" on {platform.platform()}" + f" on {platform.platform()} process {os.getpid()}" f" running Python {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}" f"{' (frozen)' if is_frozen() else ''}" ) diff --git a/WebHostLib/__init__.py b/WebHostLib/__init__.py index dbe2182b0747..9b2b6736f13c 100644 --- a/WebHostLib/__init__.py +++ b/WebHostLib/__init__.py @@ -85,6 +85,6 @@ def register(): from WebHostLib.customserver import run_server_process # to trigger app routing picking up on it - from . import tracker, upload, landing, check, generate, downloads, api, stats, misc, robots, options + from . import tracker, upload, landing, check, generate, downloads, api, stats, misc, robots, options, session app.register_blueprint(api.api_endpoints) diff --git a/WebHostLib/check.py b/WebHostLib/check.py index 97cb797f7a56..4e0cf1178f4b 100644 --- a/WebHostLib/check.py +++ b/WebHostLib/check.py @@ -105,8 +105,9 @@ def roll_options(options: Dict[str, Union[dict, str]], plando_options=plando_options) else: for i, yaml_data in enumerate(yaml_datas): - rolled_results[f"{filename}/{i + 1}"] = roll_settings(yaml_data, - plando_options=plando_options) + if yaml_data is not None: + rolled_results[f"{filename}/{i + 1}"] = roll_settings(yaml_data, + plando_options=plando_options) except Exception as e: if e.__cause__: results[filename] = f"Failed to generate options in {filename}: {e} - {e.__cause__}" diff --git a/WebHostLib/misc.py b/WebHostLib/misc.py index c49b1ae17801..6be0e470b3b4 100644 --- a/WebHostLib/misc.py +++ b/WebHostLib/misc.py @@ -18,13 +18,6 @@ def get_world_theme(game_name: str): return 'grass' -@app.before_request -def register_session(): - session.permanent = True # technically 31 days after the last visit - if not session.get("_id", None): - session["_id"] = uuid4() # uniquely identify each session without needing a login - - @app.errorhandler(404) @app.errorhandler(jinja2.exceptions.TemplateNotFound) def page_not_found(err): diff --git a/WebHostLib/session.py b/WebHostLib/session.py new file mode 100644 index 000000000000..d5dab7d6e6e6 --- /dev/null +++ b/WebHostLib/session.py @@ -0,0 +1,31 @@ +from uuid import uuid4, UUID + +from flask import session, render_template + +from WebHostLib import app + + +@app.before_request +def register_session(): + session.permanent = True # technically 31 days after the last visit + if not session.get("_id", None): + session["_id"] = uuid4() # uniquely identify each session without needing a login + + +@app.route('/session') +def show_session(): + return render_template( + "session.html", + ) + + +@app.route('/session/') +def set_session(_id: str): + new_id: UUID = UUID(_id, version=4) + old_id: UUID = session["_id"] + if old_id != new_id: + session["_id"] = new_id + return render_template( + "session.html", + old_id=old_id, + ) diff --git a/WebHostLib/templates/session.html b/WebHostLib/templates/session.html new file mode 100644 index 000000000000..b75474483a8f --- /dev/null +++ b/WebHostLib/templates/session.html @@ -0,0 +1,30 @@ +{% extends 'pageWrapper.html' %} + +{% block head %} + {% include 'header/stoneHeader.html' %} + Session + +{% endblock %} + +{% block body %} +
+ {% if old_id is defined %} +

Your old code was:

+ {{ old_id }} +
+ {% endif %} +

The following code is your unique identifier, it binds your uploaded content, such as rooms and seeds to you. + Treat it like a combined login name and password. + You should save this securely if you ever need to restore access. + You can also paste it into another device to access your content from multiple devices / browsers. + Some browsers, such as Brave, will delete your identifier cookie on a timer.

+ {{ session["_id"] }} +
+

+ The following link can be used to set the identifier. Do not share the code or link with others.
+ + {{ url_for('set_session', _id=session['_id'], _external=True) }} + +

+
+{% endblock %} diff --git a/WebHostLib/templates/siteMap.html b/WebHostLib/templates/siteMap.html index cdd6ad45eb27..b7db8227dc50 100644 --- a/WebHostLib/templates/siteMap.html +++ b/WebHostLib/templates/siteMap.html @@ -26,6 +26,7 @@

Base Pages

  • User Content
  • Game Statistics
  • Glossary
  • +
  • Session / Login
  • Tutorials

    diff --git a/WebHostLib/templates/templates.html b/WebHostLib/templates/templates.html index fb6ea7e9eab5..3b2418ae15b6 100644 --- a/WebHostLib/templates/templates.html +++ b/WebHostLib/templates/templates.html @@ -4,9 +4,6 @@ {% include 'header/grassHeader.html' %} Option Templates (YAML) - {% endblock %} {% block body %} diff --git a/docs/CODEOWNERS b/docs/CODEOWNERS index a51cac37026b..64a1362bf380 100644 --- a/docs/CODEOWNERS +++ b/docs/CODEOWNERS @@ -55,19 +55,22 @@ /worlds/dlcquest/ @axe-y @agilbert1412 # DOOM 1993 -/worlds/doom_1993/ @Daivuk +/worlds/doom_1993/ @Daivuk @KScl # DOOM II -/worlds/doom_ii/ @Daivuk +/worlds/doom_ii/ @Daivuk @KScl # Factorio /worlds/factorio/ @Berserker66 +# Faxanadu +/worlds/faxanadu/ @Daivuk + # Final Fantasy Mystic Quest /worlds/ffmq/ @Alchav @wildham0 # Heretic -/worlds/heretic/ @Daivuk +/worlds/heretic/ @Daivuk @KScl # Hollow Knight /worlds/hk/ @BadMagic100 @qwint diff --git a/docs/network protocol.md b/docs/network protocol.md index 1c5b2e002289..4331cf971007 100644 --- a/docs/network protocol.md +++ b/docs/network protocol.md @@ -351,7 +351,7 @@ Sent to the server to update the status of a Hint. The client must be the 'recei | ---- | ---- | ----- | | player | int | The ID of the player whose location is being hinted for. | | location | int | The ID of the location to update the hint for. If no hint exists for this location, the packet is ignored. | -| status | [HintStatus](#HintStatus) | Optional. If included, sets the status of the hint to this status. | +| status | [HintStatus](#HintStatus) | Optional. If included, sets the status of the hint to this status. Cannot set `HINT_FOUND`, or change the status from `HINT_FOUND`. | #### HintStatus An enumeration containing the possible hint states. @@ -359,12 +359,16 @@ An enumeration containing the possible hint states. ```python import enum class HintStatus(enum.IntEnum): - HINT_FOUND = 0 - HINT_UNSPECIFIED = 1 - HINT_NO_PRIORITY = 10 - HINT_AVOID = 20 - HINT_PRIORITY = 30 + HINT_FOUND = 0 # The location has been collected. Status cannot be changed once found. + HINT_UNSPECIFIED = 1 # The receiving player has not specified any status + HINT_NO_PRIORITY = 10 # The receiving player has specified that the item is unneeded + HINT_AVOID = 20 # The receiving player has specified that the item is detrimental + HINT_PRIORITY = 30 # The receiving player has specified that the item is needed ``` +- Hints for items with `ItemClassification.trap` default to `HINT_AVOID`. +- Hints created with `LocationScouts`, `!hint_location`, or similar (hinting a location) default to `HINT_UNSPECIFIED`. +- Hints created with `!hint` or similar (hinting an item for yourself) default to `HINT_PRIORITY`. +- Once a hint is collected, its' status is updated to `HINT_FOUND` automatically, and can no longer be changed. ### StatusUpdate Sent to the server to update on the sender's status. Examples include readiness or goal completion. (Example: defeated Ganon in A Link to the Past) @@ -668,6 +672,7 @@ class Hint(typing.NamedTuple): found: bool entrance: str = "" item_flags: int = 0 + status: HintStatus = HintStatus.HINT_UNSPECIFIED ``` ### Data Package Contents diff --git a/docs/running from source.md b/docs/running from source.md index 66dd1925c897..33d6b3928e54 100644 --- a/docs/running from source.md +++ b/docs/running from source.md @@ -7,7 +7,9 @@ use that version. These steps are for developers or platforms without compiled r ## General What you'll need: - * [Python 3.10.15 or newer](https://www.python.org/downloads/), not the Windows Store version + * [Python 3.10.11 or newer](https://www.python.org/downloads/), not the Windows Store version + * On Windows, please consider only using the latest supported version in production environments since security + updates for older versions are not easily available. * Python 3.12.x is currently the newest supported version * pip: included in downloads from python.org, separate in many Linux distributions * Matching C compiler diff --git a/kvui.py b/kvui.py index dfe935930049..d98fc7ed9ab8 100644 --- a/kvui.py +++ b/kvui.py @@ -3,6 +3,8 @@ import sys import typing import re +import io +import pkgutil from collections import deque assert "kivy" not in sys.modules, "kvui should be imported before kivy for frozen compatibility" @@ -34,6 +36,7 @@ from kivy.core.window import Window from kivy.core.clipboard import Clipboard from kivy.core.text.markup import MarkupLabel +from kivy.core.image import ImageLoader, ImageLoaderBase, ImageData from kivy.base import ExceptionHandler, ExceptionManager from kivy.clock import Clock from kivy.factory import Factory @@ -61,6 +64,7 @@ from kivy.uix.recycleview.layout import LayoutSelectionBehavior from kivy.animation import Animation from kivy.uix.popup import Popup +from kivy.uix.image import AsyncImage fade_in_animation = Animation(opacity=0, duration=0) + Animation(opacity=1, duration=0.25) @@ -838,6 +842,40 @@ def fix_heights(self): element.height = max_height +class ApAsyncImage(AsyncImage): + def is_uri(self, filename: str) -> bool: + if filename.startswith("ap:"): + return True + else: + return super().is_uri(filename) + + +class ImageLoaderPkgutil(ImageLoaderBase): + def load(self, filename: str) -> typing.List[ImageData]: + # take off the "ap:" prefix + module, path = filename[3:].split("/", 1) + data = pkgutil.get_data(module, path) + return self._bytes_to_data(data) + + def _bytes_to_data(self, data: typing.Union[bytes, bytearray]) -> typing.List[ImageData]: + loader = next(loader for loader in ImageLoader.loaders if loader.can_load_memory()) + return loader.load(loader, io.BytesIO(data)) + + +# grab the default loader method so we can override it but use it as a fallback +_original_image_loader_load = ImageLoader.load + + +def load_override(filename: str, default_load=_original_image_loader_load, **kwargs): + if filename.startswith("ap:"): + return ImageLoaderPkgutil(filename) + else: + return default_load(filename, **kwargs) + + +ImageLoader.load = load_override + + class E(ExceptionHandler): logger = logging.getLogger("Client") diff --git a/settings.py b/settings.py index ccd3458003c2..04d8760c3cd3 100644 --- a/settings.py +++ b/settings.py @@ -599,6 +599,7 @@ class LogNetwork(IntEnum): savefile: Optional[str] = None disable_save: bool = False loglevel: str = "info" + logtime: bool = False server_password: Optional[ServerPassword] = None disable_item_cheat: Union[DisableItemCheat, bool] = False location_check_points: LocationCheckPoints = LocationCheckPoints(1) diff --git a/test/general/test_items.py b/test/general/test_items.py index 9cc91a1b00ef..64ce1b6997b7 100644 --- a/test/general/test_items.py +++ b/test/general/test_items.py @@ -80,3 +80,21 @@ def test_itempool_not_modified(self): call_all(multiworld, step) self.assertEqual(created_items, multiworld.itempool, f"{game_name} modified the itempool during {step}") + + def test_locality_not_modified(self): + """Test that worlds don't modify the locality of items after duplicates are resolved""" + gen_steps = ("generate_early", "create_regions", "create_items") + additional_steps = ("set_rules", "generate_basic", "pre_fill") + worlds_to_test = {game: world for game, world in AutoWorldRegister.world_types.items()} + for game_name, world_type in worlds_to_test.items(): + with self.subTest("Game", game=game_name): + multiworld = setup_solo_multiworld(world_type, gen_steps) + local_items = multiworld.worlds[1].options.local_items.value.copy() + non_local_items = multiworld.worlds[1].options.non_local_items.value.copy() + for step in additional_steps: + with self.subTest("step", step=step): + call_all(multiworld, step) + self.assertEqual(local_items, multiworld.worlds[1].options.local_items.value, + f"{game_name} modified local_items during {step}") + self.assertEqual(non_local_items, multiworld.worlds[1].options.non_local_items.value, + f"{game_name} modified non_local_items during {step}") diff --git a/worlds/LauncherComponents.py b/worlds/LauncherComponents.py index 67806a7394c7..7f178f1739fc 100644 --- a/worlds/LauncherComponents.py +++ b/worlds/LauncherComponents.py @@ -207,6 +207,7 @@ def install_apworld(apworld_path: str = "") -> None: ] +# if registering an icon from within an apworld, the format "ap:module.name/path/to/file.png" can be used icon_paths = { 'icon': local_path('data', 'icon.png'), 'mcicon': local_path('data', 'mcicon.png'), diff --git a/worlds/adventure/__init__.py b/worlds/adventure/__init__.py index ed5ebbd3dc56..4fde1482cfe1 100644 --- a/worlds/adventure/__init__.py +++ b/worlds/adventure/__init__.py @@ -446,7 +446,7 @@ def generate_output(self, output_directory: str) -> None: # end of ordered Main.py calls def create_item(self, name: str) -> Item: - item_data: ItemData = item_table.get(name) + item_data: ItemData = item_table[name] return AdventureItem(name, item_data.classification, item_data.id, self.player) def create_event(self, name: str, classification: ItemClassification) -> Item: diff --git a/worlds/blasphemous/Options.py b/worlds/blasphemous/Options.py index 0bd08b13b260..e0bbcd770758 100644 --- a/worlds/blasphemous/Options.py +++ b/worlds/blasphemous/Options.py @@ -1,5 +1,5 @@ from dataclasses import dataclass -from Options import Choice, Toggle, DefaultOnToggle, DeathLink, PerGameCommonOptions, OptionGroup +from Options import Choice, Toggle, DefaultOnToggle, DeathLink, PerGameCommonOptions, StartInventoryPool, OptionGroup import random @@ -213,6 +213,7 @@ class BlasphemousDeathLink(DeathLink): @dataclass class BlasphemousOptions(PerGameCommonOptions): + start_inventory_from_pool: StartInventoryPool prie_dieu_warp: PrieDieuWarp skip_cutscenes: SkipCutscenes corpse_hints: CorpseHints diff --git a/worlds/blasphemous/__init__.py b/worlds/blasphemous/__init__.py index 67031710e4eb..a967fbac9289 100644 --- a/worlds/blasphemous/__init__.py +++ b/worlds/blasphemous/__init__.py @@ -137,12 +137,6 @@ def create_items(self): ] skipped_items = [] - junk: int = 0 - - for item, count in self.options.start_inventory.value.items(): - for _ in range(count): - skipped_items.append(item) - junk += 1 skipped_items.extend(unrandomized_dict.values()) @@ -194,9 +188,6 @@ def create_items(self): for _ in range(count): pool.append(self.create_item(item["name"])) - for _ in range(junk): - pool.append(self.create_item(self.get_filler_item_name())) - self.multiworld.itempool += pool self.place_items_from_dict(unrandomized_dict) diff --git a/worlds/dark_souls_3/Bosses.py b/worlds/dark_souls_3/Bosses.py index fac7d913c338..ce2ba5d1700e 100644 --- a/worlds/dark_souls_3/Bosses.py +++ b/worlds/dark_souls_3/Bosses.py @@ -253,10 +253,10 @@ class DS3BossInfo: }), DS3BossInfo("Lords of Cinder", 4100800, locations = { "KFF: Soul of the Lords", - "FS: Billed Mask - Yuria after killing KFF boss", - "FS: Black Dress - Yuria after killing KFF boss", - "FS: Black Gauntlets - Yuria after killing KFF boss", - "FS: Black Leggings - Yuria after killing KFF boss" + "FS: Billed Mask - shop after killing Yuria", + "FS: Black Dress - shop after killing Yuria", + "FS: Black Gauntlets - shop after killing Yuria", + "FS: Black Leggings - shop after killing Yuria" }), ] diff --git a/worlds/dark_souls_3/Locations.py b/worlds/dark_souls_3/Locations.py index 08f4b7cd1a80..cc202c76e8be 100644 --- a/worlds/dark_souls_3/Locations.py +++ b/worlds/dark_souls_3/Locations.py @@ -764,29 +764,29 @@ def __init__( DS3LocationData("US -> RS", None), # Yoel/Yuria of Londor - DS3LocationData("FS: Soul Arrow - Yoel/Yuria", "Soul Arrow", + DS3LocationData("FS: Soul Arrow - Yoel/Yuria shop", "Soul Arrow", static='99,0:-1:50000,110000,70000116:', missable=True, npc=True, shop=True), - DS3LocationData("FS: Heavy Soul Arrow - Yoel/Yuria", "Heavy Soul Arrow", + DS3LocationData("FS: Heavy Soul Arrow - Yoel/Yuria shop", "Heavy Soul Arrow", static='99,0:-1:50000,110000,70000116:', missable=True, npc=True, shop=True), - DS3LocationData("FS: Magic Weapon - Yoel/Yuria", "Magic Weapon", + DS3LocationData("FS: Magic Weapon - Yoel/Yuria shop", "Magic Weapon", static='99,0:-1:50000,110000,70000116:', missable=True, npc=True, shop=True), - DS3LocationData("FS: Magic Shield - Yoel/Yuria", "Magic Shield", + DS3LocationData("FS: Magic Shield - Yoel/Yuria shop", "Magic Shield", static='99,0:-1:50000,110000,70000116:', missable=True, npc=True, shop=True), - DS3LocationData("FS: Soul Greatsword - Yoel/Yuria", "Soul Greatsword", + DS3LocationData("FS: Soul Greatsword - Yoel/Yuria shop", "Soul Greatsword", static='99,0:-1:50000,110000,70000450,70000475:', missable=True, npc=True, shop=True), - DS3LocationData("FS: Dark Hand - Yoel/Yuria", "Dark Hand", missable=True, npc=True), - DS3LocationData("FS: Untrue White Ring - Yoel/Yuria", "Untrue White Ring", missable=True, + DS3LocationData("FS: Dark Hand - Yuria shop", "Dark Hand", missable=True, npc=True), + DS3LocationData("FS: Untrue White Ring - Yuria shop", "Untrue White Ring", missable=True, npc=True), - DS3LocationData("FS: Untrue Dark Ring - Yoel/Yuria", "Untrue Dark Ring", missable=True, + DS3LocationData("FS: Untrue Dark Ring - Yuria shop", "Untrue Dark Ring", missable=True, npc=True), - DS3LocationData("FS: Londor Braille Divine Tome - Yoel/Yuria", "Londor Braille Divine Tome", + DS3LocationData("FS: Londor Braille Divine Tome - Yuria shop", "Londor Braille Divine Tome", static='99,0:-1:40000,110000,70000116:', missable=True, npc=True), - DS3LocationData("FS: Darkdrift - Yoel/Yuria", "Darkdrift", missable=True, drop=True, + DS3LocationData("FS: Darkdrift - kill Yuria", "Darkdrift", missable=True, drop=True, npc=True), # kill her or kill Soul of Cinder # Cornyx of the Great Swamp @@ -2476,13 +2476,13 @@ def __init__( "Firelink Leggings", boss=True, shop=True), # Yuria (quest, after Soul of Cinder) - DS3LocationData("FS: Billed Mask - Yuria after killing KFF boss", "Billed Mask", + DS3LocationData("FS: Billed Mask - shop after killing Yuria", "Billed Mask", missable=True, npc=True), - DS3LocationData("FS: Black Dress - Yuria after killing KFF boss", "Black Dress", + DS3LocationData("FS: Black Dress - shop after killing Yuria", "Black Dress", missable=True, npc=True), - DS3LocationData("FS: Black Gauntlets - Yuria after killing KFF boss", "Black Gauntlets", + DS3LocationData("FS: Black Gauntlets - shop after killing Yuria", "Black Gauntlets", missable=True, npc=True), - DS3LocationData("FS: Black Leggings - Yuria after killing KFF boss", "Black Leggings", + DS3LocationData("FS: Black Leggings - shop after killing Yuria", "Black Leggings", missable=True, npc=True), ], diff --git a/worlds/dark_souls_3/detailed_location_descriptions.py b/worlds/dark_souls_3/detailed_location_descriptions.py index e20c700ab1bc..6e6cf1eb0bc8 100644 --- a/worlds/dark_souls_3/detailed_location_descriptions.py +++ b/worlds/dark_souls_3/detailed_location_descriptions.py @@ -84,7 +84,11 @@ table += f"{html.escape(name)}{html.escape(description)}\n" table += "\n" - with open(os.path.join(os.path.dirname(__file__), 'docs/locations_en.md'), 'r+') as f: + with open( + os.path.join(os.path.dirname(__file__), 'docs/locations_en.md'), + 'r+', + encoding='utf-8' + ) as f: original = f.read() start_flag = "\n" start = original.index(start_flag) + len(start_flag) diff --git a/worlds/dark_souls_3/docs/locations_en.md b/worlds/dark_souls_3/docs/locations_en.md index ef07b84b2b34..8411b8c42aa0 100644 --- a/worlds/dark_souls_3/docs/locations_en.md +++ b/worlds/dark_souls_3/docs/locations_en.md @@ -1020,7 +1020,7 @@ static _Dark Souls III_ randomizer]. CKG: Drakeblood Helm - tomb, after killing AP mausoleum NPCOn the Drakeblood Knight after Oceiros fight, after defeating the Drakeblood Knight from the Serpent-Man Summoner CKG: Drakeblood Leggings - tomb, after killing AP mausoleum NPCOn the Drakeblood Knight after Oceiros fight, after defeating the Drakeblood Knight from the Serpent-Man Summoner CKG: Estus Shard - balconyFrom the middle level of the first Consumed King's Gardens elevator, out the balcony and to the right -CKG: Human Pine Resin - by lone stairway bottomOn the right side of the garden, following the wall past the entrance to the shortcut elevator building, in a toxic pool +CKG: Human Pine Resin - pool by liftOn the right side of the garden, following the wall past the entrance to the shortcut elevator building, in a toxic pool CKG: Human Pine Resin - toxic pool, past rotundaIn between two platforms near the middle of the garden, by a tree in a toxic pool CKG: Magic Stoneplate Ring - mob drop before bossDropped by the Cathedral Knight closest to the Oceiros fog gate CKG: Ring of Sacrifice - under balconyAlong the right wall of the garden, next to the first elevator building @@ -1181,16 +1181,18 @@ static _Dark Souls III_ randomizer]. FS: Alluring Skull - Mortician's AshesSold by Handmaid after giving Mortician's Ashes FS: Arstor's Spear - Ludleth for GreatwoodBoss weapon for Curse-Rotted Greatwood FS: Aural Decoy - OrbeckSold by Orbeck -FS: Billed Mask - Yuria after killing KFF bossDropped by Yuria upon death or quest completion. -FS: Black Dress - Yuria after killing KFF bossDropped by Yuria upon death or quest completion. +FS: Billed Mask - shop after killing YuriaDropped by Yuria upon death or quest completion. +FS: Black Dress - shop after killing YuriaDropped by Yuria upon death or quest completion. FS: Black Fire Orb - Karla for Grave Warden TomeSold by Karla after giving her the Grave Warden Pyromancy Tome FS: Black Flame - Karla for Grave Warden TomeSold by Karla after giving her the Grave Warden Pyromancy Tome -FS: Black Gauntlets - Yuria after killing KFF bossDropped by Yuria upon death or quest completion. +FS: Black Gauntlets - shop after killing YuriaDropped by Yuria upon death or quest completion. +FS: Black Hand Armor - shop after killing GA NPCSold by Handmaid after killing Black Hand Kumai +FS: Black Hand Hat - shop after killing GA NPCSold by Handmaid after killing Black Hand Kumai FS: Black Iron Armor - shop after killing TsorigSold by Handmaid after killing Knight Slayer Tsorig in Smouldering Lake FS: Black Iron Gauntlets - shop after killing TsorigSold by Handmaid after killing Knight Slayer Tsorig in Smouldering Lake FS: Black Iron Helm - shop after killing TsorigSold by Handmaid after killing Knight Slayer Tsorig in Smouldering Lake FS: Black Iron Leggings - shop after killing TsorigSold by Handmaid after killing Knight Slayer Tsorig in Smouldering Lake -FS: Black Leggings - Yuria after killing KFF bossDropped by Yuria upon death or quest completion. +FS: Black Leggings - shop after killing YuriaDropped by Yuria upon death or quest completion. FS: Black Serpent - Ludleth for WolnirBoss weapon for High Lord Wolnir FS: Blessed Weapon - Irina for Tome of LothricSold by Irina after giving her the Braille Divine Tome of Lothric FS: Blue Tearstone Ring - GreiratGiven by Greirat upon rescuing him from the High Wall cell @@ -1220,8 +1222,8 @@ static _Dark Souls III_ randomizer]. FS: Dancer's Leggings - shop after killing LC entry bossSold by Handmaid after defeating Dancer of the Boreal Valley FS: Dark Blade - Karla for Londor TomeSold by Irina or Karla after giving one the Londor Braille Divine Tome FS: Dark Edge - KarlaSold by Karla after recruiting her, or in her ashes -FS: Dark Hand - Yoel/YuriaSold by Yuria -FS: Darkdrift - Yoel/YuriaDropped by Yuria upon death or quest completion. +FS: Dark Hand - Yuria shopSold by Yuria +FS: Darkdrift - kill YuriaDropped by Yuria upon death or quest completion. FS: Darkmoon Longbow - Ludleth for AldrichBoss weapon for Aldrich FS: Dead Again - Karla for Londor TomeSold by Irina or Karla after giving one the Londor Braille Divine Tome FS: Deep Protection - Karla for Deep Braille TomeSold by Irina or Karla after giving one the Deep Braille Divine Tome @@ -1264,6 +1266,9 @@ static _Dark Souls III_ randomizer]. FS: Exile Gauntlets - shop after killing NPCs in RSSold by Handmaid after killing the exiles just before Farron Keep FS: Exile Leggings - shop after killing NPCs in RSSold by Handmaid after killing the exiles just before Farron Keep FS: Exile Mask - shop after killing NPCs in RSSold by Handmaid after killing the exiles just before Farron Keep +FS: Faraam Armor - shop after killing GA NPCSold by Handmaid after killing Lion Knight Albert +FS: Faraam Boots - shop after killing GA NPCSold by Handmaid after killing Lion Knight Albert +FS: Faraam Gauntlets - shop after killing GA NPCSold by Handmaid after killing Lion Knight Albert FS: Faraam Helm - shop after killing GA NPCSold by Handmaid after killing Lion Knight Albert FS: Farron Dart - OrbeckSold by Orbeck FS: Farron Dart - shopSold by Handmaid @@ -1308,7 +1313,7 @@ static _Dark Souls III_ randomizer]. FS: Heal - IrinaSold by Irina after recruiting her, or in her ashes FS: Heal Aid - shopSold by Handmaid FS: Heavy Soul Arrow - OrbeckSold by Orbeck -FS: Heavy Soul Arrow - Yoel/YuriaSold by Yoel/Yuria +FS: Heavy Soul Arrow - Yoel/Yuria shopSold by Yoel/Yuria FS: Helm of Favor - shop after killing water reserve minibossesSold by Handmaid after killing Sulyvahn's Beasts in Water Reserve FS: Hidden Blessing - Dreamchaser's AshesSold by Greirat after pillaging Irithyll FS: Hidden Blessing - Greirat from IBVSold by Greirat after pillaging Irithyll @@ -1338,7 +1343,7 @@ static _Dark Souls III_ randomizer]. FS: Lift Chamber Key - LeonhardGiven by Ringfinger Leonhard after acquiring a Pale Tongue. FS: Lightning Storm - Ludleth for NamelessBoss weapon for Nameless King FS: Lloyd's Shield Ring - Paladin's AshesSold by Handmaid after giving Paladin's Ashes -FS: Londor Braille Divine Tome - Yoel/YuriaSold by Yuria +FS: Londor Braille Divine Tome - Yuria shopSold by Yuria FS: Lorian's Armor - shop after killing GA bossSold by Handmaid after defeating Lothric, Younger Prince FS: Lorian's Gauntlets - shop after killing GA bossSold by Handmaid after defeating Lothric, Younger Prince FS: Lorian's Greatsword - Ludleth for PrincesBoss weapon for Twin Princes @@ -1347,9 +1352,9 @@ static _Dark Souls III_ randomizer]. FS: Lothric's Holy Sword - Ludleth for PrincesBoss weapon for Twin Princes FS: Magic Barrier - Irina for Tome of LothricSold by Irina after giving her the Braille Divine Tome of Lothric FS: Magic Shield - OrbeckSold by Orbeck -FS: Magic Shield - Yoel/YuriaSold by Yoel/Yuria +FS: Magic Shield - Yoel/Yuria shopSold by Yoel/Yuria FS: Magic Weapon - OrbeckSold by Orbeck -FS: Magic Weapon - Yoel/YuriaSold by Yoel/Yuria +FS: Magic Weapon - Yoel/Yuria shopSold by Yoel/Yuria FS: Mail Breaker - Sirris for killing CreightonGiven by Sirris talking to her in Firelink Shrine after invading and vanquishing Creighton. FS: Master's Attire - NPC dropDropped by Sword Master FS: Master's Gloves - NPC dropDropped by Sword Master @@ -1401,10 +1406,10 @@ static _Dark Souls III_ randomizer]. FS: Sneering Mask - Yoel's room, kill Londor Pale Shade twiceIn Yoel/Yuria's area after defeating both Londor Pale Shade invasions FS: Soothing Sunlight - Ludleth for DancerBoss weapon for Dancer of the Boreal Valley FS: Soul Arrow - OrbeckSold by Orbeck -FS: Soul Arrow - Yoel/YuriaSold by Yoel/Yuria +FS: Soul Arrow - Yoel/Yuria shopSold by Yoel/Yuria FS: Soul Arrow - shopSold by Handmaid FS: Soul Greatsword - OrbeckSold by Orbeck -FS: Soul Greatsword - Yoel/YuriaSold by Yoel/Yuria after using Draw Out True Strength +FS: Soul Greatsword - Yoel/Yuria shopSold by Yoel/Yuria after using Draw Out True Strength FS: Soul Spear - Orbeck for Logan's ScrollSold by Orbeck after giving him Logan's Scroll FS: Soul of a Deserted Corpse - bell tower doorNext to the door requiring the Tower Key FS: Spook - OrbeckSold by Orbeck @@ -1427,8 +1432,8 @@ static _Dark Souls III_ randomizer]. FS: Undead Legion Gauntlet - shop after killing FK bossSold by Handmaid after defeating Abyss Watchers FS: Undead Legion Helm - shop after killing FK bossSold by Handmaid after defeating Abyss Watchers FS: Undead Legion Leggings - shop after killing FK bossSold by Handmaid after defeating Abyss Watchers -FS: Untrue Dark Ring - Yoel/YuriaSold by Yuria -FS: Untrue White Ring - Yoel/YuriaSold by Yuria +FS: Untrue Dark Ring - Yuria shopSold by Yuria +FS: Untrue White Ring - Yuria shopSold by Yuria FS: Vordt's Great Hammer - Ludleth for VordtBoss weapon for Vordt of the Boreal Valley FS: Vow of Silence - Karla for Londor TomeSold by Irina or Karla after giving one the Londor Braille Divine Tome FS: Washing Pole - Easterner's AshesSold by Handmaid after giving Easterner's Ashes @@ -1477,8 +1482,6 @@ static _Dark Souls III_ randomizer]. FSBT: Twinkling Titanite - lizard behind FirelinkDropped by the Crystal Lizard behind Firelink Shrine. Can be accessed with tree jump by going all the way around the roof, left of the entrance to the rafters, or alternatively dropping down from the Bell Tower. FSBT: Very good! Carving - crow for Divine BlessingTrade Divine Blessing with crow GA: Avelyn - 1F, drop from 3F onto bookshelvesOn top of a bookshelf on the Archive first floor, accessible by going halfway up the stairs to the third floor, dropping down past the Grand Archives Scholar, and then dropping down again -GA: Black Hand Armor - shop after killing GA NPCSold by Handmaid after killing Black Hand Kumai -GA: Black Hand Hat - shop after killing GA NPCSold by Handmaid after killing Black Hand Kumai GA: Blessed Gem - raftersOn the rafters high above the Archives, can be accessed by dropping down from the Winged Knight roof area GA: Chaos Gem - dark room, lizardDropped by a Crystal Lizard on the Archives first floor in the dark room past the large wax pool GA: Cinders of a Lord - Lothric PrinceDropped by Twin Princes @@ -1489,9 +1492,6 @@ static _Dark Souls III_ randomizer]. GA: Divine Pillars of Light - cage above raftersIn a cage above the rafters high above the Archives, can be accessed by dropping down from the Winged Knight roof area GA: Ember - 5F, by entranceOn a balcony high in the Archives overlooking the area with the Grand Archives Scholars with a shortcut ladder, on the opposite side from the wax pool GA: Estus Shard - dome, far balconyOn the Archives roof near the three Winged Knights, in a side area overlooking the ocean. -GA: Faraam Armor - shop after killing GA NPCSold by Handmaid after killing Lion Knight Albert -GA: Faraam Boots - shop after killing GA NPCSold by Handmaid after killing Lion Knight Albert -GA: Faraam Gauntlets - shop after killing GA NPCSold by Handmaid after killing Lion Knight Albert GA: Fleshbite Ring - up stairs from 4FFrom the first shortcut elevator with the movable bookshelf, past the Scholars right before going outside onto the roof, in an alcove to the right with many Clawed Curse bookshelves GA: Golden Wing Crest Shield - outside 5F, NPC dropDropped by Lion Knight Albert before the stairs leading up to Twin Princes GA: Heavy Gem - rooftops, lizardDropped by one of the pair of Crystal Lizards, on the right side, found going up a slope past the gargoyle on the Archives roof @@ -1525,15 +1525,15 @@ static _Dark Souls III_ randomizer]. GA: Titanite Chunk - 2F, by wax poolUp the stairs from the Archives second floor on the right side from the entrance, in a corner near the small wax pool GA: Titanite Chunk - 2F, right after dark roomExiting from the dark room with the Crystal Lizards on the first floor onto the second floor main room, then taking an immediate right GA: Titanite Chunk - 5F, far balconyOn a balcony outside where Lothric Knight stands on the top floor of the Archives, accessing by going right from the final wax pool or by dropping down from the gargoyle area -GA: Titanite Chunk - rooftops, balconyGoing onto the roof and down the first ladder, all the way down the ledge facing the ocean to the right GA: Titanite Chunk - rooftops lower, ledge by buttressGoing onto the roof and down the first ladder, dropping down on either side from the ledge facing the ocean, on a roof ledge to the right +GA: Titanite Chunk - rooftops, balconyGoing onto the roof and down the first ladder, all the way down the ledge facing the ocean to the right GA: Titanite Chunk - rooftops, just before 5FOn the Archives roof, after a short dropdown, in the small area where the two Gargoyles attack you GA: Titanite Scale - 1F, drop from 2F late onto bookshelves, lizardDropped by a Crystal Lizard on first floor bookshelves. Can be accessed by dropping down to the left at the end of the bridge which is the Crystal Sage's final location GA: Titanite Scale - 1F, up stairs on bookshelfOn the Archives first floor, up a movable set of stairs near the large wax pool, on top of a bookshelf GA: Titanite Scale - 2F, titanite scale atop bookshelfOn top of a bookshelf on the Archive second floor, accessible by going halfway up the stairs to the third floor and dropping down near a Grand Archives Scholar GA: Titanite Scale - 3F, by ladder to 2F lateGoing from the Crystal Sage's location on the third floor to its location on the bridge, on the left side of the ladder you descend, behind a table GA: Titanite Scale - 3F, corner up stairsFrom the Grand Archives third floor up past the thralls, in a corner with bookshelves to the left -GA: Titanite Scale - 5F, chest by exitIn a chest after the first elevator shortcut with the movable bookshelf, in the area with the Grand Archives Scholars, to the left of the stairwell leading up to the roof +GA: Titanite Scale - 4F, chest by exitIn a chest after the first elevator shortcut with the movable bookshelf, in the area with the Grand Archives Scholars, to the left of the stairwell leading up to the roof GA: Titanite Scale - dark room, upstairsRight after going up the stairs to the Archives second floor, on the left guarded by a Grand Archives Scholar and a sequence of Clawed Curse bookshelves GA: Titanite Scale - rooftops lower, path to 2FGoing onto the roof and down the first ladder, dropping down on either side from the ledge facing the ocean, then going past the corvians all the way to the left and making a jump GA: Titanite Slab - 1F, after pulling 2F switchIn a chest on the Archives first floor, behind a bookshelf moved by pulling a lever in the middle of the second floor between two cursed bookshelves @@ -1633,7 +1633,7 @@ static _Dark Souls III_ randomizer]. IBV: Large Soul of a Nameless Soldier - central, by bonfireBy the Central Irithyll bonfire IBV: Large Soul of a Nameless Soldier - central, by second fountainNext to the fountain up the stairs from the Central Irithyll bonfire IBV: Large Soul of a Nameless Soldier - lake islandOn an island in the lake leading to the Distant Manor bonfire -IBV: Large Soul of a Nameless Soldier - stairs to plazaOn the path from Central Irithyll bonfire, before making the left toward Church of Yorshka +IBV: Large Soul of a Nameless Soldier - path to plazaOn the path from Central Irithyll bonfire, before making the left toward Church of Yorshka IBV: Large Titanite Shard - Distant Manor, under overhangUnder overhang next to second set of stairs leading from Distant Manor bonfire IBV: Large Titanite Shard - ascent, by elevator doorOn the path from the sewer leading up to Pontiff's cathedral, to the right of the statue surrounded by dogs IBV: Large Titanite Shard - ascent, down ladder in last buildingOutside the final building before Pontiff's cathedral, coming from the sewer, dropping down to the left before the entrance @@ -1701,7 +1701,7 @@ static _Dark Souls III_ randomizer]. ID: Large Titanite Shard - B1 far, rightmost cellIn a cell on the far end of the top corridor opposite to the bonfire in Irithyll Dungeon, nearby the Jailer ID: Large Titanite Shard - B1 near, by doorAt the end of the top corridor on the bonfire side in Irithyll Dungeon, before the Jailbreaker's Key door ID: Large Titanite Shard - B3 near, right cornerIn the main Jailer cell block, to the left of the hallway leading to the Path of the Dragon area -ID: Large Titanite Shard - after bonfire, second cell on rightIn the second cell on the right after Irithyll Dungeon bonfire +ID: Large Titanite Shard - after bonfire, second cell on leftIn the second cell on the right after Irithyll Dungeon bonfire ID: Large Titanite Shard - pit #1On the floor where the Giant Slave is standing ID: Large Titanite Shard - pit #2On the floor where the Giant Slave is standing ID: Lightning Blade - B3 lift, middle platformOn the middle platform riding the elevator up from the Path of the Dragon area diff --git a/worlds/doom_1993/Options.py b/worlds/doom_1993/Options.py index b4fc50aac674..c9c61110328c 100644 --- a/worlds/doom_1993/Options.py +++ b/worlds/doom_1993/Options.py @@ -16,9 +16,9 @@ class Goal(Choice): class Difficulty(Choice): """ - Choose the difficulty option. Those match DOOM's difficulty options. - baby (I'm too young to die.) double ammos, half damage, less monsters or strength. - easy (Hey, not too rough.) less monsters or strength. + Choose the game difficulty. These options match DOOM's skill levels. + baby (I'm too young to die.) Same as easy, with double ammo pickups and half damage taken. + easy (Hey, not too rough.) Less monsters or strength. medium (Hurt me plenty.) Default. hard (Ultra-Violence.) More monsters or strength. nightmare (Nightmare!) Monsters attack more rapidly and respawn. @@ -29,6 +29,11 @@ class Difficulty(Choice): option_medium = 2 option_hard = 3 option_nightmare = 4 + alias_itytd = 0 + alias_hntr = 1 + alias_hmp = 2 + alias_uv = 3 + alias_nm = 4 default = 2 diff --git a/worlds/doom_1993/docs/setup_en.md b/worlds/doom_1993/docs/setup_en.md index 5d96e6a8056e..85061609abbb 100644 --- a/worlds/doom_1993/docs/setup_en.md +++ b/worlds/doom_1993/docs/setup_en.md @@ -17,7 +17,7 @@ You can find the folder in steam by finding the game in your library, right-clicking it and choosing **Manage -> Browse Local Files**. The WAD file is in the `/base/` folder. -## Joining a MultiWorld Game +## Joining a MultiWorld Game (via Launcher) 1. Launch apdoom-launcher.exe 2. Select `Ultimate DOOM` from the drop-down @@ -28,6 +28,24 @@ To continue a game, follow the same connection steps. Connecting with a different seed won't erase your progress in other seeds. +## Joining a MultiWorld Game (via command line) + +1. In your command line, navigate to the directory where APDOOM is installed. +2. Run `crispy-apdoom -game doom -apserver -applayer `, where: + - `` is the Archipelago server address, e.g. "`archipelago.gg:38281`" + - `` is your slot name; if it contains spaces, surround it with double quotes + - If the server has a password, add `-password`, followed by the server password +3. Enjoy! + +Optionally, you can override some randomization settings from the command line: +- `-apmonsterrando 0` will disable monster rando. +- `-apitemrando 0` will disable item rando. +- `-apmusicrando 0` will disable music rando. +- `-apfliplevels 0` will disable flipping levels. +- `-apresetlevelondeath 0` will disable resetting the level on death. +- `-apdeathlinkoff` will force DeathLink off if it's enabled. +- `-skill <1-5>` changes the game difficulty, from 1 (I'm too young to die) to 5 (Nightmare!) + ## Archipelago Text Client We recommend having Archipelago's Text Client open on the side to keep track of what items you receive and send. diff --git a/worlds/doom_ii/Options.py b/worlds/doom_ii/Options.py index 6ecfb1aecd6c..98c8ebc56e16 100644 --- a/worlds/doom_ii/Options.py +++ b/worlds/doom_ii/Options.py @@ -6,9 +6,9 @@ class Difficulty(Choice): """ - Choose the difficulty option. Those match DOOM's difficulty options. - baby (I'm too young to die.) double ammos, half damage, less monsters or strength. - easy (Hey, not too rough.) less monsters or strength. + Choose the game difficulty. These options match DOOM's skill levels. + baby (I'm too young to die.) Same as easy, with double ammo pickups and half damage taken. + easy (Hey, not too rough.) Less monsters or strength. medium (Hurt me plenty.) Default. hard (Ultra-Violence.) More monsters or strength. nightmare (Nightmare!) Monsters attack more rapidly and respawn. @@ -19,6 +19,11 @@ class Difficulty(Choice): option_medium = 2 option_hard = 3 option_nightmare = 4 + alias_itytd = 0 + alias_hntr = 1 + alias_hmp = 2 + alias_uv = 3 + alias_nm = 4 default = 2 diff --git a/worlds/doom_ii/docs/setup_en.md b/worlds/doom_ii/docs/setup_en.md index ec6697c76da2..e444f85bd7c7 100644 --- a/worlds/doom_ii/docs/setup_en.md +++ b/worlds/doom_ii/docs/setup_en.md @@ -15,7 +15,7 @@ You can find the folder in steam by finding the game in your library, right clicking it and choosing *Manage→Browse Local Files*. The WAD file is in the `/base/` folder. -## Joining a MultiWorld Game +## Joining a MultiWorld Game (via Launcher) 1. Launch apdoom-launcher.exe 2. Select `DOOM II` from the drop-down @@ -26,6 +26,24 @@ To continue a game, follow the same connection steps. Connecting with a different seed won't erase your progress in other seeds. +## Joining a MultiWorld Game (via command line) + +1. In your command line, navigate to the directory where APDOOM is installed. +2. Run `crispy-apdoom -game doom2 -apserver -applayer `, where: + - `` is the Archipelago server address, e.g. "`archipelago.gg:38281`" + - `` is your slot name; if it contains spaces, surround it with double quotes + - If the server has a password, add `-password`, followed by the server password +3. Enjoy! + +Optionally, you can override some randomization settings from the command line: +- `-apmonsterrando 0` will disable monster rando. +- `-apitemrando 0` will disable item rando. +- `-apmusicrando 0` will disable music rando. +- `-apfliplevels 0` will disable flipping levels. +- `-apresetlevelondeath 0` will disable resetting the level on death. +- `-apdeathlinkoff` will force DeathLink off if it's enabled. +- `-skill <1-5>` changes the game difficulty, from 1 (I'm too young to die) to 5 (Nightmare!) + ## Archipelago Text Client We recommend having Archipelago's Text Client open on the side to keep track of what items you receive and send. diff --git a/worlds/factorio/Options.py b/worlds/factorio/Options.py index 5a41250fa760..72f438778b60 100644 --- a/worlds/factorio/Options.py +++ b/worlds/factorio/Options.py @@ -6,7 +6,7 @@ from schema import Schema, Optional, And, Or from Options import Choice, OptionDict, OptionSet, DefaultOnToggle, Range, DeathLink, Toggle, \ - StartInventoryPool, PerGameCommonOptions + StartInventoryPool, PerGameCommonOptions, OptionGroup # schema helpers FloatRange = lambda low, high: And(Or(int, float), lambda f: low <= f <= high) @@ -272,6 +272,12 @@ class AtomicRocketTrapCount(TrapCount): display_name = "Atomic Rocket Traps" +class AtomicCliffRemoverTrapCount(TrapCount): + """Trap items that when received trigger an atomic rocket explosion on a random cliff. + Warning: there is no warning. The launch is instantaneous.""" + display_name = "Atomic Cliff Remover Traps" + + class EvolutionTrapCount(TrapCount): """Trap items that when received increase the enemy evolution.""" display_name = "Evolution Traps" @@ -293,7 +299,7 @@ class FactorioWorldGen(OptionDict): with in-depth documentation at https://lua-api.factorio.com/latest/Concepts.html#MapGenSettings""" display_name = "World Generation" # FIXME: do we want default be a rando-optimized default or in-game DS? - value: typing.Dict[str, typing.Dict[str, typing.Any]] + value: dict[str, dict[str, typing.Any]] default = { "autoplace_controls": { # terrain @@ -402,7 +408,7 @@ class FactorioWorldGen(OptionDict): } }) - def __init__(self, value: typing.Dict[str, typing.Any]): + def __init__(self, value: dict[str, typing.Any]): advanced = {"pollution", "enemy_evolution", "enemy_expansion"} self.value = { "basic": {k: v for k, v in value.items() if k not in advanced}, @@ -421,7 +427,7 @@ def optional_min_lte_max(container, min_key, max_key): optional_min_lte_max(enemy_expansion, "min_expansion_cooldown", "max_expansion_cooldown") @classmethod - def from_any(cls, data: typing.Dict[str, typing.Any]) -> FactorioWorldGen: + def from_any(cls, data: dict[str, typing.Any]) -> FactorioWorldGen: if type(data) == dict: return cls(data) else: @@ -435,7 +441,7 @@ class ImportedBlueprint(DefaultOnToggle): class EnergyLink(Toggle): """Allow sending energy to other worlds. 25% of the energy is lost in the transfer.""" - display_name = "EnergyLink" + display_name = "Energy Link" @dataclass @@ -467,9 +473,42 @@ class FactorioOptions(PerGameCommonOptions): cluster_grenade_traps: ClusterGrenadeTrapCount artillery_traps: ArtilleryTrapCount atomic_rocket_traps: AtomicRocketTrapCount + atomic_cliff_remover_traps: AtomicCliffRemoverTrapCount attack_traps: AttackTrapCount evolution_traps: EvolutionTrapCount evolution_trap_increase: EvolutionTrapIncrease death_link: DeathLink energy_link: EnergyLink start_inventory_from_pool: StartInventoryPool + + +option_groups: list[OptionGroup] = [ + OptionGroup( + "Technologies", + [ + TechTreeLayout, + Progressive, + MinTechCost, + MaxTechCost, + TechCostDistribution, + TechCostMix, + RampingTechCosts, + TechTreeInformation, + ] + ), + OptionGroup( + "Traps", + [ + AttackTrapCount, + EvolutionTrapCount, + EvolutionTrapIncrease, + TeleportTrapCount, + GrenadeTrapCount, + ClusterGrenadeTrapCount, + ArtilleryTrapCount, + AtomicRocketTrapCount, + AtomicCliffRemoverTrapCount, + ], + start_collapsed=True + ), +] diff --git a/worlds/factorio/__init__.py b/worlds/factorio/__init__.py index 9f1f3cb573f9..8f8abeb292f1 100644 --- a/worlds/factorio/__init__.py +++ b/worlds/factorio/__init__.py @@ -12,7 +12,8 @@ from worlds.generic import Rules from .Locations import location_pools, location_table from .Mod import generate_mod -from .Options import FactorioOptions, MaxSciencePack, Silo, Satellite, TechTreeInformation, Goal, TechCostDistribution +from .Options import (FactorioOptions, MaxSciencePack, Silo, Satellite, TechTreeInformation, Goal, + TechCostDistribution, option_groups) from .Shapes import get_shapes from .Technologies import base_tech_table, recipe_sources, base_technology_table, \ all_product_sources, required_technologies, get_rocket_requirements, \ @@ -61,6 +62,7 @@ class FactorioWeb(WebWorld): "setup/en", ["Berserker, Farrak Kilhn"] )] + option_groups = option_groups class FactorioItem(Item): @@ -75,6 +77,7 @@ class FactorioItem(Item): all_items["Cluster Grenade Trap"] = factorio_base_id - 5 all_items["Artillery Trap"] = factorio_base_id - 6 all_items["Atomic Rocket Trap"] = factorio_base_id - 7 +all_items["Atomic Cliff Remover Trap"] = factorio_base_id - 8 class Factorio(World): @@ -140,6 +143,7 @@ def create_regions(self): self.options.grenade_traps + \ self.options.cluster_grenade_traps + \ self.options.atomic_rocket_traps + \ + self.options.atomic_cliff_remover_traps + \ self.options.artillery_traps location_pool = [] @@ -192,7 +196,8 @@ def sorter(loc: FactorioScienceLocation): def create_items(self) -> None: self.custom_technologies = self.set_custom_technologies() self.set_custom_recipes() - traps = ("Evolution", "Attack", "Teleport", "Grenade", "Cluster Grenade", "Artillery", "Atomic Rocket") + traps = ("Evolution", "Attack", "Teleport", "Grenade", "Cluster Grenade", "Artillery", "Atomic Rocket", + "Atomic Cliff Remover") for trap_name in traps: self.multiworld.itempool.extend(self.create_item(f"{trap_name} Trap") for _ in range(getattr(self.options, diff --git a/worlds/factorio/data/mod/lib.lua b/worlds/factorio/data/mod/lib.lua index 7be7403e48f1..517a54e3d642 100644 --- a/worlds/factorio/data/mod/lib.lua +++ b/worlds/factorio/data/mod/lib.lua @@ -28,12 +28,23 @@ function random_offset_position(position, offset) end function fire_entity_at_players(entity_name, speed) + local entities = {} for _, player in ipairs(game.forces["player"].players) do - current_character = player.character - if current_character ~= nil then - current_character.surface.create_entity{name=entity_name, - position=random_offset_position(current_character.position, 128), - target=current_character, speed=speed} + if player.character ~= nil then + table.insert(entities, player.character) end end + return fire_entity_at_entities(entity_name, entities, speed) +end + +function fire_entity_at_entities(entity_name, entities, speed) + for _, current_entity in ipairs(entities) do + local target = current_entity + if target.health == nil then + target = target.position + end + current_entity.surface.create_entity{name=entity_name, + position=random_offset_position(current_entity.position, 128), + target=target, speed=speed} + end end diff --git a/worlds/factorio/data/mod_template/control.lua b/worlds/factorio/data/mod_template/control.lua index b08608a60ae9..e486c7433095 100644 --- a/worlds/factorio/data/mod_template/control.lua +++ b/worlds/factorio/data/mod_template/control.lua @@ -737,6 +737,13 @@ end, ["Atomic Rocket Trap"] = function () fire_entity_at_players("atomic-rocket", 0.1) end, +["Atomic Cliff Remover Trap"] = function () + local cliffs = game.surfaces["nauvis"].find_entities_filtered{type = "cliff"} + + if #cliffs > 0 then + fire_entity_at_entities("atomic-rocket", {cliffs[math.random(#cliffs)]}, 0.1) + end +end, } commands.add_command("ap-get-technology", "Grant a technology, used by the Archipelago Client.", function(call) diff --git a/worlds/faxanadu/Items.py b/worlds/faxanadu/Items.py new file mode 100644 index 000000000000..4815fde9de66 --- /dev/null +++ b/worlds/faxanadu/Items.py @@ -0,0 +1,58 @@ +from BaseClasses import ItemClassification +from typing import List, Optional + + +class ItemDef: + def __init__(self, + id: Optional[int], + name: str, + classification: ItemClassification, + count: int, + progression_count: int, + prefill_location: Optional[str]): + self.id = id + self.name = name + self.classification = classification + self.count = count + self.progression_count = progression_count + self.prefill_location = prefill_location + + +items: List[ItemDef] = [ + ItemDef(400000, 'Progressive Sword', ItemClassification.progression, 4, 0, None), + ItemDef(400001, 'Progressive Armor', ItemClassification.progression, 3, 0, None), + ItemDef(400002, 'Progressive Shield', ItemClassification.useful, 4, 0, None), + ItemDef(400003, 'Spring Elixir', ItemClassification.progression, 1, 0, None), + ItemDef(400004, 'Mattock', ItemClassification.progression, 1, 0, None), + ItemDef(400005, 'Unlock Wingboots', ItemClassification.progression, 1, 0, None), + ItemDef(400006, 'Key Jack', ItemClassification.progression, 1, 0, None), + ItemDef(400007, 'Key Queen', ItemClassification.progression, 1, 0, None), + ItemDef(400008, 'Key King', ItemClassification.progression, 1, 0, None), + ItemDef(400009, 'Key Joker', ItemClassification.progression, 1, 0, None), + ItemDef(400010, 'Key Ace', ItemClassification.progression, 1, 0, None), + ItemDef(400011, 'Ring of Ruby', ItemClassification.progression, 1, 0, None), + ItemDef(400012, 'Ring of Dworf', ItemClassification.progression, 1, 0, None), + ItemDef(400013, 'Demons Ring', ItemClassification.progression, 1, 0, None), + ItemDef(400014, 'Black Onyx', ItemClassification.progression, 1, 0, None), + ItemDef(None, 'Sky Spring Flow', ItemClassification.progression, 1, 0, 'Sky Spring'), + ItemDef(None, 'Tower of Fortress Spring Flow', ItemClassification.progression, 1, 0, 'Tower of Fortress Spring'), + ItemDef(None, 'Joker Spring Flow', ItemClassification.progression, 1, 0, 'Joker Spring'), + ItemDef(400015, 'Deluge', ItemClassification.progression, 1, 0, None), + ItemDef(400016, 'Thunder', ItemClassification.useful, 1, 0, None), + ItemDef(400017, 'Fire', ItemClassification.useful, 1, 0, None), + ItemDef(400018, 'Death', ItemClassification.useful, 1, 0, None), + ItemDef(400019, 'Tilte', ItemClassification.useful, 1, 0, None), + ItemDef(400020, 'Ring of Elf', ItemClassification.useful, 1, 0, None), + ItemDef(400021, 'Magical Rod', ItemClassification.useful, 1, 0, None), + ItemDef(400022, 'Pendant', ItemClassification.useful, 1, 0, None), + ItemDef(400023, 'Hourglass', ItemClassification.filler, 6, 0, None), + # We need at least 4 red potions for the Tower of Red Potion. Up to the player to save them up! + ItemDef(400024, 'Red Potion', ItemClassification.filler, 15, 4, None), + ItemDef(400025, 'Elixir', ItemClassification.filler, 4, 0, None), + ItemDef(400026, 'Glove', ItemClassification.filler, 5, 0, None), + ItemDef(400027, 'Ointment', ItemClassification.filler, 8, 0, None), + ItemDef(400028, 'Poison', ItemClassification.trap, 13, 0, None), + ItemDef(None, 'Killed Evil One', ItemClassification.progression, 1, 0, 'Evil One'), + # Placeholder item so the game knows which shop slot to prefill wingboots + ItemDef(400029, 'Wingboots', ItemClassification.useful, 0, 0, None), +] diff --git a/worlds/faxanadu/Locations.py b/worlds/faxanadu/Locations.py new file mode 100644 index 000000000000..ebb785f9391a --- /dev/null +++ b/worlds/faxanadu/Locations.py @@ -0,0 +1,199 @@ +from typing import List, Optional + + +class LocationType(): + world = 1 # Just standing there in the world + hidden = 2 # Kill all monsters in the room to reveal, each "item room" counter tick. + boss_reward = 3 # Kill a boss to reveal the item + shop = 4 # Buy at a shop + give = 5 # Given by an NPC + spring = 6 # Activatable spring + boss = 7 # Entity to kill to trigger the check + + +class ItemType(): + unknown = 0 # Or don't care + red_potion = 1 + + +class LocationDef: + def __init__(self, id: Optional[int], name: str, region: str, type: int, original_item: int): + self.id = id + self.name = name + self.region = region + self.type = type + self.original_item = original_item + + +locations: List[LocationDef] = [ + # Eolis + LocationDef(400100, 'Eolis Guru', 'Eolis', LocationType.give, ItemType.unknown), + LocationDef(400101, 'Eolis Key Jack', 'Eolis', LocationType.shop, ItemType.unknown), + LocationDef(400102, 'Eolis Hand Dagger', 'Eolis', LocationType.shop, ItemType.unknown), + LocationDef(400103, 'Eolis Red Potion', 'Eolis', LocationType.shop, ItemType.red_potion), + LocationDef(400104, 'Eolis Elixir', 'Eolis', LocationType.shop, ItemType.unknown), + LocationDef(400105, 'Eolis Deluge', 'Eolis', LocationType.shop, ItemType.unknown), + + # Path to Apolune + LocationDef(400106, 'Path to Apolune Magic Shield', 'Path to Apolune', LocationType.shop, ItemType.unknown), + LocationDef(400107, 'Path to Apolune Death', 'Path to Apolune', LocationType.shop, ItemType.unknown), + + # Apolune + LocationDef(400108, 'Apolune Small Shield', 'Apolune', LocationType.shop, ItemType.unknown), + LocationDef(400109, 'Apolune Hand Dagger', 'Apolune', LocationType.shop, ItemType.unknown), + LocationDef(400110, 'Apolune Deluge', 'Apolune', LocationType.shop, ItemType.unknown), + LocationDef(400111, 'Apolune Red Potion', 'Apolune', LocationType.shop, ItemType.red_potion), + LocationDef(400112, 'Apolune Key Jack', 'Apolune', LocationType.shop, ItemType.unknown), + + # Tower of Trunk + LocationDef(400113, 'Tower of Trunk Hidden Mattock', 'Tower of Trunk', LocationType.hidden, ItemType.unknown), + LocationDef(400114, 'Tower of Trunk Hidden Hourglass', 'Tower of Trunk', LocationType.hidden, ItemType.unknown), + LocationDef(400115, 'Tower of Trunk Boss Mattock', 'Tower of Trunk', LocationType.boss_reward, ItemType.unknown), + + # Path to Forepaw + LocationDef(400116, 'Path to Forepaw Hidden Red Potion', 'Path to Forepaw', LocationType.hidden, ItemType.red_potion), + LocationDef(400117, 'Path to Forepaw Glove', 'Path to Forepaw', LocationType.world, ItemType.unknown), + + # Forepaw + LocationDef(400118, 'Forepaw Long Sword', 'Forepaw', LocationType.shop, ItemType.unknown), + LocationDef(400119, 'Forepaw Studded Mail', 'Forepaw', LocationType.shop, ItemType.unknown), + LocationDef(400120, 'Forepaw Small Shield', 'Forepaw', LocationType.shop, ItemType.unknown), + LocationDef(400121, 'Forepaw Red Potion', 'Forepaw', LocationType.shop, ItemType.red_potion), + LocationDef(400122, 'Forepaw Wingboots', 'Forepaw', LocationType.shop, ItemType.unknown), + LocationDef(400123, 'Forepaw Key Jack', 'Forepaw', LocationType.shop, ItemType.unknown), + LocationDef(400124, 'Forepaw Key Queen', 'Forepaw', LocationType.shop, ItemType.unknown), + + # Trunk + LocationDef(400125, 'Trunk Hidden Ointment', 'Trunk', LocationType.hidden, ItemType.unknown), + LocationDef(400126, 'Trunk Hidden Red Potion', 'Trunk', LocationType.hidden, ItemType.red_potion), + LocationDef(400127, 'Trunk Red Potion', 'Trunk', LocationType.world, ItemType.red_potion), + LocationDef(None, 'Sky Spring', 'Trunk', LocationType.spring, ItemType.unknown), + + # Joker Spring + LocationDef(400128, 'Joker Spring Ruby Ring', 'Joker Spring', LocationType.give, ItemType.unknown), + LocationDef(None, 'Joker Spring', 'Joker Spring', LocationType.spring, ItemType.unknown), + + # Tower of Fortress + LocationDef(400129, 'Tower of Fortress Poison 1', 'Tower of Fortress', LocationType.world, ItemType.unknown), + LocationDef(400130, 'Tower of Fortress Poison 2', 'Tower of Fortress', LocationType.world, ItemType.unknown), + LocationDef(400131, 'Tower of Fortress Hidden Wingboots', 'Tower of Fortress', LocationType.world, ItemType.unknown), + LocationDef(400132, 'Tower of Fortress Ointment', 'Tower of Fortress', LocationType.world, ItemType.unknown), + LocationDef(400133, 'Tower of Fortress Boss Wingboots', 'Tower of Fortress', LocationType.boss_reward, ItemType.unknown), + LocationDef(400134, 'Tower of Fortress Elixir', 'Tower of Fortress', LocationType.world, ItemType.unknown), + LocationDef(400135, 'Tower of Fortress Guru', 'Tower of Fortress', LocationType.give, ItemType.unknown), + LocationDef(None, 'Tower of Fortress Spring', 'Tower of Fortress', LocationType.spring, ItemType.unknown), + + # Path to Mascon + LocationDef(400136, 'Path to Mascon Hidden Wingboots', 'Path to Mascon', LocationType.hidden, ItemType.unknown), + + # Tower of Red Potion + LocationDef(400137, 'Tower of Red Potion', 'Tower of Red Potion', LocationType.world, ItemType.red_potion), + + # Mascon + LocationDef(400138, 'Mascon Large Shield', 'Mascon', LocationType.shop, ItemType.unknown), + LocationDef(400139, 'Mascon Thunder', 'Mascon', LocationType.shop, ItemType.unknown), + LocationDef(400140, 'Mascon Mattock', 'Mascon', LocationType.shop, ItemType.unknown), + LocationDef(400141, 'Mascon Red Potion', 'Mascon', LocationType.shop, ItemType.red_potion), + LocationDef(400142, 'Mascon Key Jack', 'Mascon', LocationType.shop, ItemType.unknown), + LocationDef(400143, 'Mascon Key Queen', 'Mascon', LocationType.shop, ItemType.unknown), + + # Path to Victim + LocationDef(400144, 'Misty Shop Death', 'Path to Victim', LocationType.shop, ItemType.unknown), + LocationDef(400145, 'Misty Shop Hourglass', 'Path to Victim', LocationType.shop, ItemType.unknown), + LocationDef(400146, 'Misty Shop Elixir', 'Path to Victim', LocationType.shop, ItemType.unknown), + LocationDef(400147, 'Misty Shop Red Potion', 'Path to Victim', LocationType.shop, ItemType.red_potion), + LocationDef(400148, 'Misty Doctor Office', 'Path to Victim', LocationType.hidden, ItemType.unknown), + + # Tower of Suffer + LocationDef(400149, 'Tower of Suffer Hidden Wingboots', 'Tower of Suffer', LocationType.hidden, ItemType.unknown), + LocationDef(400150, 'Tower of Suffer Hidden Hourglass', 'Tower of Suffer', LocationType.hidden, ItemType.unknown), + LocationDef(400151, 'Tower of Suffer Pendant', 'Tower of Suffer', LocationType.boss_reward, ItemType.unknown), + + # Victim + LocationDef(400152, 'Victim Full Plate', 'Victim', LocationType.shop, ItemType.unknown), + LocationDef(400153, 'Victim Mattock', 'Victim', LocationType.shop, ItemType.unknown), + LocationDef(400154, 'Victim Red Potion', 'Victim', LocationType.shop, ItemType.red_potion), + LocationDef(400155, 'Victim Key King', 'Victim', LocationType.shop, ItemType.unknown), + LocationDef(400156, 'Victim Key Queen', 'Victim', LocationType.shop, ItemType.unknown), + LocationDef(400157, 'Victim Tavern', 'Mist', LocationType.give, ItemType.unknown), + + # Mist + LocationDef(400158, 'Mist Hidden Poison 1', 'Mist', LocationType.hidden, ItemType.unknown), + LocationDef(400159, 'Mist Hidden Poison 2', 'Mist', LocationType.hidden, ItemType.unknown), + LocationDef(400160, 'Mist Hidden Wingboots', 'Mist', LocationType.hidden, ItemType.unknown), + LocationDef(400161, 'Misty Magic Hall', 'Mist', LocationType.give, ItemType.unknown), + LocationDef(400162, 'Misty House', 'Mist', LocationType.give, ItemType.unknown), + + # Useless Tower + LocationDef(400163, 'Useless Tower', 'Useless Tower', LocationType.hidden, ItemType.unknown), + + # Tower of Mist + LocationDef(400164, 'Tower of Mist Hidden Ointment', 'Tower of Mist', LocationType.hidden, ItemType.unknown), + LocationDef(400165, 'Tower of Mist Elixir', 'Tower of Mist', LocationType.world, ItemType.unknown), + LocationDef(400166, 'Tower of Mist Black Onyx', 'Tower of Mist', LocationType.boss_reward, ItemType.unknown), + + # Path to Conflate + LocationDef(400167, 'Path to Conflate Hidden Ointment', 'Path to Conflate', LocationType.hidden, ItemType.unknown), + LocationDef(400168, 'Path to Conflate Poison', 'Path to Conflate', LocationType.hidden, ItemType.unknown), + + # Helm Branch + LocationDef(400169, 'Helm Branch Hidden Glove', 'Helm Branch', LocationType.hidden, ItemType.unknown), + LocationDef(400170, 'Helm Branch Battle Helmet', 'Helm Branch', LocationType.boss_reward, ItemType.unknown), + + # Conflate + LocationDef(400171, 'Conflate Giant Blade', 'Conflate', LocationType.shop, ItemType.unknown), + LocationDef(400172, 'Conflate Magic Shield', 'Conflate', LocationType.shop, ItemType.unknown), + LocationDef(400173, 'Conflate Wingboots', 'Conflate', LocationType.shop, ItemType.unknown), + LocationDef(400174, 'Conflate Red Potion', 'Conflate', LocationType.shop, ItemType.red_potion), + LocationDef(400175, 'Conflate Guru', 'Conflate', LocationType.give, ItemType.unknown), + + # Branches + LocationDef(400176, 'Branches Hidden Ointment', 'Branches', LocationType.hidden, ItemType.unknown), + LocationDef(400177, 'Branches Poison', 'Branches', LocationType.world, ItemType.unknown), + LocationDef(400178, 'Branches Hidden Mattock', 'Branches', LocationType.hidden, ItemType.unknown), + LocationDef(400179, 'Branches Hidden Hourglass', 'Branches', LocationType.hidden, ItemType.unknown), + + # Path to Daybreak + LocationDef(400180, 'Path to Daybreak Hidden Wingboots 1', 'Path to Daybreak', LocationType.hidden, ItemType.unknown), + LocationDef(400181, 'Path to Daybreak Magical Rod', 'Path to Daybreak', LocationType.world, ItemType.unknown), + LocationDef(400182, 'Path to Daybreak Hidden Wingboots 2', 'Path to Daybreak', LocationType.hidden, ItemType.unknown), + LocationDef(400183, 'Path to Daybreak Poison', 'Path to Daybreak', LocationType.world, ItemType.unknown), + LocationDef(400184, 'Path to Daybreak Glove', 'Path to Daybreak', LocationType.world, ItemType.unknown), + LocationDef(400185, 'Path to Daybreak Battle Suit', 'Path to Daybreak', LocationType.boss_reward, ItemType.unknown), + + # Daybreak + LocationDef(400186, 'Daybreak Tilte', 'Daybreak', LocationType.shop, ItemType.unknown), + LocationDef(400187, 'Daybreak Giant Blade', 'Daybreak', LocationType.shop, ItemType.unknown), + LocationDef(400188, 'Daybreak Red Potion', 'Daybreak', LocationType.shop, ItemType.red_potion), + LocationDef(400189, 'Daybreak Key King', 'Daybreak', LocationType.shop, ItemType.unknown), + LocationDef(400190, 'Daybreak Key Queen', 'Daybreak', LocationType.shop, ItemType.unknown), + + # Dartmoor Castle + LocationDef(400191, 'Dartmoor Castle Hidden Hourglass', 'Dartmoor Castle', LocationType.hidden, ItemType.unknown), + LocationDef(400192, 'Dartmoor Castle Hidden Red Potion', 'Dartmoor Castle', LocationType.hidden, ItemType.red_potion), + + # Dartmoor + LocationDef(400193, 'Dartmoor Giant Blade', 'Dartmoor', LocationType.shop, ItemType.unknown), + LocationDef(400194, 'Dartmoor Red Potion', 'Dartmoor', LocationType.shop, ItemType.red_potion), + LocationDef(400195, 'Dartmoor Key King', 'Dartmoor', LocationType.shop, ItemType.unknown), + + # Fraternal Castle + LocationDef(400196, 'Fraternal Castle Hidden Ointment', 'Fraternal Castle', LocationType.hidden, ItemType.unknown), + LocationDef(400197, 'Fraternal Castle Shop Hidden Ointment', 'Fraternal Castle', LocationType.hidden, ItemType.unknown), + LocationDef(400198, 'Fraternal Castle Poison 1', 'Fraternal Castle', LocationType.world, ItemType.unknown), + LocationDef(400199, 'Fraternal Castle Poison 2', 'Fraternal Castle', LocationType.world, ItemType.unknown), + LocationDef(400200, 'Fraternal Castle Poison 3', 'Fraternal Castle', LocationType.world, ItemType.unknown), + # LocationDef(400201, 'Fraternal Castle Red Potion', 'Fraternal Castle', LocationType.world, ItemType.red_potion), # This location is inaccessible. Keeping commented for context. + LocationDef(400202, 'Fraternal Castle Hidden Hourglass', 'Fraternal Castle', LocationType.hidden, ItemType.unknown), + LocationDef(400203, 'Fraternal Castle Dragon Slayer', 'Fraternal Castle', LocationType.boss_reward, ItemType.unknown), + LocationDef(400204, 'Fraternal Castle Guru', 'Fraternal Castle', LocationType.give, ItemType.unknown), + + # Evil Fortress + LocationDef(400205, 'Evil Fortress Ointment', 'Evil Fortress', LocationType.world, ItemType.unknown), + LocationDef(400206, 'Evil Fortress Poison 1', 'Evil Fortress', LocationType.world, ItemType.unknown), + LocationDef(400207, 'Evil Fortress Glove', 'Evil Fortress', LocationType.world, ItemType.unknown), + LocationDef(400208, 'Evil Fortress Poison 2', 'Evil Fortress', LocationType.world, ItemType.unknown), + LocationDef(400209, 'Evil Fortress Poison 3', 'Evil Fortress', LocationType.world, ItemType.unknown), + LocationDef(400210, 'Evil Fortress Hidden Glove', 'Evil Fortress', LocationType.hidden, ItemType.unknown), + LocationDef(None, 'Evil One', 'Evil Fortress', LocationType.boss, ItemType.unknown), +] diff --git a/worlds/faxanadu/Options.py b/worlds/faxanadu/Options.py new file mode 100644 index 000000000000..dbcb5789944f --- /dev/null +++ b/worlds/faxanadu/Options.py @@ -0,0 +1,107 @@ +from Options import PerGameCommonOptions, Toggle, DefaultOnToggle, StartInventoryPool, Choice +from dataclasses import dataclass + + +class KeepShopRedPotions(Toggle): + """ + Prevents the Shop's Red Potions from being shuffled. Those locations + will have purchasable Red Potion as usual for their usual price. + """ + display_name = "Keep Shop Red Potions" + + +class IncludePendant(Toggle): + """ + Pendant is an item that boosts your attack power permanently when picked up. + However, due to a programming error in the original game, it has the reverse + effect. You start with the Pendant power, and lose it when picking + it up. So this item is essentially a trap. + There is a setting in the client to reverse the effect back to its original intend. + This could be used in conjunction with this option to increase or lower difficulty. + """ + display_name = "Include Pendant" + + +class IncludePoisons(DefaultOnToggle): + """ + Whether or not to include Poison Potions in the pool of items. Including them + effectively turn them into traps in multiplayer. + """ + display_name = "Include Poisons" + + +class RequireDragonSlayer(Toggle): + """ + Requires the Dragon Slayer to be available before fighting the final boss is required. + Turning this on will turn Progressive Shields into progression items. + + This setting does not force you to use Dragon Slayer to kill the final boss. + Instead, it ensures that you will have the Dragon Slayer and be able to equip + it before you are expected to beat the final boss. + """ + display_name = "Require Dragon Slayer" + + +class RandomMusic(Toggle): + """ + All levels' music is shuffled. Except the title screen because it's finite. + This is an aesthetic option and doesn't affect gameplay. + """ + display_name = "Random Musics" + + +class RandomSound(Toggle): + """ + All sounds are shuffled. + This is an aesthetic option and doesn't affect gameplay. + """ + display_name = "Random Sounds" + + +class RandomNPC(Toggle): + """ + NPCs and their portraits are shuffled. + This is an aesthetic option and doesn't affect gameplay. + """ + display_name = "Random NPCs" + + +class RandomMonsters(Choice): + """ + Choose how monsters are randomized. + "Vanilla": No randomization + "Level Shuffle": Monsters are shuffled within a level + "Level Random": Monsters are picked randomly, balanced based on the ratio of the current level + "World Shuffle": Monsters are shuffled across the entire world + "World Random": Monsters are picked randomly, balanced based on the ratio of the entire world + "Chaotic": Completely random, except big vs small ratio is kept. Big are mini-bosses. + """ + display_name = "Random Monsters" + option_vanilla = 0 + option_level_shuffle = 1 + option_level_random = 2 + option_world_shuffle = 3 + option_world_random = 4 + option_chaotic = 5 + default = 0 + + +class RandomRewards(Toggle): + """ + Monsters drops are shuffled. + """ + display_name = "Random Rewards" + + +@dataclass +class FaxanaduOptions(PerGameCommonOptions): + start_inventory_from_pool: StartInventoryPool + keep_shop_red_potions: KeepShopRedPotions + include_pendant: IncludePendant + include_poisons: IncludePoisons + require_dragon_slayer: RequireDragonSlayer + random_musics: RandomMusic + random_sounds: RandomSound + random_npcs: RandomNPC + random_monsters: RandomMonsters + random_rewards: RandomRewards diff --git a/worlds/faxanadu/Regions.py b/worlds/faxanadu/Regions.py new file mode 100644 index 000000000000..9db11d8ef114 --- /dev/null +++ b/worlds/faxanadu/Regions.py @@ -0,0 +1,66 @@ +from BaseClasses import Region +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from . import FaxanaduWorld + + +def create_region(name, player, multiworld): + region = Region(name, player, multiworld) + multiworld.regions.append(region) + return region + + +def create_regions(faxanadu_world: "FaxanaduWorld"): + player = faxanadu_world.player + multiworld = faxanadu_world.multiworld + + # Create regions + menu = create_region("Menu", player, multiworld) + eolis = create_region("Eolis", player, multiworld) + path_to_apolune = create_region("Path to Apolune", player, multiworld) + apolune = create_region("Apolune", player, multiworld) + create_region("Tower of Trunk", player, multiworld) + path_to_forepaw = create_region("Path to Forepaw", player, multiworld) + forepaw = create_region("Forepaw", player, multiworld) + trunk = create_region("Trunk", player, multiworld) + create_region("Joker Spring", player, multiworld) + create_region("Tower of Fortress", player, multiworld) + path_to_mascon = create_region("Path to Mascon", player, multiworld) + create_region("Tower of Red Potion", player, multiworld) + mascon = create_region("Mascon", player, multiworld) + path_to_victim = create_region("Path to Victim", player, multiworld) + create_region("Tower of Suffer", player, multiworld) + victim = create_region("Victim", player, multiworld) + mist = create_region("Mist", player, multiworld) + create_region("Useless Tower", player, multiworld) + create_region("Tower of Mist", player, multiworld) + path_to_conflate = create_region("Path to Conflate", player, multiworld) + create_region("Helm Branch", player, multiworld) + create_region("Conflate", player, multiworld) + branches = create_region("Branches", player, multiworld) + path_to_daybreak = create_region("Path to Daybreak", player, multiworld) + daybreak = create_region("Daybreak", player, multiworld) + dartmoor_castle = create_region("Dartmoor Castle", player, multiworld) + create_region("Dartmoor", player, multiworld) + create_region("Fraternal Castle", player, multiworld) + create_region("Evil Fortress", player, multiworld) + + # Create connections + menu.add_exits(["Eolis"]) + eolis.add_exits(["Path to Apolune"]) + path_to_apolune.add_exits(["Apolune"]) + apolune.add_exits(["Tower of Trunk", "Path to Forepaw"]) + path_to_forepaw.add_exits(["Forepaw"]) + forepaw.add_exits(["Trunk"]) + trunk.add_exits(["Joker Spring", "Tower of Fortress", "Path to Mascon"]) + path_to_mascon.add_exits(["Tower of Red Potion", "Mascon"]) + mascon.add_exits(["Path to Victim"]) + path_to_victim.add_exits(["Tower of Suffer", "Victim"]) + victim.add_exits(["Mist"]) + mist.add_exits(["Useless Tower", "Tower of Mist", "Path to Conflate"]) + path_to_conflate.add_exits(["Helm Branch", "Conflate", "Branches"]) + branches.add_exits(["Path to Daybreak"]) + path_to_daybreak.add_exits(["Daybreak"]) + daybreak.add_exits(["Dartmoor Castle"]) + dartmoor_castle.add_exits(["Dartmoor", "Fraternal Castle", "Evil Fortress"]) diff --git a/worlds/faxanadu/Rules.py b/worlds/faxanadu/Rules.py new file mode 100644 index 000000000000..a48b442c107a --- /dev/null +++ b/worlds/faxanadu/Rules.py @@ -0,0 +1,79 @@ +from typing import TYPE_CHECKING +from worlds.generic.Rules import set_rule + +if TYPE_CHECKING: + from . import FaxanaduWorld + + +def can_buy_in_eolis(state, player): + # Sword or Deluge so we can farm for gold. + # Ring of Elf so we can get 1500 from the King. + return state.has_any(["Progressive Sword", "Deluge", "Ring of Elf"], player) + + +def has_any_magic(state, player): + return state.has_any(["Deluge", "Thunder", "Fire", "Death", "Tilte"], player) + + +def set_rules(faxanadu_world: "FaxanaduWorld"): + player = faxanadu_world.player + multiworld = faxanadu_world.multiworld + + # Region rules + set_rule(multiworld.get_entrance("Eolis -> Path to Apolune", player), lambda state: + state.has_all(["Key Jack", "Progressive Sword"], player)) # You can't go far with magic only + set_rule(multiworld.get_entrance("Apolune -> Tower of Trunk", player), lambda state: state.has("Key Jack", player)) + set_rule(multiworld.get_entrance("Apolune -> Path to Forepaw", player), lambda state: state.has("Mattock", player)) + set_rule(multiworld.get_entrance("Trunk -> Joker Spring", player), lambda state: state.has("Key Joker", player)) + set_rule(multiworld.get_entrance("Trunk -> Tower of Fortress", player), lambda state: state.has("Key Jack", player)) + set_rule(multiworld.get_entrance("Trunk -> Path to Mascon", player), lambda state: + state.has_all(["Key Queen", "Ring of Ruby", "Sky Spring Flow", "Tower of Fortress Spring Flow", "Joker Spring Flow"], player) and + state.has("Progressive Sword", player, 2)) + set_rule(multiworld.get_entrance("Path to Mascon -> Tower of Red Potion", player), lambda state: + state.has("Key Queen", player) and + state.has("Red Potion", player, 4)) # It's impossible to go through the tower of Red Potion without at least 1-2 potions. Give them 4 for good measure. + set_rule(multiworld.get_entrance("Path to Victim -> Tower of Suffer", player), lambda state: state.has("Key Queen", player)) + set_rule(multiworld.get_entrance("Path to Victim -> Victim", player), lambda state: state.has("Unlock Wingboots", player)) + set_rule(multiworld.get_entrance("Mist -> Useless Tower", player), lambda state: + state.has_all(["Key King", "Unlock Wingboots"], player)) + set_rule(multiworld.get_entrance("Mist -> Tower of Mist", player), lambda state: state.has("Key King", player)) + set_rule(multiworld.get_entrance("Mist -> Path to Conflate", player), lambda state: state.has("Key Ace", player)) + set_rule(multiworld.get_entrance("Path to Conflate -> Helm Branch", player), lambda state: state.has("Key King", player)) + set_rule(multiworld.get_entrance("Path to Conflate -> Branches", player), lambda state: state.has("Key King", player)) + set_rule(multiworld.get_entrance("Daybreak -> Dartmoor Castle", player), lambda state: state.has("Ring of Dworf", player)) + set_rule(multiworld.get_entrance("Dartmoor Castle -> Evil Fortress", player), lambda state: state.has("Demons Ring", player)) + + # Location rules + set_rule(multiworld.get_location("Eolis Key Jack", player), lambda state: can_buy_in_eolis(state, player)) + set_rule(multiworld.get_location("Eolis Hand Dagger", player), lambda state: can_buy_in_eolis(state, player)) + set_rule(multiworld.get_location("Eolis Elixir", player), lambda state: can_buy_in_eolis(state, player)) + set_rule(multiworld.get_location("Eolis Deluge", player), lambda state: can_buy_in_eolis(state, player)) + set_rule(multiworld.get_location("Eolis Red Potion", player), lambda state: can_buy_in_eolis(state, player)) + set_rule(multiworld.get_location("Path to Apolune Magic Shield", player), lambda state: state.has("Key King", player)) # Mid-late cost, make sure we've progressed + set_rule(multiworld.get_location("Path to Apolune Death", player), lambda state: state.has("Key Ace", player)) # Mid-late cost, make sure we've progressed + set_rule(multiworld.get_location("Tower of Trunk Hidden Mattock", player), lambda state: + # This is actually possible if the monster drop into the stairs and kill it with dagger. But it's a "pro move" + state.has("Deluge", player, 1) or + state.has("Progressive Sword", player, 2)) + set_rule(multiworld.get_location("Path to Forepaw Glove", player), lambda state: + state.has_all(["Deluge", "Unlock Wingboots"], player)) + set_rule(multiworld.get_location("Trunk Red Potion", player), lambda state: state.has("Unlock Wingboots", player)) + set_rule(multiworld.get_location("Sky Spring", player), lambda state: state.has("Unlock Wingboots", player)) + set_rule(multiworld.get_location("Tower of Fortress Spring", player), lambda state: state.has("Spring Elixir", player)) + set_rule(multiworld.get_location("Tower of Fortress Guru", player), lambda state: state.has("Sky Spring Flow", player)) + set_rule(multiworld.get_location("Tower of Suffer Hidden Wingboots", player), lambda state: + state.has("Deluge", player) or + state.has("Progressive Sword", player, 2)) + set_rule(multiworld.get_location("Misty House", player), lambda state: state.has("Black Onyx", player)) + set_rule(multiworld.get_location("Misty Doctor Office", player), lambda state: has_any_magic(state, player)) + set_rule(multiworld.get_location("Conflate Guru", player), lambda state: state.has("Progressive Armor", player, 3)) + set_rule(multiworld.get_location("Branches Hidden Mattock", player), lambda state: state.has("Unlock Wingboots", player)) + set_rule(multiworld.get_location("Path to Daybreak Glove", player), lambda state: state.has("Unlock Wingboots", player)) + set_rule(multiworld.get_location("Dartmoor Castle Hidden Hourglass", player), lambda state: state.has("Unlock Wingboots", player)) + set_rule(multiworld.get_location("Dartmoor Castle Hidden Red Potion", player), lambda state: has_any_magic(state, player)) + set_rule(multiworld.get_location("Fraternal Castle Guru", player), lambda state: state.has("Progressive Sword", player, 4)) + set_rule(multiworld.get_location("Fraternal Castle Shop Hidden Ointment", player), lambda state: has_any_magic(state, player)) + + if faxanadu_world.options.require_dragon_slayer.value: + set_rule(multiworld.get_location("Evil One", player), lambda state: + state.has_all_counts({"Progressive Sword": 4, "Progressive Armor": 3, "Progressive Shield": 4}, player)) diff --git a/worlds/faxanadu/__init__.py b/worlds/faxanadu/__init__.py new file mode 100644 index 000000000000..c4ae1ccaa198 --- /dev/null +++ b/worlds/faxanadu/__init__.py @@ -0,0 +1,190 @@ +from typing import Any, Dict, List + +from BaseClasses import Item, Location, Tutorial, ItemClassification, MultiWorld +from worlds.AutoWorld import WebWorld, World +from . import Items, Locations, Regions, Rules +from .Options import FaxanaduOptions +from worlds.generic.Rules import set_rule + + +DAXANADU_VERSION = "0.3.0" + + +class FaxanaduLocation(Location): + game: str = "Faxanadu" + + +class FaxanaduItem(Item): + game: str = "Faxanadu" + + +class FaxanaduWeb(WebWorld): + tutorials = [Tutorial( + "Multiworld Setup Guide", + "A guide to setting up the Faxanadu randomizer connected to an Archipelago Multiworld", + "English", + "setup_en.md", + "setup/en", + ["Daivuk"] + )] + theme = "dirt" + + +class FaxanaduWorld(World): + """ + Faxanadu is an action role-playing platform video game developed by Hudson Soft for the Nintendo Entertainment System + """ + options_dataclass = FaxanaduOptions + options: FaxanaduOptions + game = "Faxanadu" + web = FaxanaduWeb() + + item_name_to_id = {item.name: item.id for item in Items.items if item.id is not None} + item_name_to_item = {item.name: item for item in Items.items} + location_name_to_id = {loc.name: loc.id for loc in Locations.locations if loc.id is not None} + + def __init__(self, world: MultiWorld, player: int): + self.filler_ratios: Dict[str, int] = {} + + super().__init__(world, player) + + def create_regions(self): + Regions.create_regions(self) + + # Add locations into regions + for region in self.multiworld.get_regions(self.player): + for loc in [location for location in Locations.locations if location.region == region.name]: + location = FaxanaduLocation(self.player, loc.name, loc.id, region) + + # In Faxanadu, Poison hurts you when picked up. It makes no sense to sell them in shops + if loc.type == Locations.LocationType.shop: + location.item_rule = lambda item, player=self.player: not (player == item.player and item.name == "Poison") + + region.locations.append(location) + + def set_rules(self): + Rules.set_rules(self) + self.multiworld.completion_condition[self.player] = lambda state: state.has("Killed Evil One", self.player) + + def create_item(self, name: str) -> FaxanaduItem: + item: Items.ItemDef = self.item_name_to_item[name] + return FaxanaduItem(name, item.classification, item.id, self.player) + + # Returns how many red potions were prefilled into shops + def prefill_shop_red_potions(self) -> int: + red_potion_in_shop_count = 0 + if self.options.keep_shop_red_potions: + red_potion_item = self.item_name_to_item["Red Potion"] + red_potion_shop_locations = [ + loc + for loc in Locations.locations + if loc.type == Locations.LocationType.shop and loc.original_item == Locations.ItemType.red_potion + ] + for loc in red_potion_shop_locations: + location = self.get_location(loc.name) + location.place_locked_item(FaxanaduItem(red_potion_item.name, red_potion_item.classification, red_potion_item.id, self.player)) + red_potion_in_shop_count += 1 + return red_potion_in_shop_count + + def put_wingboot_in_shop(self, shops, region_name): + item = self.item_name_to_item["Wingboots"] + shop = shops.pop(region_name) + slot = self.random.randint(0, len(shop) - 1) + loc = shop[slot] + location = self.get_location(loc.name) + location.place_locked_item(FaxanaduItem(item.name, item.classification, item.id, self.player)) + + # Put a rule right away that we need to have to unlocked. + set_rule(location, lambda state: state.has("Unlock Wingboots", self.player)) + + # Returns how many wingboots were prefilled into shops + def prefill_shop_wingboots(self) -> int: + # Collect shops + shops: Dict[str, List[Locations.LocationDef]] = {} + for loc in Locations.locations: + if loc.type == Locations.LocationType.shop: + if self.options.keep_shop_red_potions and loc.original_item == Locations.ItemType.red_potion: + continue # Don't override our red potions + shops.setdefault(loc.region, []).append(loc) + + shop_count = len(shops) + wingboots_count = round(shop_count / 2.5) # On 10 shops, we should have about 4 shops with wingboots + + # At least one should be in the first 4 shops. Because we require wingboots to progress past that point. + must_have_regions = [region for i, region in enumerate(shops) if i < 4] + self.put_wingboot_in_shop(shops, self.random.choice(must_have_regions)) + + # Fill in the rest randomly in remaining shops + for i in range(wingboots_count - 1): # -1 because we added one already + region = self.random.choice(list(shops.keys())) + self.put_wingboot_in_shop(shops, region) + + return wingboots_count + + def create_items(self) -> None: + itempool: List[FaxanaduItem] = [] + + # Prefill red potions in shops if option is set + red_potion_in_shop_count = self.prefill_shop_red_potions() + + # Prefill wingboots in shops + wingboots_in_shop_count = self.prefill_shop_wingboots() + + # Create the item pool, excluding fillers. + prefilled_count = red_potion_in_shop_count + wingboots_in_shop_count + for item in Items.items: + # Ignore pendant if turned off + if item.name == "Pendant" and not self.options.include_pendant: + continue + + # ignore fillers for now, we will fill them later + if item.classification in [ItemClassification.filler, ItemClassification.trap] and \ + item.progression_count == 0: + continue + + prefill_loc = None + if item.prefill_location: + prefill_loc = self.get_location(item.prefill_location) + + # if require dragon slayer is turned on, we need progressive shields to be progression + item_classification = item.classification + if self.options.require_dragon_slayer and item.name == "Progressive Shield": + item_classification = ItemClassification.progression + + if prefill_loc: + prefill_loc.place_locked_item(FaxanaduItem(item.name, item_classification, item.id, self.player)) + prefilled_count += 1 + else: + for i in range(item.count - item.progression_count): + itempool.append(FaxanaduItem(item.name, item_classification, item.id, self.player)) + for i in range(item.progression_count): + itempool.append(FaxanaduItem(item.name, ItemClassification.progression, item.id, self.player)) + + # Set up filler ratios + self.filler_ratios = { + item.name: item.count + for item in Items.items + if item.classification in [ItemClassification.filler, ItemClassification.trap] + } + + # If red potions are locked in shops, remove the count from the ratio. + self.filler_ratios["Red Potion"] -= red_potion_in_shop_count + + # Remove poisons if not desired + if not self.options.include_poisons: + self.filler_ratios["Poison"] = 0 + + # Randomly add fillers to the pool with ratios based on og game occurrence counts. + filler_count = len(Locations.locations) - len(itempool) - prefilled_count + for i in range(filler_count): + itempool.append(self.create_item(self.get_filler_item_name())) + + self.multiworld.itempool += itempool + + def get_filler_item_name(self) -> str: + return self.random.choices(list(self.filler_ratios.keys()), weights=list(self.filler_ratios.values()))[0] + + def fill_slot_data(self) -> Dict[str, Any]: + slot_data = self.options.as_dict("keep_shop_red_potions", "random_musics", "random_sounds", "random_npcs", "random_monsters", "random_rewards") + slot_data["daxanadu_version"] = DAXANADU_VERSION + return slot_data diff --git a/worlds/faxanadu/docs/en_Faxanadu.md b/worlds/faxanadu/docs/en_Faxanadu.md new file mode 100644 index 000000000000..7f5c4ab293ce --- /dev/null +++ b/worlds/faxanadu/docs/en_Faxanadu.md @@ -0,0 +1,27 @@ +# Faxanadu + +## Where is the settings page? + +The [player options page](../player-options) contains the options needed to configure your game session. + +## What does randomization do to this game? + +All game items collected in the map, shops, and boss drops are randomized. + +Keys are unique. Once you get the Jack Key, you can open all Jack doors; the key stays in your inventory. + +Wingboots are randomized across shops only. They are LOCKED and cannot be bought until you get the item that unlocks them. + +Normal Elixirs don't revive the tower spring. A new item, Spring Elixir, is necessary. This new item is unique. + +## What is the goal? + +The goal is to kill the Evil One. + +## What is a "check" in The Faxanadu? + +Shop items, item locations in the world, boss drops, and secret items. + +## What "items" can you unlock in Faxanadu? + +Keys, Armors, Weapons, Potions, Shields, Magics, Poisons, Gloves, etc. diff --git a/worlds/faxanadu/docs/setup_en.md b/worlds/faxanadu/docs/setup_en.md new file mode 100644 index 000000000000..4ff714c61393 --- /dev/null +++ b/worlds/faxanadu/docs/setup_en.md @@ -0,0 +1,32 @@ +# Faxanadu Randomizer Setup + +## Required Software + +- [Daxanadu](https://github.com/Daivuk/Daxanadu/releases/) +- Faxanadu ROM, English version + +## Optional Software + +- [ArchipelagoTextClient](https://github.com/ArchipelagoMW/Archipelago/releases) + +## Installing Daxanadu +1. Download [Daxanadu.zip](https://github.com/Daivuk/Daxanadu/releases/) and extract it. +2. Copy your rom `Faxanadu (U).nes` into the newly extracted folder. + +## Joining a MultiWorld Game + +1. Launch Daxanadu.exe +2. From the Main menu, go to the `ARCHIPELAGO` menu. Enter the server's address, slot name, and password. Then select `PLAY`. +3. Enjoy! + +To continue a game, follow the same connection steps. +Connecting with a different seed won't erase your progress in other seeds. + +## Archipelago Text Client + +We recommend having Archipelago's Text Client open on the side to keep track of what items you receive and send. +Daxanadu doesn't display messages. You'll only get popups when picking them up. + +## Auto-Tracking + +Daxanadu has an integrated tracker that can be toggled in the options. diff --git a/worlds/heretic/Options.py b/worlds/heretic/Options.py index 14f4198a55f0..7d98207b0f8e 100644 --- a/worlds/heretic/Options.py +++ b/worlds/heretic/Options.py @@ -16,14 +16,8 @@ class Goal(Choice): class Difficulty(Choice): """ - Choose the difficulty option. Those match DOOM's difficulty options. - baby (I'm too young to die.) double ammos, half damage, less monsters or strength. - easy (Hey, not too rough.) less monsters or strength. - medium (Hurt me plenty.) Default. - hard (Ultra-Violence.) More monsters or strength. - nightmare (Nightmare!) Monsters attack more rapidly and respawn. - - wet nurse (hou needeth a wet-nurse) - Fewer monsters and more items than medium. Damage taken is halved, and ammo pickups carry twice as much ammo. Any Quartz Flasks and Mystic Urns are automatically used when the player nears death. + Choose the game difficulty. These options match Heretic's skill levels. + wet nurse (Thou needeth a wet-nurse) - Fewer monsters and more items than medium. Damage taken is halved, and ammo pickups carry twice as much ammo. Any Quartz Flasks and Mystic Urns are automatically used when the player nears death. easy (Yellowbellies-r-us) - Fewer monsters and more items than medium. medium (Bringest them oneth) - Completely balanced, this is the standard difficulty level. hard (Thou art a smite-meister) - More monsters and fewer items than medium. @@ -35,6 +29,11 @@ class Difficulty(Choice): option_medium = 2 option_hard = 3 option_black_plague = 4 + alias_wn = 0 + alias_yru = 1 + alias_bto = 2 + alias_sm = 3 + alias_bp = 4 default = 2 diff --git a/worlds/heretic/docs/setup_en.md b/worlds/heretic/docs/setup_en.md index 41b7fdab8078..5985dbb0992a 100644 --- a/worlds/heretic/docs/setup_en.md +++ b/worlds/heretic/docs/setup_en.md @@ -15,7 +15,7 @@ You can find the folder in steam by finding the game in your library, right clicking it and choosing *Manage→Browse Local Files*. The WAD file is in the `/base/` folder. -## Joining a MultiWorld Game +## Joining a MultiWorld Game (via Launcher) 1. Launch apdoom-launcher.exe 2. Choose Heretic in the dropdown @@ -26,6 +26,23 @@ To continue a game, follow the same connection steps. Connecting with a different seed won't erase your progress in other seeds. +## Joining a MultiWorld Game (via command line) + +1. In your command line, navigate to the directory where APDOOM is installed. +2. Run `crispy-apheretic -apserver -applayer `, where: + - `` is the Archipelago server address, e.g. "`archipelago.gg:38281`" + - `` is your slot name; if it contains spaces, surround it with double quotes + - If the server has a password, add `-password`, followed by the server password +3. Enjoy! + +Optionally, you can override some randomization settings from the command line: +- `-apmonsterrando 0` will disable monster rando. +- `-apitemrando 0` will disable item rando. +- `-apmusicrando 0` will disable music rando. +- `-apresetlevelondeath 0` will disable resetting the level on death. +- `-apdeathlinkoff` will force DeathLink off if it's enabled. +- `-skill <1-5>` changes the game difficulty, from 1 (thou needeth a wet-nurse) to 5 (black plague possesses thee) + ## Archipelago Text Client We recommend having Archipelago's Text Client open on the side to keep track of what items you receive and send. diff --git a/worlds/hk/Items.py b/worlds/hk/Items.py index 8515465826a5..a2b7c06d62a6 100644 --- a/worlds/hk/Items.py +++ b/worlds/hk/Items.py @@ -61,6 +61,7 @@ class HKItemData(NamedTuple): "VesselFragments": lookup_type_to_names["Vessel"], "WhisperingRoots": lookup_type_to_names["Root"], "WhiteFragments": {"Queen_Fragment", "King_Fragment", "Void_Heart"}, + "DreamNails": {"Dream_Nail", "Dream_Gate", "Awoken_Dream_Nail"}, }) item_name_groups['Horizontal'] = item_name_groups['Cloak'] | item_name_groups['CDash'] item_name_groups['Vertical'] = item_name_groups['Claw'] | {'Monarch_Wings'} diff --git a/worlds/kh2/Rules.py b/worlds/kh2/Rules.py index 4370ad36b540..0f26b56d0e54 100644 --- a/worlds/kh2/Rules.py +++ b/worlds/kh2/Rules.py @@ -355,6 +355,16 @@ def __init__(self, world: KH2World) -> None: RegionName.Master: lambda state: self.multi_form_region_access(), RegionName.Final: lambda state: self.final_form_region_access(state) } + # Accessing Final requires being able to reach one of the locations in final_leveling_access, but reaching a + # location requires being able to reach the region the location is in, so an indirect condition is required. + # The access rules of each of the locations in final_leveling_access do not check for being able to reach other + # locations or other regions, so it is only the parent region of each location that needs to be added as an + # indirect condition. + self.form_region_indirect_condition_regions = { + RegionName.Final: { + self.world.get_location(location).parent_region for location in final_leveling_access + } + } def final_form_region_access(self, state: CollectionState) -> bool: """ @@ -388,12 +398,15 @@ def set_kh2_form_rules(self): for region_name in drive_form_list: if region_name == RegionName.Summon and not self.world.options.SummonLevelLocationToggle: continue + indirect_condition_regions = self.form_region_indirect_condition_regions.get(region_name, ()) # could get the location of each of these, but I feel like that would be less optimal region = self.multiworld.get_region(region_name, self.player) # if region_name in form_region_rules if region_name != RegionName.Summon: for entrance in region.entrances: entrance.access_rule = self.form_region_rules[region_name] + for indirect_condition_region in indirect_condition_regions: + self.multiworld.register_indirect_condition(indirect_condition_region, entrance) for loc in region.locations: loc.access_rule = self.form_rules[loc.name] diff --git a/worlds/ladx/Items.py b/worlds/ladx/Items.py index 1f9358a4f5a6..b9e1eeab3e69 100644 --- a/worlds/ladx/Items.py +++ b/worlds/ladx/Items.py @@ -69,7 +69,6 @@ class ItemName: BOMB = "Bomb" SWORD = "Progressive Sword" FLIPPERS = "Flippers" - MAGNIFYING_LENS = "Magnifying Lens" MEDICINE = "Medicine" TAIL_KEY = "Tail Key" ANGLER_KEY = "Angler Key" @@ -191,7 +190,6 @@ class ItemName: ItemData(ItemName.BOMB, "BOMB", ItemClassification.progression), ItemData(ItemName.SWORD, "SWORD", ItemClassification.progression), ItemData(ItemName.FLIPPERS, "FLIPPERS", ItemClassification.progression), - ItemData(ItemName.MAGNIFYING_LENS, "MAGNIFYING_LENS", ItemClassification.progression), ItemData(ItemName.MEDICINE, "MEDICINE", ItemClassification.useful), ItemData(ItemName.TAIL_KEY, "TAIL_KEY", ItemClassification.progression), ItemData(ItemName.ANGLER_KEY, "ANGLER_KEY", ItemClassification.progression), diff --git a/worlds/ladx/LADXR/generator.py b/worlds/ladx/LADXR/generator.py index 69e856f3541b..b402b3d88919 100644 --- a/worlds/ladx/LADXR/generator.py +++ b/worlds/ladx/LADXR/generator.py @@ -58,7 +58,7 @@ from .patches import bank34 from .utils import formatText -from ..Options import TrendyGame, Palette +from ..Options import TrendyGame, Palette, Warps from .roomEditor import RoomEditor, Object from .patches.aesthetics import rgb_to_bin, bin_to_rgb @@ -153,7 +153,9 @@ def generateRom(args, world: "LinksAwakeningWorld"): if world.ladxr_settings.witch: patches.witch.updateWitch(rom) patches.softlock.fixAll(rom) - patches.maptweaks.tweakMap(rom) + if not world.ladxr_settings.rooster: + patches.maptweaks.tweakMap(rom) + patches.maptweaks.tweakBirdKeyRoom(rom) patches.chest.fixChests(rom) patches.shop.fixShop(rom) patches.rooster.patchRooster(rom) @@ -176,11 +178,7 @@ def generateRom(args, world: "LinksAwakeningWorld"): patches.songs.upgradeMarin(rom) patches.songs.upgradeManbo(rom) patches.songs.upgradeMamu(rom) - if world.ladxr_settings.tradequest: - patches.tradeSequence.patchTradeSequence(rom, world.ladxr_settings.boomerang) - else: - # Monkey bridge patch, always have the bridge there. - rom.patch(0x00, 0x333D, assembler.ASM("bit 4, e\njr Z, $05"), b"", fill_nop=True) + patches.tradeSequence.patchTradeSequence(rom, world.ladxr_settings) patches.bowwow.fixBowwow(rom, everywhere=world.ladxr_settings.bowwow != 'normal') if world.ladxr_settings.bowwow != 'normal': patches.bowwow.bowwowMapPatches(rom) @@ -418,8 +416,8 @@ def speed(): for channel in range(3): color[channel] = color[channel] * 31 // 0xbc - if world.options.warp_improvements: - patches.core.addWarpImprovements(rom, world.options.additional_warp_points) + if world.options.warps != Warps.option_vanilla: + patches.core.addWarpImprovements(rom, world.options.warps == Warps.option_improved_additional) palette = world.options.palette if palette != Palette.option_normal: diff --git a/worlds/ladx/LADXR/locations/birdKey.py b/worlds/ladx/LADXR/locations/birdKey.py index 12418c61aa46..0dbdd8653fe2 100644 --- a/worlds/ladx/LADXR/locations/birdKey.py +++ b/worlds/ladx/LADXR/locations/birdKey.py @@ -1,23 +1,6 @@ from .droppedKey import DroppedKey -from ..roomEditor import RoomEditor -from ..assembler import ASM class BirdKey(DroppedKey): def __init__(self): super().__init__(0x27A) - - def patch(self, rom, option, *, multiworld=None): - super().patch(rom, option, multiworld=multiworld) - - re = RoomEditor(rom, self.room) - - # Make the bird key accessible without the rooster - re.removeObject(1, 6) - re.removeObject(2, 6) - re.removeObject(3, 5) - re.removeObject(3, 6) - re.moveObject(1, 5, 2, 6) - re.moveObject(2, 5, 3, 6) - re.addEntity(3, 5, 0x9D) - re.store(rom) diff --git a/worlds/ladx/LADXR/locations/boomerangGuy.py b/worlds/ladx/LADXR/locations/boomerangGuy.py index 92d76cebdf5d..23fcc867617b 100644 --- a/worlds/ladx/LADXR/locations/boomerangGuy.py +++ b/worlds/ladx/LADXR/locations/boomerangGuy.py @@ -24,11 +24,6 @@ def configure(self, options): # But SHIELD, BOMB and MAGIC_POWDER would most likely break things. # SWORD and POWER_BRACELET would most likely introduce the lv0 shield/bracelet issue def patch(self, rom, option, *, multiworld=None): - # Always have the boomerang trade guy enabled (normally you need the magnifier) - rom.patch(0x19, 0x05EC, ASM("ld a, [wTradeSequenceItem]\ncp $0E"), ASM("ld a, $0E\ncp $0E"), fill_nop=True) # show the guy - rom.patch(0x00, 0x3199, ASM("ld a, [wTradeSequenceItem]\ncp $0E"), ASM("ld a, $0E\ncp $0E"), fill_nop=True) # load the proper room layout - rom.patch(0x19, 0x05F4, ASM("ld a, [wTradeSequenceItem2]\nand a"), ASM("xor a"), fill_nop=True) - if self.setting == 'trade': inv = INVENTORY_MAP[option] # Patch the check if you traded back the boomerang (so traded twice) diff --git a/worlds/ladx/LADXR/locations/constants.py b/worlds/ladx/LADXR/locations/constants.py index 7bb8df5b3515..a0489febc316 100644 --- a/worlds/ladx/LADXR/locations/constants.py +++ b/worlds/ladx/LADXR/locations/constants.py @@ -25,7 +25,7 @@ PEGASUS_BOOTS: 0x05, OCARINA: 0x06, FEATHER: 0x07, SHOVEL: 0x08, MAGIC_POWDER: 0x09, BOMB: 0x0A, SWORD: 0x0B, FLIPPERS: 0x0C, - MAGNIFYING_LENS: 0x0D, MEDICINE: 0x10, + MEDICINE: 0x10, TAIL_KEY: 0x11, ANGLER_KEY: 0x12, FACE_KEY: 0x13, BIRD_KEY: 0x14, GOLD_LEAF: 0x15, RUPEES_50: 0x1B, RUPEES_20: 0x1C, RUPEES_100: 0x1D, RUPEES_200: 0x1E, RUPEES_500: 0x1F, SEASHELL: 0x20, MESSAGE: 0x21, GEL: 0x22, diff --git a/worlds/ladx/LADXR/locations/items.py b/worlds/ladx/LADXR/locations/items.py index 50186ef2a34c..1ecc331f8580 100644 --- a/worlds/ladx/LADXR/locations/items.py +++ b/worlds/ladx/LADXR/locations/items.py @@ -11,7 +11,6 @@ BOMB = "BOMB" SWORD = "SWORD" FLIPPERS = "FLIPPERS" -MAGNIFYING_LENS = "MAGNIFYING_LENS" MEDICINE = "MEDICINE" TAIL_KEY = "TAIL_KEY" ANGLER_KEY = "ANGLER_KEY" diff --git a/worlds/ladx/LADXR/logic/overworld.py b/worlds/ladx/LADXR/logic/overworld.py index 551cf8353f4a..3972796051f9 100644 --- a/worlds/ladx/LADXR/logic/overworld.py +++ b/worlds/ladx/LADXR/logic/overworld.py @@ -61,9 +61,9 @@ def __init__(self, options, world_setup, r): self._addEntrance("banana_seller", sword_beach, banana_seller, r.bush) boomerang_cave = Location("Boomerang Cave") if options.boomerang == 'trade': - Location().add(BoomerangGuy()).connect(boomerang_cave, OR(BOOMERANG, HOOKSHOT, MAGIC_ROD, PEGASUS_BOOTS, FEATHER, SHOVEL)) + Location().add(BoomerangGuy()).connect(boomerang_cave, AND(r.shuffled_magnifier, OR(BOOMERANG, HOOKSHOT, MAGIC_ROD, PEGASUS_BOOTS, FEATHER, SHOVEL))) elif options.boomerang == 'gift': - Location().add(BoomerangGuy()).connect(boomerang_cave, None) + Location().add(BoomerangGuy()).connect(boomerang_cave, r.shuffled_magnifier) self._addEntrance("boomerang_cave", sword_beach, boomerang_cave, BOMB) self._addEntranceRequirementExit("boomerang_cave", None) # if exiting, you do not need bombs @@ -167,7 +167,9 @@ def __init__(self, options, world_setup, r): prairie_island_seashell = Location().add(Seashell(0x0A6)).connect(ukuku_prairie, AND(FLIPPERS, r.bush)) # next to lv3 Location().add(Seashell(0x08B)).connect(ukuku_prairie, r.bush) # next to seashell house Location().add(Seashell(0x0A4)).connect(ukuku_prairie, PEGASUS_BOOTS) # smash into tree next to phonehouse - self._addEntrance("castle_jump_cave", ukuku_prairie, Location().add(Chest(0x1FD)), OR(AND(FEATHER, PEGASUS_BOOTS), ROOSTER)) # left of the castle, 5 holes turned into 3 + self._addEntrance("castle_jump_cave", ukuku_prairie, Location().add(Chest(0x1FD)), ROOSTER) + if not options.rooster: + self._addEntranceRequirement("castle_jump_cave", AND(FEATHER, PEGASUS_BOOTS)) # left of the castle, 5 holes turned into 3 Location().add(Seashell(0x0B9)).connect(ukuku_prairie, POWER_BRACELET) # under the rock left_bay_area = Location() @@ -353,7 +355,7 @@ def __init__(self, options, world_setup, r): self._addEntrance("d4", d4_entrance, None, ANGLER_KEY) self._addEntranceRequirementExit("d4", FLIPPERS) # if exiting, you can leave with flippers without opening the dungeon mambo = Location().connect(Location().add(Song(0x2FD)), AND(OCARINA, FLIPPERS)) # Manbo's Mambo - self._addEntrance("mambo", d4_entrance, mambo, FLIPPERS) + self._addEntrance("mambo", d4_entrance, mambo, FLIPPERS) # Raft game. raft_house = Location("Raft House") @@ -379,7 +381,9 @@ def __init__(self, options, world_setup, r): self._addEntrance("rooster_house", outside_rooster_house, None, None) bird_cave = Location() bird_key = Location().add(BirdKey()) - bird_cave.connect(bird_key, OR(AND(FEATHER, COUNT(POWER_BRACELET, 2)), ROOSTER)) + bird_cave.connect(bird_key, ROOSTER) + if not options.rooster: + bird_cave.connect(bird_key, AND(FEATHER, COUNT(POWER_BRACELET, 2))) # elephant statue added if options.logic != "casual": bird_cave.connect(lower_right_taltal, None, one_way=True) # Drop in a hole at bird cave self._addEntrance("bird_cave", outside_rooster_house, bird_cave, None) @@ -468,7 +472,7 @@ def __init__(self, options, world_setup, r): swamp.connect(writes_hut_outside, HOOKSHOT, one_way=True) # hookshot the sign in front of writes hut graveyard_heartpiece.connect(graveyard_cave_right, FEATHER) # jump to the bottom right tile around the blocks graveyard_heartpiece.connect(graveyard_cave_right, OR(HOOKSHOT, BOOMERANG)) # push bottom block, wall clip and hookshot/boomerang corner to grab item - + self._addEntranceRequirement("mamu", AND(FEATHER, POWER_BRACELET)) # can clear the gaps at the start with just feather, can reach bottom left sign with a well timed jump while wall clipped self._addEntranceRequirement("prairie_madbatter_connector_entrance", AND(OR(FEATHER, ROOSTER), OR(MAGIC_POWDER, BOMB))) # use bombs or powder to get rid of a bush on the other side by jumping across and placing the bomb/powder before you fall into the pit fisher_under_bridge.connect(bay_water, AND(TRADING_ITEM_FISHING_HOOK, FLIPPERS)) # can talk to the fisherman from the water when the boat is low (requires swimming up out of the water a bit) @@ -476,9 +480,10 @@ def __init__(self, options, world_setup, r): castle_inside.connect(kanalet_chain_trooper, BOOMERANG, one_way=True) # kill the ball and chain trooper from the left side, then use boomerang to grab the dropped item animal_village_bombcave_heartpiece.connect(animal_village_bombcave, AND(PEGASUS_BOOTS, FEATHER)) # jump across horizontal 4 gap to heart piece desert_lanmola.connect(desert, BOMB) # use bombs to kill lanmola - + d6_connector_left.connect(d6_connector_right, AND(OR(FLIPPERS, PEGASUS_BOOTS), FEATHER)) # jump the gap in underground passage to d6 left side to skip hookshot - bird_key.connect(bird_cave, COUNT(POWER_BRACELET, 2)) # corner walk past the one pit on the left side to get to the elephant statue + if not options.rooster: + bird_key.connect(bird_cave, COUNT(POWER_BRACELET, 2)) # corner walk past the one pit on the left side to get to the elephant statue fire_cave_bottom.connect(fire_cave_top, PEGASUS_BOOTS, one_way=True) # flame skip if options.logic == 'glitched' or options.logic == 'hell': @@ -502,9 +507,9 @@ def __init__(self, options, world_setup, r): tiny_island.connect(left_bay_area, AND(FEATHER, r.bush)) # jesus jump around bay_madbatter_connector_exit.connect(bay_madbatter_connector_entrance, FEATHER, one_way=True) # jesus jump (3 screen) through the underground passage leading to martha's bay mad batter self._addEntranceRequirement("prairie_madbatter_connector_entrance", AND(FEATHER, POWER_BRACELET)) # villa buffer into the top side of the bush, then pick it up - + ukuku_prairie.connect(richard_maze, OR(BOMB, BOOMERANG, MAGIC_POWDER, MAGIC_ROD, SWORD), one_way=True) # break bushes on north side of the maze, and 1 pit buffer into the maze - fisher_under_bridge.connect(bay_water, AND(BOMB, FLIPPERS)) # can bomb trigger the item without having the hook + fisher_under_bridge.connect(bay_water, AND(BOMB, FLIPPERS)) # can bomb trigger the item without having the hook animal_village.connect(ukuku_prairie, FEATHER) # jesus jump below_right_taltal.connect(next_to_castle, FEATHER) # jesus jump (north of kanalet castle phonebooth) animal_village_connector_right.connect(animal_village_connector_left, FEATHER) # text clip past the obstacles (can go both ways), feather to wall clip the obstacle without triggering text or shaq jump in bottom right corner if text is off @@ -519,12 +524,12 @@ def __init__(self, options, world_setup, r): obstacle_cave_inside_chest.connect(obstacle_cave_inside, FEATHER) # jump to the rightmost pits + 1 pit buffer to jump across obstacle_cave_exit.connect(obstacle_cave_inside, FEATHER) # 1 pit buffer above boots crystals to get past lower_right_taltal.connect(hibiscus_item, AND(TRADING_ITEM_PINEAPPLE, BOMB), one_way=True) # bomb trigger papahl from below ledge, requires pineapple - + self._addEntranceRequirement("heartpiece_swim_cave", FEATHER) # jesus jump into the cave entrance after jumping down the ledge, can jesus jump back to the ladder 1 screen below self._addEntranceRequirement("mambo", FEATHER) # jesus jump from (unlocked) d4 entrance to mambo's cave entrance outside_raft_house.connect(below_right_taltal, FEATHER, one_way=True) # jesus jump from the ledge at raft to the staircase 1 screen south - self._addEntranceRequirement("multichest_left", FEATHER) # jesus jump past staircase leading up the mountain + self._addEntranceRequirement("multichest_left", FEATHER) # jesus jump past staircase leading up the mountain outside_rooster_house.connect(lower_right_taltal, FEATHER) # jesus jump (1 or 2 screen depending if angler key is used) to staircase leading up the mountain d7_platau.connect(water_cave_hole, None, one_way=True) # use save and quit menu to gain control while falling to dodge the water cave hole mountain_bridge_staircase.connect(outside_rooster_house, AND(PEGASUS_BOOTS, FEATHER)) # cross bridge to staircase with pit buffer to clip bottom wall and jump across @@ -547,7 +552,7 @@ def __init__(self, options, world_setup, r): graveyard.connect(forest, OR(PEGASUS_BOOTS, HOOKSHOT)) # boots bonk witches hut, or hookshot spam across the pit graveyard_cave_left.connect(graveyard_cave_right, HOOKSHOT) # hookshot spam over the pit graveyard_cave_right.connect(graveyard_cave_left, PEGASUS_BOOTS, one_way=True) # boots bonk off the cracked block - + self._addEntranceRequirementEnter("mamu", AND(PEGASUS_BOOTS, POWER_BRACELET)) # can clear the gaps at the start with multiple pit buffers, can reach bottom left sign with bonking along the bottom wall self._addEntranceRequirement("castle_jump_cave", PEGASUS_BOOTS) # pit buffer to clip bottom wall and boots bonk across prairie_cave_secret_exit.connect(prairie_cave, AND(BOMB, OR(PEGASUS_BOOTS, HOOKSHOT))) # hookshot spam or boots bonk across pits can go from left to right by pit buffering on top of the bottom wall then boots bonk across @@ -563,15 +568,15 @@ def __init__(self, options, world_setup, r): animal_village.connect(bay_water, FEATHER) # jesus jump (can always reach bay_water with jesus jumping from every way to enter bay_water, so no one_way) ukuku_prairie.connect(bay_water, FEATHER, one_way=True) # jesus jump bay_water.connect(d5_entrance, FEATHER) # jesus jump into d5 entrance (wall clip), wall clip + jesus jump to get out - + crow_gold_leaf.connect(castle_courtyard, BOMB) # bird on tree at left side kanalet, place a bomb against the tree and the crow flies off. With well placed second bomb the crow can be killed mermaid_statue.connect(animal_village, AND(TRADING_ITEM_SCALE, FEATHER)) # early mermaid statue by buffering on top of the right ledge, then superjumping to the left (horizontal pixel perfect) animal_village_bombcave_heartpiece.connect(animal_village_bombcave, PEGASUS_BOOTS) # boots bonk across bottom wall (both at entrance and in item room) d6_armos_island.connect(ukuku_prairie, FEATHER) # jesus jump (3 screen) from seashell mansion to armos island - armos_fairy_entrance.connect(d6_armos_island, PEGASUS_BOOTS, one_way=True) # jesus jump from top (fairy bomb cave) to armos island with fast falling + armos_fairy_entrance.connect(d6_armos_island, PEGASUS_BOOTS, one_way=True) # jesus jump from top (fairy bomb cave) to armos island with fast falling d6_connector_right.connect(d6_connector_left, PEGASUS_BOOTS) # boots bonk across bottom wall at water and pits (can do both ways) - + obstacle_cave_entrance.connect(obstacle_cave_inside, OR(HOOKSHOT, AND(FEATHER, PEGASUS_BOOTS, OR(SWORD, MAGIC_ROD, BOW)))) # get past crystal rocks by hookshotting into top pushable block, or boots dashing into top wall where the pushable block is to superjump down obstacle_cave_entrance.connect(obstacle_cave_inside, AND(PEGASUS_BOOTS, ROOSTER)) # get past crystal rocks pushing the top pushable block, then boots dashing up picking up the rooster before bonking. Pause buffer until rooster is fully picked up then throw it down before bonking into wall d4_entrance.connect(below_right_taltal, FEATHER) # jesus jump a long way @@ -583,7 +588,7 @@ def __init__(self, options, world_setup, r): mountain_bridge_staircase.connect(outside_rooster_house, OR(PEGASUS_BOOTS, FEATHER)) # cross bridge to staircase with pit buffer to clip bottom wall and jump or boots bonk across left_right_connector_cave_entrance.connect(left_right_connector_cave_exit, AND(PEGASUS_BOOTS, FEATHER), one_way=True) # boots jump to bottom left corner of pits, pit buffer and jump to left left_right_connector_cave_exit.connect(left_right_connector_cave_entrance, AND(ROOSTER, OR(PEGASUS_BOOTS, SWORD, BOW, MAGIC_ROD)), one_way=True) # pass through the passage in reverse using a boots rooster hop or rooster superjump in the one way passage area - + self.start = start_house self.egg = windfish_egg self.nightmare = nightmare @@ -659,7 +664,7 @@ def __init__(self, outside, requirement, one_way_enter_requirement="UNSET", one_ self.requirement = requirement self.one_way_enter_requirement = one_way_enter_requirement self.one_way_exit_requirement = one_way_exit_requirement - + def addRequirement(self, new_requirement): self.requirement = OR(self.requirement, new_requirement) @@ -674,9 +679,9 @@ def addEnterRequirement(self, new_requirement): self.one_way_enter_requirement = new_requirement else: self.one_way_enter_requirement = OR(self.one_way_enter_requirement, new_requirement) - + def enterIsSet(self): return self.one_way_enter_requirement != "UNSET" - + def exitIsSet(self): return self.one_way_exit_requirement != "UNSET" diff --git a/worlds/ladx/LADXR/logic/requirements.py b/worlds/ladx/LADXR/logic/requirements.py index acc969ba938d..a8e57327e78b 100644 --- a/worlds/ladx/LADXR/logic/requirements.py +++ b/worlds/ladx/LADXR/logic/requirements.py @@ -265,6 +265,7 @@ def __init__(self, options): self.rear_attack_range = OR(MAGIC_ROD, BOW) # mimic self.fire = OR(MAGIC_POWDER, MAGIC_ROD) # torches self.push_hardhat = OR(SHIELD, SWORD, HOOKSHOT, BOOMERANG) + self.shuffled_magnifier = TRADING_ITEM_MAGNIFYING_GLASS self.boss_requirements = [ SWORD, # D1 boss @@ -293,6 +294,8 @@ def __init__(self, options): } # Adjust for options + if not options.tradequest: + self.shuffled_magnifier = True if options.bowwow != 'normal': # We cheat in bowwow mode, we pretend we have the sword, as bowwow can pretty much do all what the sword ca$ # Except for taking out bushes (and crystal pillars are removed) self.bush.remove(SWORD) diff --git a/worlds/ladx/LADXR/patches/maptweaks.py b/worlds/ladx/LADXR/patches/maptweaks.py index c25dd83dcada..8a5171b3540d 100644 --- a/worlds/ladx/LADXR/patches/maptweaks.py +++ b/worlds/ladx/LADXR/patches/maptweaks.py @@ -25,3 +25,16 @@ def addBetaRoom(rom): re.store(rom) rom.room_sprite_data_indoor[0x0FC] = rom.room_sprite_data_indoor[0x1A1] + + +def tweakBirdKeyRoom(rom): + # Make the bird key accessible without the rooster + re = RoomEditor(rom, 0x27A) + re.removeObject(1, 6) + re.removeObject(2, 6) + re.removeObject(3, 5) + re.removeObject(3, 6) + re.moveObject(1, 5, 2, 6) + re.moveObject(2, 5, 3, 6) + re.addEntity(3, 5, 0x9D) + re.store(rom) diff --git a/worlds/ladx/LADXR/patches/songs.py b/worlds/ladx/LADXR/patches/songs.py index 59ca01c4c8c4..b080cf06bc92 100644 --- a/worlds/ladx/LADXR/patches/songs.py +++ b/worlds/ladx/LADXR/patches/songs.py @@ -72,6 +72,10 @@ def upgradeMarin(rom): rst 8 """), fill_nop=True) + # Load marin singing even if you have the marin date + rom.patch(0x03, 0x0A91, ASM("jp nz, $3F8D"), "", fill_nop=True) + rom.patch(0x05, 0x0E6E, ASM("jp nz, $7B4B"), "", fill_nop=True) + def upgradeManbo(rom): # Instead of checking if we have the song, check if we have a specific room flag set diff --git a/worlds/ladx/LADXR/patches/tradeSequence.py b/worlds/ladx/LADXR/patches/tradeSequence.py index 5b608977f20d..0eb46ae23ae2 100644 --- a/worlds/ladx/LADXR/patches/tradeSequence.py +++ b/worlds/ladx/LADXR/patches/tradeSequence.py @@ -1,7 +1,7 @@ from ..assembler import ASM -def patchTradeSequence(rom, boomerang_option): +def patchTradeSequence(rom, settings): patchTrendy(rom) patchPapahlsWife(rom) patchYipYip(rom) @@ -16,7 +16,7 @@ def patchTradeSequence(rom, boomerang_option): patchMermaid(rom) patchMermaidStatue(rom) patchSharedCode(rom) - patchVarious(rom, boomerang_option) + patchVarious(rom, settings) patchInventoryMenu(rom) @@ -265,8 +265,11 @@ def patchMermaidStatue(rom): and $10 ; scale ret z ldh a, [$F8] - and $20 + and $20 ; ROOM_STATUS_EVENT_2 ret nz + + ld hl, wTradeSequenceItem2 + res 4, [hl] ; take the trade item """), fill_nop=True) @@ -317,7 +320,7 @@ def patchSharedCode(rom): rom.patch(0x07, 0x3F7F, "00" * 7, ASM("ldh a, [$F8]\nor $20\nldh [$F8], a\nret")) -def patchVarious(rom, boomerang_option): +def patchVarious(rom, settings): # Make the zora photo work with the magnifier rom.patch(0x18, 0x09F3, 0x0A02, ASM(""" ld a, [wTradeSequenceItem2] @@ -330,22 +333,71 @@ def patchVarious(rom, boomerang_option): jp z, $3F8D ; UnloadEntity """), fill_nop=True) # Mimic invisibility - rom.patch(0x18, 0x2AC8, 0x2ACE, "", fill_nop=True) + rom.patch(0x19, 0x2AC0, ASM(""" + cp $97 + jr z, mermaidStatueCave + cp $98 + jr nz, visible + mermaidStatueCave: + ld a, [$DB7F] + and a + jr nz, 6 + visible: + """), ASM(""" + dec a ; save one byte by only doing one cp + or $01 + cp $97 + jr nz, visible + mermaidStatueCave: + ld a, [wTradeSequenceItem2] + and $20 ; MAGNIFYING_GLASS + jr z, 6 + visible: + """)) + # Zol invisibility + rom.patch(0x06, 0x3BE9, ASM(""" + cp $97 + jr z, mermaidStatueCave + cp $98 + ret nz ; visible + mermaidStatueCave: + ld a, [$DB7F] + and a + ret z + """), ASM(""" + dec a ; save one byte by only doing one cp + or $01 + cp $97 + ret nz ; visible + mermaidStatueCave: + ld a, [wTradeSequenceItem2] + and $20 ; MAGNIFYING_GLASS + ret nz + """)) # Ignore trade quest state for marin at beach rom.patch(0x18, 0x219E, 0x21A6, "", fill_nop=True) # Shift the magnifier 8 pixels rom.patch(0x03, 0x0F68, 0x0F6F, ASM(""" ldh a, [$F6] ; map room - cp $97 ; check if we are in the maginfier room + cp $97 ; check if we are in the magnifier room jp z, $4F83 """), fill_nop=True) # Something with the photographer rom.patch(0x36, 0x0948, 0x0950, "", fill_nop=True) - if boomerang_option not in {'trade', 'gift'}: # Boomerang cave is not patched, so adjust it + # Boomerang trade guy + # if settings.boomerang not in {'trade', 'gift'} or settings.overworld in {'normal', 'nodungeons'}: + if settings.tradequest: + # Update magnifier checks rom.patch(0x19, 0x05EC, ASM("ld a, [wTradeSequenceItem]\ncp $0E\njp nz, $7E61"), ASM("ld a, [wTradeSequenceItem2]\nand $20\njp z, $7E61")) # show the guy rom.patch(0x00, 0x3199, ASM("ld a, [wTradeSequenceItem]\ncp $0E\njr nz, $06"), ASM("ld a, [wTradeSequenceItem2]\nand $20\njr z, $06")) # load the proper room layout - rom.patch(0x19, 0x05F4, 0x05FB, "", fill_nop=True) + else: + # Monkey bridge patch, always have the bridge there. + rom.patch(0x00, 0x333D, ASM("bit 4, e\njr Z, $05"), b"", fill_nop=True) + # Always have the boomerang trade guy enabled (magnifier not needed) + rom.patch(0x19, 0x05EC, ASM("ld a, [wTradeSequenceItem]\ncp $0E"), ASM("ld a, $0E\ncp $0E"), fill_nop=True) # show the guy + rom.patch(0x00, 0x3199, ASM("ld a, [wTradeSequenceItem]\ncp $0E"), ASM("ld a, $0E\ncp $0E"), fill_nop=True) # load the proper room layout + rom.patch(0x19, 0x05F4, ASM("ld a, [wTradeSequenceItem2]\nand a"), ASM("xor a"), fill_nop=True) def patchInventoryMenu(rom): diff --git a/worlds/ladx/Options.py b/worlds/ladx/Options.py index c5dcc080537c..863e80fd036b 100644 --- a/worlds/ladx/Options.py +++ b/worlds/ladx/Options.py @@ -3,7 +3,7 @@ import os.path import typing import logging -from Options import Choice, Toggle, DefaultOnToggle, Range, FreeText, PerGameCommonOptions, OptionGroup +from Options import Choice, Toggle, DefaultOnToggle, Range, FreeText, PerGameCommonOptions, OptionGroup, Removed from collections import defaultdict import Utils @@ -58,7 +58,7 @@ class TextShuffle(DefaultOffToggle): class Rooster(DefaultOnToggle, LADXROption): """ [On] Adds the rooster to the item pool. - [Off] The rooster spot is still a check giving an item. But you will never find the rooster. Any rooster spot is accessible without rooster by other means. + [Off] The rooster spot is still a check giving an item. But you will never find the rooster. In that case, any rooster spot is accessible without rooster by other means. """ display_name = "Rooster" ladxr_name = "rooster" @@ -486,21 +486,18 @@ def to_ladxr_option(self, all_options): return self.ladxr_name, s -class WarpImprovements(DefaultOffToggle): +class Warps(Choice): """ - [On] Adds remake style warp screen to the game. Choose your warp destination on the map after jumping in a portal and press B to select. - [Off] No change + [Improved] Adds remake style warp screen to the game. Choose your warp destination on the map after jumping in a portal and press B to select. + [Improved Additional] Improved warps, and adds a warp point at Crazy Tracy's house (the Mambo teleport spot) and Eagle's Tower. """ - display_name = "Warp Improvements" + display_name = "Warps" + option_vanilla = 0 + option_improved = 1 + option_improved_additional = 2 + default = option_vanilla -class AdditionalWarpPoints(DefaultOffToggle): - """ - [On] (requires warp improvements) Adds a warp point at Crazy Tracy's house (the Mambo teleport spot) and Eagle's Tower - [Off] No change - """ - display_name = "Additional Warp Points" - ladx_option_groups = [ OptionGroup("Goal Options", [ Goal, @@ -515,8 +512,7 @@ class AdditionalWarpPoints(DefaultOffToggle): ShuffleStoneBeaks ]), OptionGroup("Warp Points", [ - WarpImprovements, - AdditionalWarpPoints, + Warps, ]), OptionGroup("Miscellaneous", [ TradeQuest, @@ -562,8 +558,7 @@ class LinksAwakeningOptions(PerGameCommonOptions): # 'bowwow': Bowwow, # 'overworld': Overworld, link_palette: LinkPalette - warp_improvements: WarpImprovements - additional_warp_points: AdditionalWarpPoints + warps: Warps trendy_game: TrendyGame gfxmod: GfxMod palette: Palette @@ -579,3 +574,6 @@ class LinksAwakeningOptions(PerGameCommonOptions): nag_messages: NagMessages ap_title_screen: APTitleScreen boots_controls: BootsControls + + warp_improvements: Removed + additional_warp_points: Removed diff --git a/worlds/lingo/player_logic.py b/worlds/lingo/player_logic.py index b21735c1f533..83217d7311a3 100644 --- a/worlds/lingo/player_logic.py +++ b/worlds/lingo/player_logic.py @@ -412,7 +412,7 @@ def randomize_paintings(self, world: "LingoWorld") -> bool: required_painting_rooms += REQUIRED_PAINTING_WHEN_NO_DOORS_ROOMS req_exits = [painting_id for painting_id, painting in PAINTINGS.items() if painting.required_when_no_doors] - def is_req_enterable(painting_id: str, painting: Painting) -> bool: + def is_req_enterable(painting: Painting) -> bool: if painting.exit_only or painting.disable or painting.req_blocked\ or painting.room in required_painting_rooms: return False @@ -433,7 +433,7 @@ def is_req_enterable(painting_id: str, painting: Painting) -> bool: return True req_enterable = [painting_id for painting_id, painting in PAINTINGS.items() - if is_req_enterable(painting_id, painting)] + if is_req_enterable(painting)] req_exits += [painting_id for painting_id, painting in PAINTINGS.items() if painting.exit_only and painting.required] req_entrances = world.random.sample(req_enterable, len(req_exits)) diff --git a/worlds/lingo/utils/pickle_static_data.py b/worlds/lingo/utils/pickle_static_data.py index 92bcb7a859ea..cd5c4b41df4b 100644 --- a/worlds/lingo/utils/pickle_static_data.py +++ b/worlds/lingo/utils/pickle_static_data.py @@ -11,7 +11,6 @@ import hashlib import pickle -import sys import Utils diff --git a/worlds/pokemon_emerald/CHANGELOG.md b/worlds/pokemon_emerald/CHANGELOG.md index 72005d6f9d3f..0dd874b25029 100644 --- a/worlds/pokemon_emerald/CHANGELOG.md +++ b/worlds/pokemon_emerald/CHANGELOG.md @@ -2,7 +2,6 @@ ### Features -- Added many new item and location groups. - Added a Swedish translation of the setup guide. - The client communicates map transitions to any trackers connected to the slot. - Added the player's Normalize Encounter Rates option to slot data for trackers. diff --git a/worlds/pokemon_emerald/__init__.py b/worlds/pokemon_emerald/__init__.py index c99a0c11cdfb..040b89b1af51 100644 --- a/worlds/pokemon_emerald/__init__.py +++ b/worlds/pokemon_emerald/__init__.py @@ -629,21 +629,34 @@ def write_spoiler(self, spoiler_handle: TextIO): spoiler_handle.write(f"\n\nWild Pokemon ({self.player_name}):\n\n") + slot_to_rod_suffix = { + 0: " (Old Rod)", + 1: " (Old Rod)", + 2: " (Good Rod)", + 3: " (Good Rod)", + 4: " (Good Rod)", + 5: " (Super Rod)", + 6: " (Super Rod)", + 7: " (Super Rod)", + 8: " (Super Rod)", + 9: " (Super Rod)", + } + species_maps = defaultdict(set) for map in self.modified_maps.values(): if map.land_encounters is not None: for encounter in map.land_encounters.slots: - species_maps[encounter].add(map.name[4:]) + species_maps[encounter].add(map.label + " (Land)") if map.water_encounters is not None: for encounter in map.water_encounters.slots: - species_maps[encounter].add(map.name[4:]) + species_maps[encounter].add(map.label + " (Water)") if map.fishing_encounters is not None: - for encounter in map.fishing_encounters.slots: - species_maps[encounter].add(map.name[4:]) + for slot, encounter in enumerate(map.fishing_encounters.slots): + species_maps[encounter].add(map.label + slot_to_rod_suffix[slot]) - lines = [f"{emerald_data.species[species].label}: {', '.join(maps)}\n" + lines = [f"{emerald_data.species[species].label}: {', '.join(sorted(maps))}\n" for species, maps in species_maps.items()] lines.sort() for line in lines: @@ -655,35 +668,35 @@ def extend_hint_information(self, hint_data): if self.options.dexsanity: from collections import defaultdict - slot_to_rod = { - 0: "_OLD_ROD", - 1: "_OLD_ROD", - 2: "_GOOD_ROD", - 3: "_GOOD_ROD", - 4: "_GOOD_ROD", - 5: "_SUPER_ROD", - 6: "_SUPER_ROD", - 7: "_SUPER_ROD", - 8: "_SUPER_ROD", - 9: "_SUPER_ROD", + slot_to_rod_suffix = { + 0: " (Old Rod)", + 1: " (Old Rod)", + 2: " (Good Rod)", + 3: " (Good Rod)", + 4: " (Good Rod)", + 5: " (Super Rod)", + 6: " (Super Rod)", + 7: " (Super Rod)", + 8: " (Super Rod)", + 9: " (Super Rod)", } species_maps = defaultdict(set) for map in self.modified_maps.values(): if map.land_encounters is not None: for encounter in map.land_encounters.slots: - species_maps[encounter].add(map.name[4:] + "_GRASS") + species_maps[encounter].add(map.label + " (Land)") if map.water_encounters is not None: for encounter in map.water_encounters.slots: - species_maps[encounter].add(map.name[4:] + "_WATER") + species_maps[encounter].add(map.label + " (Water)") if map.fishing_encounters is not None: for slot, encounter in enumerate(map.fishing_encounters.slots): - species_maps[encounter].add(map.name[4:] + slot_to_rod[slot]) + species_maps[encounter].add(map.label + slot_to_rod_suffix[slot]) hint_data[self.player] = { - self.location_name_to_id[f"Pokedex - {emerald_data.species[species].label}"]: ", ".join(maps) + self.location_name_to_id[f"Pokedex - {emerald_data.species[species].label}"]: ", ".join(sorted(maps)) for species, maps in species_maps.items() } diff --git a/worlds/pokemon_emerald/data.py b/worlds/pokemon_emerald/data.py index c7af5ef2284a..d93ff926229b 100644 --- a/worlds/pokemon_emerald/data.py +++ b/worlds/pokemon_emerald/data.py @@ -151,6 +151,7 @@ class EncounterTableData(NamedTuple): @dataclass class MapData: name: str + label: str header_address: int land_encounters: Optional[EncounterTableData] water_encounters: Optional[EncounterTableData] @@ -357,6 +358,8 @@ def load_json_data(data_name: str) -> Union[List[Any], Dict[str, Any]]: def _init() -> None: + import re + extracted_data: Dict[str, Any] = load_json_data("extracted_data.json") data.constants = extracted_data["constants"] data.ram_addresses = extracted_data["misc_ram_addresses"] @@ -366,6 +369,7 @@ def _init() -> None: # Create map data for map_name, map_json in extracted_data["maps"].items(): + assert isinstance(map_name, str) if map_name in IGNORABLE_MAPS: continue @@ -389,8 +393,35 @@ def _init() -> None: map_json["fishing_encounters"]["address"] ) + # Derive a user-facing label + label = [] + for word in map_name[4:].split("_"): + # 1F, B1F, 2R, etc. + re_match = re.match("^B?\d+[FRP]$", word) + if re_match: + label.append(word) + continue + + # Route 103, Hall 1, House 5, etc. + re_match = re.match("^([A-Z]+)(\d+)$", word) + if re_match: + label.append(re_match.group(1).capitalize()) + label.append(re_match.group(2).lstrip("0")) + continue + + if word == "OF": + label.append("of") + continue + + if word == "SS": + label.append("S.S.") + continue + + label.append(word.capitalize()) + data.maps[map_name] = MapData( map_name, + " ".join(label), map_json["header_address"], land_encounters, water_encounters, diff --git a/worlds/pokemon_rb/encounters.py b/worlds/pokemon_rb/encounters.py index fbe4abfe4466..aa20114787c3 100644 --- a/worlds/pokemon_rb/encounters.py +++ b/worlds/pokemon_rb/encounters.py @@ -170,6 +170,8 @@ def process_pokemon_locations(self): encounter_slots = encounter_slots_master.copy() zone_mapping = {} + zone_placed_mons = {} + if self.options.randomize_wild_pokemon: mons_list = [pokemon for pokemon in poke_data.pokemon_data.keys() if pokemon not in poke_data.legendary_pokemon or self.options.randomize_legendary_pokemon.value == 3] @@ -180,11 +182,13 @@ def process_pokemon_locations(self): zone = " - ".join(location.name.split(" - ")[:-1]) if zone not in zone_mapping: zone_mapping[zone] = {} + if zone not in zone_placed_mons: + zone_placed_mons[zone] = [] original_mon = slot.original_item if self.options.area_1_to_1_mapping and original_mon in zone_mapping[zone]: mon = zone_mapping[zone][original_mon] else: - mon = randomize_pokemon(self, original_mon, mons_list, + mon = randomize_pokemon(self, original_mon, [m for m in mons_list if m not in zone_placed_mons[zone]], self.options.randomize_wild_pokemon.value, self.random) # while ("Pokemon Tower 6F" in slot.name and @@ -201,6 +205,7 @@ def process_pokemon_locations(self): location.item.location = location locations.append(location) zone_mapping[zone][original_mon] = mon + zone_placed_mons[zone].append(mon) mons_to_add = [] remaining_pokemon = [pokemon for pokemon in poke_data.pokemon_data.keys() if placed_mons[pokemon] == 0 and @@ -270,4 +275,4 @@ def process_pokemon_locations(self): location.item = self.create_item(slot.original_item) location.locked = True location.item.location = location - placed_mons[location.item.name] += 1 \ No newline at end of file + placed_mons[location.item.name] += 1 diff --git a/worlds/sm/__init__.py b/worlds/sm/__init__.py index bf9d6d087edd..160b7e4ec78b 100644 --- a/worlds/sm/__init__.py +++ b/worlds/sm/__init__.py @@ -313,9 +313,11 @@ def remove(self, state: CollectionState, item: Item) -> bool: return super(SMWorld, self).remove(state, item) def create_item(self, name: str) -> Item: - item = next(x for x in ItemManager.Items.values() if x.Name == name) - return SMItem(item.Name, ItemClassification.progression if item.Class != 'Minor' else ItemClassification.filler, item.Type, self.item_name_to_id[item.Name], + item = next((x for x in ItemManager.Items.values() if x.Name == name), None) + if item: + return SMItem(item.Name, ItemClassification.progression if item.Class != 'Minor' else ItemClassification.filler, item.Type, self.item_name_to_id[item.Name], player=self.player) + raise KeyError(f"Item {name} for {self.player_name} is invalid.") def get_filler_item_name(self) -> str: if self.multiworld.random.randint(0, 100) < self.options.minor_qty.value: diff --git a/worlds/sm64ex/docs/setup_en.md b/worlds/sm64ex/docs/setup_en.md index afb5bad50f71..9963d3945a10 100644 --- a/worlds/sm64ex/docs/setup_en.md +++ b/worlds/sm64ex/docs/setup_en.md @@ -29,15 +29,25 @@ Then continue to `Using the Launcher` *Using the Launcher* -1. Go to the page linked for SM64AP-Launcher, and press on the topmost entry +1. Go to the page linked for SM64AP-Launcher, and press on the topmost entry. 2. Scroll down, and download the zip file for your OS. -3. Unpack the zip file in an empty folder +3. Unpack the zip file in an empty folder. 4. Run the Launcher. On first start, press `Check Requirements`, which will guide you through the rest of the needed steps. - Windows: If you did not use the default install directory for MSYS, close this window, check `Show advanced options` and reopen using `Re-check Requirements`. You can then set the path manually. -5. When finished, use `Compile default SM64AP build` to continue - - Advanced user can use `Show advanced options` to build with custom makeflags (`BETTERCAMERA`, `NODRAWINGDISTANCE`, ...), different repos and branches, and game patches such as 60FPS, Enhanced Moveset and others. - - [Available Makeflags](https://github.com/sm64pc/sm64ex/wiki/Build-options) - - [Included Game Patches](https://github.com/N00byKing/sm64ex/blob/archipelago/enhancements/README.md) +5. When finished, use `Compile default SM64AP build` to continue. + - **Advanced configuration:** If you want to use additional build options such as Better Camera, No Drawing Distance, etc or apply game patches such as 60FPS, Enhanced Moveset, etc, then use the `Compile custom build` option: + - Set a name for your build, e.g. "archipelago" or whatever you like. + - Press the `Download Files` button. + - Set Make Flags, e.g. `-j8 BETTERCAMERA=1 NODRAWINGDISTANCE=1` to enable Better Camera and No Drawing Distance. + - Press `Apply Patches` to select patches to apply. Example patches include: + - 60FPS: Improves frame rate. + - Enhanced Moveset: Gives Mario new abilities. [Details here](https://github.com/TheGag96/sm64-port). + - Nonstop Mode: Makes it possible to fetch multiple stars in a level without exiting the level first. + - Press `Create Build`. This will take several minutes. + - You can also use the Repository and Branch fields to build with different repos or branches if you want to build using a fork or development version of SM64AP. + - For more details, see: + - [Available Makeflags](https://github.com/sm64pc/sm64ex/wiki/Build-options) + - [Included Game Patches](https://github.com/N00byKing/sm64ex/blob/archipelago/enhancements/README.md) 6. Press `Download Files` to prepare the build, afterwards `Create Build`. 7. SM64EX will now be compiled. This can take a while. diff --git a/worlds/smz3/Rom.py b/worlds/smz3/Rom.py index 3fec151dc679..d66d9239792d 100644 --- a/worlds/smz3/Rom.py +++ b/worlds/smz3/Rom.py @@ -3,18 +3,38 @@ import Utils from Utils import read_snes_rom -from worlds.Files import APDeltaPatch +from worlds.Files import APProcedurePatch, APPatchExtension, APTokenMixin, APTokenTypes +from worlds.smz3.ips import IPS_Patch SMJUHASH = '21f3e98df4780ee1c667b84e57d88675' LTTPJPN10HASH = '03a63945398191337e896e5771f77173' ROM_PLAYER_LIMIT = 256 +world_folder = os.path.dirname(__file__) -class SMZ3DeltaPatch(APDeltaPatch): +class SMZ3PatchExtensions(APPatchExtension): + game = "SMZ3" + + @staticmethod + def apply_basepatch(caller: APProcedurePatch, rom: bytes) -> bytes: + basepatch = IPS_Patch.load(world_folder + "/data/zsm.ips") + return basepatch.apply(rom) + +class SMZ3ProcedurePatch(APProcedurePatch, APTokenMixin): hash = "3a177ba9879e3dd04fb623a219d175b2" game = "SMZ3" patch_file_ending = ".apsmz3" + procedure = [ + ("apply_basepatch", []), + ("apply_tokens", ["token_data.bin"]), + ] + + def write_tokens(self, patches): + for addr, data in patches.items(): + self.write_token(APTokenTypes.WRITE, addr, bytes(data)) + self.write_file("token_data.bin", self.get_token_binary()) + @classmethod def get_source_data(cls) -> bytes: return get_base_rom_bytes() diff --git a/worlds/smz3/__init__.py b/worlds/smz3/__init__.py index 5e6a6ac60965..838db1f7e745 100644 --- a/worlds/smz3/__init__.py +++ b/worlds/smz3/__init__.py @@ -19,11 +19,10 @@ from .TotalSMZ3.Region import IReward, IMedallionAccess from .TotalSMZ3.Text.Texts import openFile from worlds.AutoWorld import World, AutoLogicRegister, WebWorld -from .Client import SMZ3SNIClient -from .Rom import get_base_rom_bytes, SMZ3DeltaPatch -from .ips import IPS_Patch +from .Rom import SMZ3ProcedurePatch from .Options import SMZ3Options -from Options import Accessibility, ItemsAccessibility +from Options import ItemsAccessibility +from .Client import SMZ3SNIClient world_folder = os.path.dirname(__file__) logger = logging.getLogger("SMZ3") @@ -183,10 +182,6 @@ def isProgression(cls, itemType): } return itemType in progressionTypes - @classmethod - def stage_assert_generate(cls, multiworld: MultiWorld): - base_combined_rom = get_base_rom_bytes() - def generate_early(self): self.config = Config() self.config.GameMode = GameMode.Multiworld @@ -444,10 +439,6 @@ def apply_customization(self): def generate_output(self, output_directory: str): try: - base_combined_rom = get_base_rom_bytes() - basepatch = IPS_Patch.load(world_folder + "/data/zsm.ips") - base_combined_rom = basepatch.apply(base_combined_rom) - patcher = TotalSMZ3Patch(self.smz3World, [world.smz3World for key, world in self.multiworld.worlds.items() if isinstance(world, SMZ3World) and hasattr(world, "smz3World")], self.multiworld.seed_name, @@ -459,21 +450,13 @@ def generate_output(self, output_directory: str): patches.update(self.apply_sm_custom_sprite()) patches.update(self.apply_item_names()) patches.update(self.apply_customization()) - for addr, bytes in patches.items(): - offset = 0 - for byte in bytes: - base_combined_rom[addr + offset] = byte - offset += 1 - - outfilebase = self.multiworld.get_out_file_name_base(self.player) - - filename = os.path.join(output_directory, f"{outfilebase}.sfc") - with open(filename, "wb") as binary_file: - binary_file.write(base_combined_rom) - patch = SMZ3DeltaPatch(os.path.splitext(filename)[0] + SMZ3DeltaPatch.patch_file_ending, player=self.player, - player_name=self.multiworld.player_name[self.player], patched_path=filename) - patch.write() - os.remove(filename) + + patch = SMZ3ProcedurePatch(player=self.player, player_name=self.player_name) + patch.write_tokens(patches) + rom_path = os.path.join(output_directory, f"{self.multiworld.get_out_file_name_base(self.player)}" + f"{patch.patch_file_ending}") + patch.write(rom_path) + self.rom_name = bytearray(patcher.title, 'utf8') except: raise diff --git a/worlds/stardew_valley/__init__.py b/worlds/stardew_valley/__init__.py index 01ca56531f00..34c617f5013a 100644 --- a/worlds/stardew_valley/__init__.py +++ b/worlds/stardew_valley/__init__.py @@ -3,7 +3,7 @@ from typing import Dict, Any, Iterable, Optional, Union, List, TextIO from BaseClasses import Region, Entrance, Location, Item, Tutorial, ItemClassification, MultiWorld, CollectionState -from Options import PerGameCommonOptions +from Options import PerGameCommonOptions, Accessibility from worlds.AutoWorld import World, WebWorld from . import rules from .bundles.bundle_room import BundleRoom @@ -91,15 +91,14 @@ class StardewValleyWorld(World): web = StardewWebWorld() modified_bundles: List[BundleRoom] randomized_entrances: Dict[str, str] - total_progression_items: int - # all_progression_items: Dict[str, int] # If you need to debug total_progression_items, uncommenting this will help tremendously + total_progression_items: int + excluded_from_total_progression_items: List[str] = [Event.received_walnuts] def __init__(self, multiworld: MultiWorld, player: int): super().__init__(multiworld, player) self.filler_item_pool_names = [] self.total_progression_items = 0 - # self.all_progression_items = dict() # Taking the seed specified in slot data for UT, otherwise just generating the seed. self.seed = getattr(multiworld, "re_gen_passthrough", {}).get(STARDEW_VALLEY, self.random.getrandbits(64)) @@ -121,17 +120,27 @@ def force_change_options_if_incompatible(self): goal_is_perfection = self.options.goal == Goal.option_perfection goal_is_island_related = goal_is_walnut_hunter or goal_is_perfection exclude_ginger_island = self.options.exclude_ginger_island == ExcludeGingerIsland.option_true + if goal_is_island_related and exclude_ginger_island: self.options.exclude_ginger_island.value = ExcludeGingerIsland.option_false goal_name = self.options.goal.current_key - player_name = self.multiworld.player_name[self.player] logger.warning( - f"Goal '{goal_name}' requires Ginger Island. Exclude Ginger Island setting forced to 'False' for player {self.player} ({player_name})") + f"Goal '{goal_name}' requires Ginger Island. Exclude Ginger Island setting forced to 'False' for player {self.player} ({self.player_name})") + if exclude_ginger_island and self.options.walnutsanity != Walnutsanity.preset_none: self.options.walnutsanity.value = Walnutsanity.preset_none - player_name = self.multiworld.player_name[self.player] logger.warning( - f"Walnutsanity requires Ginger Island. Ginger Island was excluded from {self.player} ({player_name})'s world, so walnutsanity was force disabled") + f"Walnutsanity requires Ginger Island. Ginger Island was excluded from {self.player} ({self.player_name})'s world, so walnutsanity was force disabled") + + if goal_is_perfection and self.options.accessibility == Accessibility.option_minimal: + self.options.accessibility.value = Accessibility.option_full + logger.warning( + f"Goal 'Perfection' requires full accessibility. Accessibility setting forced to 'Full' for player {self.player} ({self.player_name})") + + elif self.options.goal == Goal.option_allsanity and self.options.accessibility == Accessibility.option_minimal: + self.options.accessibility.value = Accessibility.option_full + logger.warning( + f"Goal 'Allsanity' requires full accessibility. Accessibility setting forced to 'Full' for player {self.player} ({self.player_name})") def create_regions(self): def create_region(name: str, exits: Iterable[str]) -> Region: @@ -139,7 +148,7 @@ def create_region(name: str, exits: Iterable[str]) -> Region: region.exits = [Entrance(self.player, exit_name, region) for exit_name in exits] return region - world_regions, world_entrances, self.randomized_entrances = create_regions(create_region, self.random, self.options) + world_regions, world_entrances, self.randomized_entrances = create_regions(create_region, self.random, self.options, self.content) self.logic = StardewLogic(self.player, self.options, self.content, world_regions.keys()) self.modified_bundles = get_all_bundles(self.random, @@ -171,15 +180,26 @@ def create_items(self): for location in self.multiworld.get_locations(self.player) if location.address is not None]) - created_items = create_items(self.create_item, self.delete_item, locations_count, items_to_exclude, self.options, self.content, - self.random) + created_items = create_items(self.create_item, locations_count, items_to_exclude, self.options, self.content, self.random) self.multiworld.itempool += created_items - setup_early_items(self.multiworld, self.options, self.player, self.random) + setup_early_items(self.multiworld, self.options, self.content, self.player, self.random) self.setup_player_events() self.setup_victory() + # This is really a best-effort to get the total progression items count. It is mostly used to spread grinds across spheres are push back locations that + # only become available after months or years in game. In most cases, not having the exact count will not impact the logic. + # + # The actual total can be impacted by the start_inventory_from_pool, when items are removed from the pool but not from the total. The is also a bug + # with plando where additional progression items can be created without being accounted for, which impact the real amount of progression items. This can + # ultimately create unwinnable seeds where some items (like Blueberry seeds) are locked in Shipsanity: Blueberry, but world is deemed winnable as the + # winning rule only check the count of collected progression items. + self.total_progression_items += sum(1 for i in self.multiworld.precollected_items[self.player] if i.advancement) + self.total_progression_items += sum(1 for i in self.multiworld.get_filled_locations(self.player) if i.advancement) + self.total_progression_items += sum(1 for i in created_items if i.advancement) + self.total_progression_items -= 1 # -1 for the victory event + def precollect_starting_season(self): if self.options.season_randomization == SeasonRandomization.option_progressive: return @@ -304,14 +324,8 @@ def create_item(self, item: Union[str, ItemData], override_classification: ItemC if override_classification is None: override_classification = item.classification - if override_classification & ItemClassification.progression: - self.total_progression_items += 1 return StardewItem(item.name, override_classification, item.code, self.player) - def delete_item(self, item: Item): - if item.classification & ItemClassification.progression: - self.total_progression_items -= 1 - def create_starting_item(self, item: Union[str, ItemData]) -> StardewItem: if isinstance(item, str): item = item_table[item] @@ -330,10 +344,6 @@ def create_event_location(self, location_data: LocationData, rule: StardewRule = region.locations.append(location) location.place_locked_item(StardewItem(item, ItemClassification.progression, None, self.player)) - # This is not ideal, but the rule count them so... - if item != Event.victory: - self.total_progression_items += 1 - def set_rules(self): set_rules(self) @@ -426,15 +436,25 @@ def fill_slot_data(self) -> Dict[str, Any]: def collect(self, state: CollectionState, item: StardewItem) -> bool: change = super().collect(state, item) - if change: - state.prog_items[self.player][Event.received_walnuts] += self.get_walnut_amount(item.name) - return change + if not change: + return False + + walnut_amount = self.get_walnut_amount(item.name) + if walnut_amount: + state.prog_items[self.player][Event.received_walnuts] += walnut_amount + + return True def remove(self, state: CollectionState, item: StardewItem) -> bool: change = super().remove(state, item) - if change: - state.prog_items[self.player][Event.received_walnuts] -= self.get_walnut_amount(item.name) - return change + if not change: + return False + + walnut_amount = self.get_walnut_amount(item.name) + if walnut_amount: + state.prog_items[self.player][Event.received_walnuts] -= walnut_amount + + return True @staticmethod def get_walnut_amount(item_name: str) -> int: diff --git a/worlds/stardew_valley/bundles/bundle_item.py b/worlds/stardew_valley/bundles/bundle_item.py index 7dc9c0e1a3b5..91e279d2a623 100644 --- a/worlds/stardew_valley/bundles/bundle_item.py +++ b/worlds/stardew_valley/bundles/bundle_item.py @@ -3,8 +3,8 @@ from abc import ABC, abstractmethod from dataclasses import dataclass -from ..content import StardewContent -from ..options import StardewValleyOptions, ExcludeGingerIsland, FestivalLocations, SkillProgression +from ..content import StardewContent, content_packs +from ..options import StardewValleyOptions, FestivalLocations from ..strings.crop_names import Fruit from ..strings.currency_names import Currency from ..strings.quality_names import CropQuality, FishQuality, ForageQuality @@ -12,34 +12,35 @@ class BundleItemSource(ABC): @abstractmethod - def can_appear(self, options: StardewValleyOptions) -> bool: + def can_appear(self, content: StardewContent, options: StardewValleyOptions) -> bool: ... class VanillaItemSource(BundleItemSource): - def can_appear(self, options: StardewValleyOptions) -> bool: + def can_appear(self, content: StardewContent, options: StardewValleyOptions) -> bool: return True class IslandItemSource(BundleItemSource): - def can_appear(self, options: StardewValleyOptions) -> bool: - return options.exclude_ginger_island == ExcludeGingerIsland.option_false + def can_appear(self, content: StardewContent, options: StardewValleyOptions) -> bool: + return content_packs.ginger_island_content_pack.name in content.registered_packs class FestivalItemSource(BundleItemSource): - def can_appear(self, options: StardewValleyOptions) -> bool: + def can_appear(self, content: StardewContent, options: StardewValleyOptions) -> bool: return options.festival_locations != FestivalLocations.option_disabled +# FIXME remove this once recipes are in content packs class MasteryItemSource(BundleItemSource): - def can_appear(self, options: StardewValleyOptions) -> bool: - return options.skill_progression == SkillProgression.option_progressive_with_masteries + def can_appear(self, content: StardewContent, options: StardewValleyOptions) -> bool: + return content.features.skill_progression.are_masteries_shuffled class ContentItemSource(BundleItemSource): """This is meant to be used for items that are managed by the content packs.""" - def can_appear(self, options: StardewValleyOptions) -> bool: + def can_appear(self, content: StardewContent, options: StardewValleyOptions) -> bool: raise ValueError("This should not be called, check if the item is in the content instead.") @@ -97,5 +98,4 @@ def can_appear(self, content: StardewContent, options: StardewValleyOptions) -> if isinstance(self.source, ContentItemSource): return self.get_item() in content.game_items - return self.source.can_appear(options) - + return self.source.can_appear(content, options) diff --git a/worlds/stardew_valley/content/__init__.py b/worlds/stardew_valley/content/__init__.py index 9130873fa405..54b4d75d5e5c 100644 --- a/worlds/stardew_valley/content/__init__.py +++ b/worlds/stardew_valley/content/__init__.py @@ -1,5 +1,5 @@ from . import content_packs -from .feature import cropsanity, friendsanity, fishsanity, booksanity +from .feature import cropsanity, friendsanity, fishsanity, booksanity, skill_progression from .game_content import ContentPack, StardewContent, StardewFeatures from .unpacking import unpack_content from .. import options @@ -31,7 +31,8 @@ def choose_features(player_options: options.StardewValleyOptions) -> StardewFeat choose_booksanity(player_options.booksanity), choose_cropsanity(player_options.cropsanity), choose_fishsanity(player_options.fishsanity), - choose_friendsanity(player_options.friendsanity, player_options.friendsanity_heart_size) + choose_friendsanity(player_options.friendsanity, player_options.friendsanity_heart_size), + choose_skill_progression(player_options.skill_progression), ) @@ -105,3 +106,19 @@ def choose_friendsanity(friendsanity_option: options.Friendsanity, heart_size: o return friendsanity.FriendsanityAllWithMarriage(heart_size.value) raise ValueError(f"No friendsanity feature mapped to {str(friendsanity_option.value)}") + + +skill_progression_by_option = { + options.SkillProgression.option_vanilla: skill_progression.SkillProgressionVanilla(), + options.SkillProgression.option_progressive: skill_progression.SkillProgressionProgressive(), + options.SkillProgression.option_progressive_with_masteries: skill_progression.SkillProgressionProgressiveWithMasteries(), +} + + +def choose_skill_progression(skill_progression_option: options.SkillProgression) -> skill_progression.SkillProgressionFeature: + skill_progression_feature = skill_progression_by_option.get(skill_progression_option) + + if skill_progression_feature is None: + raise ValueError(f"No skill progression feature mapped to {str(skill_progression_option.value)}") + + return skill_progression_feature diff --git a/worlds/stardew_valley/content/feature/__init__.py b/worlds/stardew_valley/content/feature/__init__.py index 74249c808257..f3e5c6732e32 100644 --- a/worlds/stardew_valley/content/feature/__init__.py +++ b/worlds/stardew_valley/content/feature/__init__.py @@ -2,3 +2,4 @@ from . import cropsanity from . import fishsanity from . import friendsanity +from . import skill_progression diff --git a/worlds/stardew_valley/content/feature/skill_progression.py b/worlds/stardew_valley/content/feature/skill_progression.py new file mode 100644 index 000000000000..1325d4b35ff2 --- /dev/null +++ b/worlds/stardew_valley/content/feature/skill_progression.py @@ -0,0 +1,46 @@ +from abc import ABC, abstractmethod +from typing import ClassVar, Iterable, Tuple + +from ...data.skill import Skill + + +class SkillProgressionFeature(ABC): + is_progressive: ClassVar[bool] + are_masteries_shuffled: ClassVar[bool] + + @abstractmethod + def get_randomized_level_names_by_level(self, skill: Skill) -> Iterable[Tuple[int, str]]: + ... + + @abstractmethod + def is_mastery_randomized(self, skill: Skill) -> bool: + ... + + +class SkillProgressionVanilla(SkillProgressionFeature): + is_progressive = False + are_masteries_shuffled = False + + def get_randomized_level_names_by_level(self, skill: Skill) -> Iterable[Tuple[int, str]]: + return () + + def is_mastery_randomized(self, skill: Skill) -> bool: + return False + + +class SkillProgressionProgressive(SkillProgressionFeature): + is_progressive = True + are_masteries_shuffled = False + + def get_randomized_level_names_by_level(self, skill: Skill) -> Iterable[Tuple[int, str]]: + return skill.level_names_by_level + + def is_mastery_randomized(self, skill: Skill) -> bool: + return False + + +class SkillProgressionProgressiveWithMasteries(SkillProgressionProgressive): + are_masteries_shuffled = True + + def is_mastery_randomized(self, skill: Skill) -> bool: + return skill.has_mastery diff --git a/worlds/stardew_valley/content/game_content.py b/worlds/stardew_valley/content/game_content.py index 8dcf933145e3..7ff3217b04ed 100644 --- a/worlds/stardew_valley/content/game_content.py +++ b/worlds/stardew_valley/content/game_content.py @@ -3,7 +3,7 @@ from dataclasses import dataclass, field from typing import Dict, Iterable, Set, Any, Mapping, Type, Tuple, Union -from .feature import booksanity, cropsanity, fishsanity, friendsanity +from .feature import booksanity, cropsanity, fishsanity, friendsanity, skill_progression from ..data.fish_data import FishItem from ..data.game_item import GameItem, ItemSource, ItemTag from ..data.skill import Skill @@ -53,6 +53,7 @@ class StardewFeatures: cropsanity: cropsanity.CropsanityFeature fishsanity: fishsanity.FishsanityFeature friendsanity: friendsanity.FriendsanityFeature + skill_progression: skill_progression.SkillProgressionFeature @dataclass(frozen=True) diff --git a/worlds/stardew_valley/data/skill.py b/worlds/stardew_valley/data/skill.py index 4c754ddd8716..df4ff9feed6d 100644 --- a/worlds/stardew_valley/data/skill.py +++ b/worlds/stardew_valley/data/skill.py @@ -1,7 +1,21 @@ from dataclasses import dataclass, field +from functools import cached_property +from typing import Iterable, Tuple @dataclass(frozen=True) class Skill: name: str has_mastery: bool = field(kw_only=True) + + @cached_property + def mastery_name(self) -> str: + return f"{self.name} Mastery" + + @cached_property + def level_name(self) -> str: + return f"{self.name} Level" + + @cached_property + def level_names_by_level(self) -> Iterable[Tuple[int, str]]: + return tuple((level, f"Level {level} {self.name}") for level in range(1, 11)) diff --git a/worlds/stardew_valley/early_items.py b/worlds/stardew_valley/early_items.py index e1ad8cebfd4a..81e28956b3cf 100644 --- a/worlds/stardew_valley/early_items.py +++ b/worlds/stardew_valley/early_items.py @@ -1,11 +1,13 @@ from random import Random from . import options as stardew_options +from .content import StardewContent from .strings.ap_names.ap_weapon_names import APWeapon from .strings.ap_names.transport_names import Transportation from .strings.building_names import Building from .strings.region_names import Region from .strings.season_names import Season +from .strings.skill_names import Skill from .strings.tv_channel_names import Channel from .strings.wallet_item_names import Wallet @@ -14,7 +16,7 @@ seasons = [Season.spring, Season.summer, Season.fall, Season.winter] -def setup_early_items(multiworld, options: stardew_options.StardewValleyOptions, player: int, random: Random): +def setup_early_items(multiworld, options: stardew_options.StardewValleyOptions, content: StardewContent, player: int, random: Random): early_forced = [] early_candidates = [] early_candidates.extend(always_early_candidates) @@ -31,12 +33,13 @@ def setup_early_items(multiworld, options: stardew_options.StardewValleyOptions, early_forced.append("Progressive Backpack") if options.tool_progression & stardew_options.ToolProgression.option_progressive: - if options.fishsanity != stardew_options.Fishsanity.option_none: + if content.features.fishsanity.is_enabled: early_candidates.append("Progressive Fishing Rod") early_forced.append("Progressive Pickaxe") - if options.skill_progression == stardew_options.SkillProgression.option_progressive: - early_forced.append("Fishing Level") + fishing = content.skills.get(Skill.fishing) + if fishing is not None and content.features.skill_progression.is_progressive: + early_forced.append(fishing.level_name) if options.quest_locations >= 0: early_candidates.append(Wallet.magnifying_glass) diff --git a/worlds/stardew_valley/items.py b/worlds/stardew_valley/items.py index 993863bf5bf5..3d852a37f402 100644 --- a/worlds/stardew_valley/items.py +++ b/worlds/stardew_valley/items.py @@ -15,7 +15,7 @@ from .logic.logic_event import all_events from .mods.mod_data import ModNames from .options import StardewValleyOptions, TrapItems, FestivalLocations, ExcludeGingerIsland, SpecialOrderLocations, SeasonRandomization, Museumsanity, \ - BuildingProgression, SkillProgression, ToolProgression, ElevatorProgression, BackpackProgression, ArcadeMachineLocations, Monstersanity, Goal, \ + BuildingProgression, ToolProgression, ElevatorProgression, BackpackProgression, ArcadeMachineLocations, Monstersanity, Goal, \ Chefsanity, Craftsanity, BundleRandomization, EntranceRandomization, Shipsanity, Walnutsanity, EnabledFillerBuffs from .strings.ap_names.ap_option_names import OptionName from .strings.ap_names.ap_weapon_names import APWeapon @@ -169,14 +169,14 @@ def get_too_many_items_error_message(locations_count: int, items_count: int) -> return f"There should be at least as many locations [{locations_count}] as there are mandatory items [{items_count}]" -def create_items(item_factory: StardewItemFactory, item_deleter: StardewItemDeleter, locations_count: int, items_to_exclude: List[Item], +def create_items(item_factory: StardewItemFactory, locations_count: int, items_to_exclude: List[Item], options: StardewValleyOptions, content: StardewContent, random: Random) -> List[Item]: items = [] unique_items = create_unique_items(item_factory, options, content, random) - remove_items(item_deleter, items_to_exclude, unique_items) + remove_items(items_to_exclude, unique_items) - remove_items_if_no_room_for_them(item_deleter, unique_items, locations_count, random) + remove_items_if_no_room_for_them(unique_items, locations_count, random) items += unique_items logger.debug(f"Created {len(unique_items)} unique items") @@ -192,14 +192,13 @@ def create_items(item_factory: StardewItemFactory, item_deleter: StardewItemDele return items -def remove_items(item_deleter: StardewItemDeleter, items_to_remove, items): +def remove_items(items_to_remove, items): for item in items_to_remove: if item in items: items.remove(item) - item_deleter(item) -def remove_items_if_no_room_for_them(item_deleter: StardewItemDeleter, unique_items: List[Item], locations_count: int, random: Random): +def remove_items_if_no_room_for_them(unique_items: List[Item], locations_count: int, random: Random): if len(unique_items) <= locations_count: return @@ -212,7 +211,7 @@ def remove_items_if_no_room_for_them(item_deleter: StardewItemDeleter, unique_it logger.debug(f"Player has more items than locations, trying to remove {number_of_items_to_remove} random filler items") assert len(removable_items) >= number_of_items_to_remove, get_too_many_items_error_message(locations_count, len(unique_items)) items_to_remove = random.sample(removable_items, number_of_items_to_remove) - remove_items(item_deleter, items_to_remove, unique_items) + remove_items(items_to_remove, unique_items) def create_unique_items(item_factory: StardewItemFactory, options: StardewValleyOptions, content: StardewContent, random: Random) -> List[Item]: @@ -227,8 +226,8 @@ def create_unique_items(item_factory: StardewItemFactory, options: StardewValley create_weapons(item_factory, options, items) items.append(item_factory("Skull Key")) create_elevators(item_factory, options, items) - create_tools(item_factory, options, items) - create_skills(item_factory, options, items) + create_tools(item_factory, options, content, items) + create_skills(item_factory, content, items) create_wizard_buildings(item_factory, options, items) create_carpenter_buildings(item_factory, options, items) items.append(item_factory("Railroad Boulder Removed")) @@ -317,7 +316,7 @@ def create_elevators(item_factory: StardewItemFactory, options: StardewValleyOpt items.extend([item_factory(item) for item in ["Progressive Skull Cavern Elevator"] * 8]) -def create_tools(item_factory: StardewItemFactory, options: StardewValleyOptions, items: List[Item]): +def create_tools(item_factory: StardewItemFactory, options: StardewValleyOptions, content: StardewContent, items: List[Item]): if options.tool_progression & ToolProgression.option_progressive: for item_data in items_by_group[Group.PROGRESSIVE_TOOLS]: name = item_data.name @@ -326,28 +325,29 @@ def create_tools(item_factory: StardewItemFactory, options: StardewValleyOptions items.append(item_factory(item_data, ItemClassification.useful)) else: items.extend([item_factory(item) for item in [item_data] * 4]) - if options.skill_progression == SkillProgression.option_progressive_with_masteries: + + if content.features.skill_progression.are_masteries_shuffled: + # Masteries add another tier to the scythe and the fishing rod items.append(item_factory("Progressive Scythe")) items.append(item_factory("Progressive Fishing Rod")) + + # The golden scythe is always randomized items.append(item_factory("Progressive Scythe")) -def create_skills(item_factory: StardewItemFactory, options: StardewValleyOptions, items: List[Item]): - if options.skill_progression == SkillProgression.option_vanilla: +def create_skills(item_factory: StardewItemFactory, content: StardewContent, items: List[Item]): + skill_progression = content.features.skill_progression + if not skill_progression.is_progressive: return - for item in items_by_group[Group.SKILL_LEVEL_UP]: - if item.mod_name not in options.mods and item.mod_name is not None: - continue - items.extend(item_factory(item) for item in [item.name] * 10) + for skill in content.skills.values(): + items.extend(item_factory(skill.level_name) for _ in skill_progression.get_randomized_level_names_by_level(skill)) - if options.skill_progression != SkillProgression.option_progressive_with_masteries: - return + if skill_progression.is_mastery_randomized(skill): + items.append(item_factory(skill.mastery_name)) - for item in items_by_group[Group.SKILL_MASTERY]: - if item.mod_name not in options.mods and item.mod_name is not None: - continue - items.append(item_factory(item)) + if skill_progression.are_masteries_shuffled: + items.append(item_factory(Wallet.mastery_of_the_five_ways)) def create_wizard_buildings(item_factory: StardewItemFactory, options: StardewValleyOptions, items: List[Item]): diff --git a/worlds/stardew_valley/locations.py b/worlds/stardew_valley/locations.py index 1d67d535ccee..b3a8db6f0341 100644 --- a/worlds/stardew_valley/locations.py +++ b/worlds/stardew_valley/locations.py @@ -11,7 +11,7 @@ from .data.museum_data import all_museum_items from .mods.mod_data import ModNames from .options import ExcludeGingerIsland, ArcadeMachineLocations, SpecialOrderLocations, Museumsanity, \ - FestivalLocations, SkillProgression, BuildingProgression, ToolProgression, ElevatorProgression, BackpackProgression, FarmType + FestivalLocations, BuildingProgression, ToolProgression, ElevatorProgression, BackpackProgression, FarmType from .options import StardewValleyOptions, Craftsanity, Chefsanity, Cooksanity, Shipsanity, Monstersanity from .strings.goal_names import Goal from .strings.quest_names import ModQuest, Quest @@ -188,12 +188,12 @@ def extend_cropsanity_locations(randomized_locations: List[LocationData], conten for item in content.find_tagged_items(ItemTag.CROPSANITY)) -def extend_quests_locations(randomized_locations: List[LocationData], options: StardewValleyOptions): +def extend_quests_locations(randomized_locations: List[LocationData], options: StardewValleyOptions, content: StardewContent): if options.quest_locations < 0: return story_quest_locations = locations_by_tag[LocationTags.STORY_QUEST] - story_quest_locations = filter_disabled_locations(options, story_quest_locations) + story_quest_locations = filter_disabled_locations(options, content, story_quest_locations) randomized_locations.extend(story_quest_locations) for i in range(0, options.quest_locations.value): @@ -284,9 +284,9 @@ def extend_desert_festival_chef_locations(randomized_locations: List[LocationDat randomized_locations.extend(locations_to_add) -def extend_special_order_locations(randomized_locations: List[LocationData], options: StardewValleyOptions): +def extend_special_order_locations(randomized_locations: List[LocationData], options: StardewValleyOptions, content: StardewContent): if options.special_order_locations & SpecialOrderLocations.option_board: - board_locations = filter_disabled_locations(options, locations_by_tag[LocationTags.SPECIAL_ORDER_BOARD]) + board_locations = filter_disabled_locations(options, content, locations_by_tag[LocationTags.SPECIAL_ORDER_BOARD]) randomized_locations.extend(board_locations) include_island = options.exclude_ginger_island == ExcludeGingerIsland.option_false @@ -308,9 +308,9 @@ def extend_walnut_purchase_locations(randomized_locations: List[LocationData], o randomized_locations.extend(locations_by_tag[LocationTags.WALNUT_PURCHASE]) -def extend_mandatory_locations(randomized_locations: List[LocationData], options: StardewValleyOptions): +def extend_mandatory_locations(randomized_locations: List[LocationData], options: StardewValleyOptions, content: StardewContent): mandatory_locations = [location for location in locations_by_tag[LocationTags.MANDATORY]] - filtered_mandatory_locations = filter_disabled_locations(options, mandatory_locations) + filtered_mandatory_locations = filter_disabled_locations(options, content, mandatory_locations) randomized_locations.extend(filtered_mandatory_locations) @@ -349,32 +349,32 @@ def extend_elevator_locations(randomized_locations: List[LocationData], options: randomized_locations.extend(filtered_elevator_locations) -def extend_monstersanity_locations(randomized_locations: List[LocationData], options): +def extend_monstersanity_locations(randomized_locations: List[LocationData], options: StardewValleyOptions, content: StardewContent): monstersanity = options.monstersanity if monstersanity == Monstersanity.option_none: return if monstersanity == Monstersanity.option_one_per_monster or monstersanity == Monstersanity.option_split_goals: monster_locations = [location for location in locations_by_tag[LocationTags.MONSTERSANITY_MONSTER]] - filtered_monster_locations = filter_disabled_locations(options, monster_locations) + filtered_monster_locations = filter_disabled_locations(options, content, monster_locations) randomized_locations.extend(filtered_monster_locations) return goal_locations = [location for location in locations_by_tag[LocationTags.MONSTERSANITY_GOALS]] - filtered_goal_locations = filter_disabled_locations(options, goal_locations) + filtered_goal_locations = filter_disabled_locations(options, content, goal_locations) randomized_locations.extend(filtered_goal_locations) if monstersanity != Monstersanity.option_progressive_goals: return progressive_goal_locations = [location for location in locations_by_tag[LocationTags.MONSTERSANITY_PROGRESSIVE_GOALS]] - filtered_progressive_goal_locations = filter_disabled_locations(options, progressive_goal_locations) + filtered_progressive_goal_locations = filter_disabled_locations(options, content, progressive_goal_locations) randomized_locations.extend(filtered_progressive_goal_locations) -def extend_shipsanity_locations(randomized_locations: List[LocationData], options: StardewValleyOptions): +def extend_shipsanity_locations(randomized_locations: List[LocationData], options: StardewValleyOptions, content: StardewContent): shipsanity = options.shipsanity if shipsanity == Shipsanity.option_none: return if shipsanity == Shipsanity.option_everything: ship_locations = [location for location in locations_by_tag[LocationTags.SHIPSANITY]] - filtered_ship_locations = filter_disabled_locations(options, ship_locations) + filtered_ship_locations = filter_disabled_locations(options, content, ship_locations) randomized_locations.extend(filtered_ship_locations) return shipsanity_locations = set() @@ -385,11 +385,11 @@ def extend_shipsanity_locations(randomized_locations: List[LocationData], option if shipsanity == Shipsanity.option_full_shipment or shipsanity == Shipsanity.option_full_shipment_with_fish: shipsanity_locations = shipsanity_locations.union({location for location in locations_by_tag[LocationTags.SHIPSANITY_FULL_SHIPMENT]}) - filtered_shipsanity_locations = filter_disabled_locations(options, list(shipsanity_locations)) + filtered_shipsanity_locations = filter_disabled_locations(options, content, list(shipsanity_locations)) randomized_locations.extend(filtered_shipsanity_locations) -def extend_cooksanity_locations(randomized_locations: List[LocationData], options: StardewValleyOptions): +def extend_cooksanity_locations(randomized_locations: List[LocationData], options: StardewValleyOptions, content: StardewContent): cooksanity = options.cooksanity if cooksanity == Cooksanity.option_none: return @@ -398,11 +398,11 @@ def extend_cooksanity_locations(randomized_locations: List[LocationData], option else: cooksanity_locations = (location for location in locations_by_tag[LocationTags.COOKSANITY]) - filtered_cooksanity_locations = filter_disabled_locations(options, cooksanity_locations) + filtered_cooksanity_locations = filter_disabled_locations(options, content, cooksanity_locations) randomized_locations.extend(filtered_cooksanity_locations) -def extend_chefsanity_locations(randomized_locations: List[LocationData], options: StardewValleyOptions): +def extend_chefsanity_locations(randomized_locations: List[LocationData], options: StardewValleyOptions, content: StardewContent): chefsanity = options.chefsanity if chefsanity == Chefsanity.option_none: return @@ -418,16 +418,16 @@ def extend_chefsanity_locations(randomized_locations: List[LocationData], option if chefsanity & Chefsanity.option_skills: chefsanity_locations_by_name.update({location.name: location for location in locations_by_tag[LocationTags.CHEFSANITY_SKILL]}) - filtered_chefsanity_locations = filter_disabled_locations(options, list(chefsanity_locations_by_name.values())) + filtered_chefsanity_locations = filter_disabled_locations(options, content, list(chefsanity_locations_by_name.values())) randomized_locations.extend(filtered_chefsanity_locations) -def extend_craftsanity_locations(randomized_locations: List[LocationData], options: StardewValleyOptions): +def extend_craftsanity_locations(randomized_locations: List[LocationData], options: StardewValleyOptions, content: StardewContent): if options.craftsanity == Craftsanity.option_none: return craftsanity_locations = [craft for craft in locations_by_tag[LocationTags.CRAFTSANITY]] - filtered_craftsanity_locations = filter_disabled_locations(options, craftsanity_locations) + filtered_craftsanity_locations = filter_disabled_locations(options, content, craftsanity_locations) randomized_locations.extend(filtered_craftsanity_locations) @@ -467,7 +467,7 @@ def create_locations(location_collector: StardewLocationCollector, random: Random): randomized_locations = [] - extend_mandatory_locations(randomized_locations, options) + extend_mandatory_locations(randomized_locations, options, content) extend_bundle_locations(randomized_locations, bundle_rooms) extend_backpack_locations(randomized_locations, options) @@ -476,13 +476,12 @@ def create_locations(location_collector: StardewLocationCollector, extend_elevator_locations(randomized_locations, options) - if not options.skill_progression == SkillProgression.option_vanilla: - for location in locations_by_tag[LocationTags.SKILL_LEVEL]: - if location.mod_name is not None and location.mod_name not in options.mods: - continue - if LocationTags.MASTERY_LEVEL in location.tags and options.skill_progression != SkillProgression.option_progressive_with_masteries: - continue - randomized_locations.append(location_table[location.name]) + skill_progression = content.features.skill_progression + if skill_progression.is_progressive: + for skill in content.skills.values(): + randomized_locations.extend([location_table[location_name] for _, location_name in skill_progression.get_randomized_level_names_by_level(skill)]) + if skill_progression.is_mastery_randomized(skill): + randomized_locations.append(location_table[skill.mastery_name]) if options.building_progression & BuildingProgression.option_progressive: for location in locations_by_tag[LocationTags.BUILDING_BLUEPRINT]: @@ -501,15 +500,15 @@ def create_locations(location_collector: StardewLocationCollector, extend_friendsanity_locations(randomized_locations, content) extend_festival_locations(randomized_locations, options, random) - extend_special_order_locations(randomized_locations, options) + extend_special_order_locations(randomized_locations, options, content) extend_walnut_purchase_locations(randomized_locations, options) - extend_monstersanity_locations(randomized_locations, options) - extend_shipsanity_locations(randomized_locations, options) - extend_cooksanity_locations(randomized_locations, options) - extend_chefsanity_locations(randomized_locations, options) - extend_craftsanity_locations(randomized_locations, options) - extend_quests_locations(randomized_locations, options) + extend_monstersanity_locations(randomized_locations, options, content) + extend_shipsanity_locations(randomized_locations, options, content) + extend_cooksanity_locations(randomized_locations, options, content) + extend_chefsanity_locations(randomized_locations, options, content) + extend_craftsanity_locations(randomized_locations, options, content) + extend_quests_locations(randomized_locations, options, content) extend_book_locations(randomized_locations, content) extend_walnutsanity_locations(randomized_locations, options) @@ -538,19 +537,21 @@ def filter_qi_order_locations(options: StardewValleyOptions, locations: Iterable return (location for location in locations if include_qi_orders or LocationTags.REQUIRES_QI_ORDERS not in location.tags) -def filter_masteries_locations(options: StardewValleyOptions, locations: Iterable[LocationData]) -> Iterable[LocationData]: - include_masteries = options.skill_progression == SkillProgression.option_progressive_with_masteries - return (location for location in locations if include_masteries or LocationTags.REQUIRES_MASTERIES not in location.tags) +def filter_masteries_locations(content: StardewContent, locations: Iterable[LocationData]) -> Iterable[LocationData]: + # FIXME Remove once recipes are handled by the content packs + if content.features.skill_progression.are_masteries_shuffled: + return locations + return (location for location in locations if LocationTags.REQUIRES_MASTERIES not in location.tags) def filter_modded_locations(options: StardewValleyOptions, locations: Iterable[LocationData]) -> Iterable[LocationData]: return (location for location in locations if location.mod_name is None or location.mod_name in options.mods) -def filter_disabled_locations(options: StardewValleyOptions, locations: Iterable[LocationData]) -> Iterable[LocationData]: +def filter_disabled_locations(options: StardewValleyOptions, content: StardewContent, locations: Iterable[LocationData]) -> Iterable[LocationData]: locations_farm_filter = filter_farm_type(options, locations) locations_island_filter = filter_ginger_island(options, locations_farm_filter) locations_qi_filter = filter_qi_order_locations(options, locations_island_filter) - locations_masteries_filter = filter_masteries_locations(options, locations_qi_filter) + locations_masteries_filter = filter_masteries_locations(content, locations_qi_filter) locations_mod_filter = filter_modded_locations(options, locations_masteries_filter) return locations_mod_filter diff --git a/worlds/stardew_valley/logic/crafting_logic.py b/worlds/stardew_valley/logic/crafting_logic.py index 0403230eee34..28bf0d2af22c 100644 --- a/worlds/stardew_valley/logic/crafting_logic.py +++ b/worlds/stardew_valley/logic/crafting_logic.py @@ -16,7 +16,7 @@ from ..data.recipe_source import CutsceneSource, ShopTradeSource, ArchipelagoSource, LogicSource, SpecialOrderSource, \ FestivalShopSource, QuestSource, StarterSource, ShopSource, SkillSource, MasterySource, FriendshipSource, SkillCraftsanitySource from ..locations import locations_by_tag, LocationTags -from ..options import Craftsanity, SpecialOrderLocations, ExcludeGingerIsland, SkillProgression +from ..options import Craftsanity, SpecialOrderLocations, ExcludeGingerIsland from ..stardew_rule import StardewRule, True_, False_ from ..strings.region_names import Region @@ -101,12 +101,13 @@ def can_craft_everything(self) -> StardewRule: craftsanity_prefix = "Craft " all_recipes_names = [] exclude_island = self.options.exclude_ginger_island == ExcludeGingerIsland.option_true - exclude_masteries = self.options.skill_progression != SkillProgression.option_progressive_with_masteries + exclude_masteries = not self.content.features.skill_progression.are_masteries_shuffled for location in locations_by_tag[LocationTags.CRAFTSANITY]: if not location.name.startswith(craftsanity_prefix): continue if exclude_island and LocationTags.GINGER_ISLAND in location.tags: continue + # FIXME Remove when recipes are in content packs if exclude_masteries and LocationTags.REQUIRES_MASTERIES in location.tags: continue if location.mod_name and location.mod_name not in self.options.mods: diff --git a/worlds/stardew_valley/logic/grind_logic.py b/worlds/stardew_valley/logic/grind_logic.py index e0ac84639d9c..997300ae7a54 100644 --- a/worlds/stardew_valley/logic/grind_logic.py +++ b/worlds/stardew_valley/logic/grind_logic.py @@ -7,7 +7,6 @@ from .received_logic import ReceivedLogicMixin from .region_logic import RegionLogicMixin from .time_logic import TimeLogicMixin -from ..options import Booksanity from ..stardew_rule import StardewRule, HasProgressionPercent from ..strings.book_names import Book from ..strings.craftable_names import Consumable @@ -39,7 +38,7 @@ def can_grind_mystery_boxes(self, quantity: int) -> StardewRule: opening_rule = self.logic.region.can_reach(Region.blacksmith) mystery_box_rule = self.logic.has(Consumable.mystery_box) book_of_mysteries_rule = self.logic.true_ \ - if self.options.booksanity == Booksanity.option_none \ + if not self.content.features.booksanity.is_enabled \ else self.logic.book.has_book_power(Book.book_of_mysteries) # Assuming one box per day, but halved because we don't know how many months have passed before Mr. Qi's Plane Ride. time_rule = self.logic.time.has_lived_months(quantity // 14) diff --git a/worlds/stardew_valley/logic/mine_logic.py b/worlds/stardew_valley/logic/mine_logic.py index 61eba41ffe07..350582ae0dbb 100644 --- a/worlds/stardew_valley/logic/mine_logic.py +++ b/worlds/stardew_valley/logic/mine_logic.py @@ -58,14 +58,19 @@ def can_progress_in_the_mines_from_floor(self, floor: int) -> StardewRule: rules = [] weapon_rule = self.logic.mine.get_weapon_rule_for_floor_tier(tier) rules.append(weapon_rule) + if self.options.tool_progression & ToolProgression.option_progressive: rules.append(self.logic.tool.has_tool(Tool.pickaxe, ToolMaterial.tiers[tier])) - if self.options.skill_progression >= options.SkillProgression.option_progressive: - skill_tier = min(10, max(0, tier * 2)) - rules.append(self.logic.skill.has_level(Skill.combat, skill_tier)) - rules.append(self.logic.skill.has_level(Skill.mining, skill_tier)) + + # No alternative for vanilla because we assume that you will grind the levels in the mines. + if self.content.features.skill_progression.is_progressive: + skill_level = min(10, max(0, tier * 2)) + rules.append(self.logic.skill.has_level(Skill.combat, skill_level)) + rules.append(self.logic.skill.has_level(Skill.mining, skill_level)) + if tier >= 4: rules.append(self.logic.cooking.can_cook()) + return self.logic.and_(*rules) @cache_self1 @@ -82,10 +87,14 @@ def can_progress_in_the_skull_cavern_from_floor(self, floor: int) -> StardewRule rules = [] weapon_rule = self.logic.combat.has_great_weapon rules.append(weapon_rule) + if self.options.tool_progression & ToolProgression.option_progressive: rules.append(self.logic.received("Progressive Pickaxe", min(4, max(0, tier + 2)))) - if self.options.skill_progression >= options.SkillProgression.option_progressive: - skill_tier = min(10, max(0, tier * 2 + 6)) - rules.extend({self.logic.skill.has_level(Skill.combat, skill_tier), - self.logic.skill.has_level(Skill.mining, skill_tier)}) + + # No alternative for vanilla because we assume that you will grind the levels in the mines. + if self.content.features.skill_progression.is_progressive: + skill_level = min(10, max(0, tier * 2 + 6)) + rules.extend((self.logic.skill.has_level(Skill.combat, skill_level), + self.logic.skill.has_level(Skill.mining, skill_level))) + return self.logic.and_(*rules) diff --git a/worlds/stardew_valley/logic/skill_logic.py b/worlds/stardew_valley/logic/skill_logic.py index 17fabca28d95..bc2f6cb1263d 100644 --- a/worlds/stardew_valley/logic/skill_logic.py +++ b/worlds/stardew_valley/logic/skill_logic.py @@ -11,7 +11,6 @@ from .season_logic import SeasonLogicMixin from .time_logic import TimeLogicMixin from .tool_logic import ToolLogicMixin -from .. import options from ..data.harvest import HarvestCropSource from ..mods.logic.magic_logic import MagicLogicMixin from ..mods.logic.mod_skills_levels import get_mod_skill_levels @@ -77,21 +76,21 @@ def has_level(self, skill: str, level: int) -> StardewRule: if level == 0: return true_ - if self.options.skill_progression == options.SkillProgression.option_vanilla: - return self.logic.skill.can_earn_level(skill, level) + if self.content.features.skill_progression.is_progressive: + return self.logic.received(f"{skill} Level", level) - return self.logic.received(f"{skill} Level", level) + return self.logic.skill.can_earn_level(skill, level) def has_previous_level(self, skill: str, level: int) -> StardewRule: assert level > 0, f"There is no level before level 0." if level == 1: return true_ - if self.options.skill_progression == options.SkillProgression.option_vanilla: - months = max(1, level - 1) - return self.logic.time.has_lived_months(months) + if self.content.features.skill_progression.is_progressive: + return self.logic.received(f"{skill} Level", level - 1) - return self.logic.received(f"{skill} Level", level - 1) + months = max(1, level - 1) + return self.logic.time.has_lived_months(months) @cache_self1 def has_farming_level(self, level: int) -> StardewRule: @@ -102,7 +101,7 @@ def has_total_level(self, level: int, allow_modded_skills: bool = False) -> Star if level <= 0: return True_() - if self.options.skill_progression >= options.SkillProgression.option_progressive: + if self.content.features.skill_progression.is_progressive: skills_items = vanilla_skill_items if allow_modded_skills: skills_items += get_mod_skill_levels(self.options.mods) @@ -148,7 +147,7 @@ def can_get_combat_xp(self) -> StardewRule: @cached_property def can_get_fishing_xp(self) -> StardewRule: - if self.options.skill_progression >= options.SkillProgression.option_progressive: + if self.content.features.skill_progression.is_progressive: return self.logic.skill.can_fish() | self.logic.skill.can_crab_pot return self.logic.skill.can_fish() @@ -178,7 +177,9 @@ def can_crab_pot_at(self, region: str) -> StardewRule: @cached_property def can_crab_pot(self) -> StardewRule: crab_pot_rule = self.logic.has(Fishing.bait) - if self.options.skill_progression >= options.SkillProgression.option_progressive: + + # We can't use the same rule if skills are vanilla, because fishing levels are required to crab pot, which is required to get fishing levels... + if self.content.features.skill_progression.is_progressive: crab_pot_rule = crab_pot_rule & self.logic.has(Machine.crab_pot) else: crab_pot_rule = crab_pot_rule & self.logic.skill.can_get_fishing_xp @@ -200,14 +201,14 @@ def can_earn_mastery(self, skill: str) -> StardewRule: return self.logic.skill.can_earn_level(skill, 11) & self.logic.region.can_reach(Region.mastery_cave) def has_mastery(self, skill: str) -> StardewRule: - if self.options.skill_progression == options.SkillProgression.option_progressive_with_masteries: + if self.content.features.skill_progression.are_masteries_shuffled: return self.logic.received(f"{skill} Mastery") return self.logic.skill.can_earn_mastery(skill) @cached_property def can_enter_mastery_cave(self) -> StardewRule: - if self.options.skill_progression == options.SkillProgression.option_progressive_with_masteries: + if self.content.features.skill_progression.are_masteries_shuffled: return self.logic.received(Wallet.mastery_of_the_five_ways) return self.has_any_skills_maxed(included_modded_skills=False) diff --git a/worlds/stardew_valley/mods/logic/deepwoods_logic.py b/worlds/stardew_valley/mods/logic/deepwoods_logic.py index 26704eb7d11b..6e0eadfd5486 100644 --- a/worlds/stardew_valley/mods/logic/deepwoods_logic.py +++ b/worlds/stardew_valley/mods/logic/deepwoods_logic.py @@ -1,6 +1,5 @@ from typing import Union -from ... import options from ...logic.base_logic import BaseLogicMixin, BaseLogic from ...logic.combat_logic import CombatLogicMixin from ...logic.cooking_logic import CookingLogicMixin @@ -45,9 +44,9 @@ def can_reach_woods_depth(self, depth: int) -> StardewRule: self.logic.received(ModTransportation.woods_obelisk)) tier = int(depth / 25) + 1 - if self.options.skill_progression >= options.SkillProgression.option_progressive: - combat_tier = min(10, max(0, tier + 5)) - rules.append(self.logic.skill.has_level(Skill.combat, combat_tier)) + if self.content.features.skill_progression.is_progressive: + combat_level = min(10, max(0, tier + 5)) + rules.append(self.logic.skill.has_level(Skill.combat, combat_level)) return self.logic.and_(*rules) diff --git a/worlds/stardew_valley/mods/logic/skills_logic.py b/worlds/stardew_valley/mods/logic/skills_logic.py index cb12274dc651..ba9d27741807 100644 --- a/worlds/stardew_valley/mods/logic/skills_logic.py +++ b/worlds/stardew_valley/mods/logic/skills_logic.py @@ -13,7 +13,6 @@ from ...logic.relationship_logic import RelationshipLogicMixin from ...logic.tool_logic import ToolLogicMixin from ...mods.mod_data import ModNames -from ...options import SkillProgression from ...stardew_rule import StardewRule, False_, True_, And from ...strings.building_names import Building from ...strings.craftable_names import ModCraftable, ModMachine @@ -37,7 +36,7 @@ def has_mod_level(self, skill: str, level: int) -> StardewRule: if level <= 0: return True_() - if self.options.skill_progression == SkillProgression.option_progressive: + if self.content.features.skill_progression.is_progressive: return self.logic.received(f"{skill} Level", level) return self.can_earn_mod_skill_level(skill, level) @@ -85,13 +84,15 @@ def can_earn_socializing_skill_level(self, level: int) -> StardewRule: def can_earn_archaeology_skill_level(self, level: int) -> StardewRule: shifter_rule = True_() preservation_rule = True_() - if self.options.skill_progression == self.options.skill_progression.option_progressive: + if self.content.features.skill_progression.is_progressive: shifter_rule = self.logic.has(ModCraftable.water_shifter) preservation_rule = self.logic.has(ModMachine.hardwood_preservation_chamber) if level >= 8: - return (self.logic.tool.has_tool(Tool.pan, ToolMaterial.iridium) & self.logic.tool.has_tool(Tool.hoe, ToolMaterial.gold)) & shifter_rule & preservation_rule + tool_rule = self.logic.tool.has_tool(Tool.pan, ToolMaterial.iridium) & self.logic.tool.has_tool(Tool.hoe, ToolMaterial.gold) + return tool_rule & shifter_rule & preservation_rule if level >= 5: - return (self.logic.tool.has_tool(Tool.pan, ToolMaterial.gold) & self.logic.tool.has_tool(Tool.hoe, ToolMaterial.iron)) & shifter_rule + tool_rule = self.logic.tool.has_tool(Tool.pan, ToolMaterial.gold) & self.logic.tool.has_tool(Tool.hoe, ToolMaterial.iron) + return tool_rule & shifter_rule if level >= 3: return self.logic.tool.has_tool(Tool.pan, ToolMaterial.iron) | self.logic.tool.has_tool(Tool.hoe, ToolMaterial.copper) return self.logic.tool.has_tool(Tool.pan, ToolMaterial.copper) | self.logic.tool.has_tool(Tool.hoe, ToolMaterial.basic) diff --git a/worlds/stardew_valley/regions.py b/worlds/stardew_valley/regions.py index 5b7db5ac79d1..d59439a4879d 100644 --- a/worlds/stardew_valley/regions.py +++ b/worlds/stardew_valley/regions.py @@ -2,8 +2,9 @@ from typing import Iterable, Dict, Protocol, List, Tuple, Set from BaseClasses import Region, Entrance +from .content import content_packs, StardewContent from .mods.mod_regions import ModDataList, vanilla_connections_to_remove_by_mod -from .options import EntranceRandomization, ExcludeGingerIsland, StardewValleyOptions, SkillProgression +from .options import EntranceRandomization, ExcludeGingerIsland, StardewValleyOptions from .region_classes import RegionData, ConnectionData, RandomizationFlag, ModificationFlag from .strings.entrance_names import Entrance, LogicEntrance from .strings.region_names import Region, LogicRegion @@ -587,7 +588,7 @@ def modify_vanilla_regions(existing_region: RegionData, modified_region: RegionD return updated_region -def create_regions(region_factory: RegionFactory, random: Random, world_options: StardewValleyOptions) \ +def create_regions(region_factory: RegionFactory, random: Random, world_options: StardewValleyOptions, content: StardewContent) \ -> Tuple[Dict[str, Region], Dict[str, Entrance], Dict[str, str]]: entrances_data, regions_data = create_final_connections_and_regions(world_options) regions_by_name: Dict[str: Region] = {region_name: region_factory(region_name, regions_data[region_name].exits) for region_name in regions_data} @@ -598,7 +599,7 @@ def create_regions(region_factory: RegionFactory, random: Random, world_options: if entrance.name in entrances_data } - connections, randomized_data = randomize_connections(random, world_options, regions_data, entrances_data) + connections, randomized_data = randomize_connections(random, world_options, content, regions_data, entrances_data) for connection in connections: if connection.name in entrances_by_name: @@ -606,7 +607,7 @@ def create_regions(region_factory: RegionFactory, random: Random, world_options: return regions_by_name, entrances_by_name, randomized_data -def randomize_connections(random: Random, world_options: StardewValleyOptions, regions_by_name: Dict[str, RegionData], +def randomize_connections(random: Random, world_options: StardewValleyOptions, content: StardewContent, regions_by_name: Dict[str, RegionData], connections_by_name: Dict[str, ConnectionData]) -> Tuple[List[ConnectionData], Dict[str, str]]: connections_to_randomize: List[ConnectionData] = [] if world_options.entrance_randomization == EntranceRandomization.option_pelican_town: @@ -621,7 +622,7 @@ def randomize_connections(random: Random, world_options: StardewValleyOptions, r elif world_options.entrance_randomization == EntranceRandomization.option_chaos: connections_to_randomize = [connections_by_name[connection] for connection in connections_by_name if RandomizationFlag.BUILDINGS in connections_by_name[connection].flag] - connections_to_randomize = remove_excluded_entrances(connections_to_randomize, world_options) + connections_to_randomize = remove_excluded_entrances(connections_to_randomize, content) # On Chaos, we just add the connections to randomize, unshuffled, and the client does it every day randomized_data_for_mod = {} @@ -630,7 +631,7 @@ def randomize_connections(random: Random, world_options: StardewValleyOptions, r randomized_data_for_mod[connection.reverse] = connection.reverse return list(connections_by_name.values()), randomized_data_for_mod - connections_to_randomize = remove_excluded_entrances(connections_to_randomize, world_options) + connections_to_randomize = remove_excluded_entrances(connections_to_randomize, content) random.shuffle(connections_to_randomize) destination_pool = list(connections_to_randomize) random.shuffle(destination_pool) @@ -645,12 +646,11 @@ def randomize_connections(random: Random, world_options: StardewValleyOptions, r return randomized_connections_for_generation, randomized_data_for_mod -def remove_excluded_entrances(connections_to_randomize: List[ConnectionData], world_options: StardewValleyOptions) -> List[ConnectionData]: - exclude_island = world_options.exclude_ginger_island == ExcludeGingerIsland.option_true - if exclude_island: +def remove_excluded_entrances(connections_to_randomize: List[ConnectionData], content: StardewContent) -> List[ConnectionData]: + # FIXME remove when regions are handled in content packs + if content_packs.ginger_island_content_pack.name not in content.registered_packs: connections_to_randomize = [connection for connection in connections_to_randomize if RandomizationFlag.GINGER_ISLAND not in connection.flag] - exclude_masteries = world_options.skill_progression != SkillProgression.option_progressive_with_masteries - if exclude_masteries: + if not content.features.skill_progression.are_masteries_shuffled: connections_to_randomize = [connection for connection in connections_to_randomize if RandomizationFlag.MASTERIES not in connection.flag] return connections_to_randomize diff --git a/worlds/stardew_valley/rules.py b/worlds/stardew_valley/rules.py index e7107e89f948..96f081788041 100644 --- a/worlds/stardew_valley/rules.py +++ b/worlds/stardew_valley/rules.py @@ -21,7 +21,7 @@ from .mods.mod_data import ModNames from .options import StardewValleyOptions, Walnutsanity from .options import ToolProgression, BuildingProgression, ExcludeGingerIsland, SpecialOrderLocations, Museumsanity, BackpackProgression, Shipsanity, \ - Monstersanity, Chefsanity, Craftsanity, ArcadeMachineLocations, Cooksanity, SkillProgression + Monstersanity, Chefsanity, Craftsanity, ArcadeMachineLocations, Cooksanity from .stardew_rule import And, StardewRule, true_ from .stardew_rule.indirect_connection import look_for_indirect_connection from .stardew_rule.rule_explain import explain @@ -47,7 +47,7 @@ from .strings.quest_names import Quest from .strings.region_names import Region from .strings.season_names import Season -from .strings.skill_names import ModSkill, Skill +from .strings.skill_names import Skill from .strings.tool_names import Tool, ToolMaterial from .strings.tv_channel_names import Channel from .strings.villager_names import NPC, ModNPC @@ -70,7 +70,7 @@ def set_rules(world): set_ginger_island_rules(logic, multiworld, player, world_options) set_tool_rules(logic, multiworld, player, world_options) - set_skills_rules(logic, multiworld, player, world_options) + set_skills_rules(logic, multiworld, player, world_content) set_bundle_rules(bundle_rooms, logic, multiworld, player, world_options) set_building_rules(logic, multiworld, player, world_options) set_cropsanity_rules(logic, multiworld, player, world_content) @@ -164,58 +164,21 @@ def set_bundle_rules(bundle_rooms: List[BundleRoom], logic: StardewLogic, multiw MultiWorldRules.add_rule(multiworld.get_location(room_location, player), And(*room_rules)) -def set_skills_rules(logic: StardewLogic, multiworld, player, world_options: StardewValleyOptions): - mods = world_options.mods - if world_options.skill_progression == SkillProgression.option_vanilla: +def set_skills_rules(logic: StardewLogic, multiworld: MultiWorld, player: int, content: StardewContent): + skill_progression = content.features.skill_progression + if not skill_progression.is_progressive: return - for i in range(1, 11): - set_vanilla_skill_rule_for_level(logic, multiworld, player, i) - set_modded_skill_rule_for_level(logic, multiworld, player, mods, i) + for skill in content.skills.values(): + for level, level_name in skill_progression.get_randomized_level_names_by_level(skill): + rule = logic.skill.can_earn_level(skill.name, level) + location = multiworld.get_location(level_name, player) + MultiWorldRules.set_rule(location, rule) - if world_options.skill_progression == SkillProgression.option_progressive: - return - - for skill in [Skill.farming, Skill.fishing, Skill.foraging, Skill.mining, Skill.combat]: - MultiWorldRules.set_rule(multiworld.get_location(f"{skill} Mastery", player), logic.skill.can_earn_mastery(skill)) - - -def set_vanilla_skill_rule_for_level(logic: StardewLogic, multiworld, player, level: int): - set_vanilla_skill_rule(logic, multiworld, player, Skill.farming, level) - set_vanilla_skill_rule(logic, multiworld, player, Skill.fishing, level) - set_vanilla_skill_rule(logic, multiworld, player, Skill.foraging, level) - set_vanilla_skill_rule(logic, multiworld, player, Skill.mining, level) - set_vanilla_skill_rule(logic, multiworld, player, Skill.combat, level) - - -def set_modded_skill_rule_for_level(logic: StardewLogic, multiworld, player, mods, level: int): - if ModNames.luck_skill in mods: - set_modded_skill_rule(logic, multiworld, player, ModSkill.luck, level) - if ModNames.magic in mods: - set_modded_skill_rule(logic, multiworld, player, ModSkill.magic, level) - if ModNames.binning_skill in mods: - set_modded_skill_rule(logic, multiworld, player, ModSkill.binning, level) - if ModNames.cooking_skill in mods: - set_modded_skill_rule(logic, multiworld, player, ModSkill.cooking, level) - if ModNames.socializing_skill in mods: - set_modded_skill_rule(logic, multiworld, player, ModSkill.socializing, level) - if ModNames.archaeology in mods: - set_modded_skill_rule(logic, multiworld, player, ModSkill.archaeology, level) - - -def get_skill_level_location(multiworld, player, skill: str, level: int): - location_name = f"Level {level} {skill}" - return multiworld.get_location(location_name, player) - - -def set_vanilla_skill_rule(logic: StardewLogic, multiworld, player, skill: str, level: int): - rule = logic.skill.can_earn_level(skill, level) - MultiWorldRules.set_rule(get_skill_level_location(multiworld, player, skill, level), rule) - - -def set_modded_skill_rule(logic: StardewLogic, multiworld, player, skill: str, level: int): - rule = logic.skill.can_earn_level(skill, level) - MultiWorldRules.set_rule(get_skill_level_location(multiworld, player, skill, level), rule) + if skill_progression.is_mastery_randomized(skill): + rule = logic.skill.can_earn_mastery(skill.name) + location = multiworld.get_location(skill.mastery_name, player) + MultiWorldRules.set_rule(location, rule) def set_entrance_rules(logic: StardewLogic, multiworld, player, world_options: StardewValleyOptions): diff --git a/worlds/stardew_valley/stardew_rule/base.py b/worlds/stardew_valley/stardew_rule/base.py index 3e6eb327ea99..af4c3c35330d 100644 --- a/worlds/stardew_valley/stardew_rule/base.py +++ b/worlds/stardew_valley/stardew_rule/base.py @@ -293,7 +293,7 @@ def __repr__(self): def __eq__(self, other): return (isinstance(other, type(self)) and self.combinable_rules == other.combinable_rules and - self.simplification_state.original_simplifiable_rules == self.simplification_state.original_simplifiable_rules) + self.simplification_state.original_simplifiable_rules == other.simplification_state.original_simplifiable_rules) def __hash__(self): if len(self.combinable_rules) + len(self.simplification_state.original_simplifiable_rules) > 5: diff --git a/worlds/stardew_valley/stardew_rule/state.py b/worlds/stardew_valley/stardew_rule/state.py index 5f5e61b3d4e5..6fc349a6274d 100644 --- a/worlds/stardew_valley/stardew_rule/state.py +++ b/worlds/stardew_valley/stardew_rule/state.py @@ -1,10 +1,13 @@ from dataclasses import dataclass -from typing import Iterable, Union, List, Tuple, Hashable +from typing import Iterable, Union, List, Tuple, Hashable, TYPE_CHECKING from BaseClasses import CollectionState from .base import BaseStardewRule, CombinableStardewRule from .protocol import StardewRule +if TYPE_CHECKING: + from .. import StardewValleyWorld + class TotalReceived(BaseStardewRule): count: int @@ -102,16 +105,19 @@ def value(self): return self.percent def __call__(self, state: CollectionState) -> bool: - stardew_world = state.multiworld.worlds[self.player] + stardew_world: "StardewValleyWorld" = state.multiworld.worlds[self.player] total_count = stardew_world.total_progression_items needed_count = (total_count * self.percent) // 100 player_state = state.prog_items[self.player] - if needed_count <= len(player_state): + if needed_count <= len(player_state) - len(stardew_world.excluded_from_total_progression_items): return True total_count = 0 for item, item_count in player_state.items(): + if item in stardew_world.excluded_from_total_progression_items: + continue + total_count += item_count if total_count >= needed_count: return True diff --git a/worlds/stardew_valley/test/TestCrops.py b/worlds/stardew_valley/test/TestCrops.py index 362e6bf27e7c..4fa836a97d14 100644 --- a/worlds/stardew_valley/test/TestCrops.py +++ b/worlds/stardew_valley/test/TestCrops.py @@ -11,10 +11,10 @@ def test_need_greenhouse_for_cactus(self): harvest_cactus = self.world.logic.region.can_reach_location("Harvest Cactus Fruit") self.assert_rule_false(harvest_cactus, self.multiworld.state) - self.multiworld.state.collect(self.world.create_item("Cactus Seeds"), prevent_sweep=False) - self.multiworld.state.collect(self.world.create_item("Shipping Bin"), prevent_sweep=False) - self.multiworld.state.collect(self.world.create_item("Desert Obelisk"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Cactus Seeds")) + self.multiworld.state.collect(self.create_item("Shipping Bin")) + self.multiworld.state.collect(self.create_item("Desert Obelisk")) self.assert_rule_false(harvest_cactus, self.multiworld.state) - self.multiworld.state.collect(self.world.create_item("Greenhouse"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Greenhouse")) self.assert_rule_true(harvest_cactus, self.multiworld.state) diff --git a/worlds/stardew_valley/test/TestOptions.py b/worlds/stardew_valley/test/TestOptions.py index 2824a10c38af..9db7f06ff5a5 100644 --- a/worlds/stardew_valley/test/TestOptions.py +++ b/worlds/stardew_valley/test/TestOptions.py @@ -1,6 +1,6 @@ import itertools -from Options import NamedRange +from Options import NamedRange, Accessibility from . import SVTestCase, allsanity_no_mods_6_x_x, allsanity_mods_6_x_x, solo_multiworld from .assertion import WorldAssertMixin from .long.option_names import all_option_choices @@ -54,6 +54,23 @@ def test_given_goal_when_generate_then_victory_is_in_correct_location(self): victory = multi_world.find_item("Victory", 1) self.assertEqual(victory.name, location) + def test_given_perfection_goal_when_generate_then_accessibility_is_forced_to_full(self): + """There is a bug with the current victory condition of the perfection goal that can create unwinnable seeds if the accessibility is set to minimal and + the world gets flooded with progression items through plando. This will increase the amount of collected progression items pass the total amount + calculated for the world when creating the item pool. This will cause the victory condition to be met before all locations are collected, so some could + be left inaccessible, which in practice will make the seed unwinnable. + """ + for accessibility in Accessibility.options.keys(): + world_options = {Goal.internal_name: Goal.option_perfection, "accessibility": accessibility} + with self.solo_world_sub_test(f"Accessibility: {accessibility}", world_options) as (_, world): + self.assertEqual(world.options.accessibility, Accessibility.option_full) + + def test_given_allsanity_goal_when_generate_then_accessibility_is_forced_to_full(self): + for accessibility in Accessibility.options.keys(): + world_options = {Goal.internal_name: Goal.option_allsanity, "accessibility": accessibility} + with self.solo_world_sub_test(f"Accessibility: {accessibility}", world_options) as (_, world): + self.assertEqual(world.options.accessibility, Accessibility.option_full) + class TestSeasonRandomization(SVTestCase): def test_given_disabled_when_generate_then_all_seasons_are_precollected(self): diff --git a/worlds/stardew_valley/test/TestRegions.py b/worlds/stardew_valley/test/TestRegions.py index a25feea22085..c2e962d88a7e 100644 --- a/worlds/stardew_valley/test/TestRegions.py +++ b/worlds/stardew_valley/test/TestRegions.py @@ -4,6 +4,7 @@ from BaseClasses import get_seed from . import SVTestCase, complete_options_with_default +from .. import create_content from ..options import EntranceRandomization, ExcludeGingerIsland, SkillProgression from ..regions import vanilla_regions, vanilla_connections, randomize_connections, RandomizationFlag, create_final_connections_and_regions from ..strings.entrance_names import Entrance as EntranceName @@ -63,11 +64,12 @@ def test_entrance_randomization(self): ExcludeGingerIsland.internal_name: ExcludeGingerIsland.option_false, SkillProgression.internal_name: SkillProgression.option_progressive_with_masteries, }) + content = create_content(sv_options) seed = get_seed() rand = random.Random(seed) with self.subTest(flag=flag, msg=f"Seed: {seed}"): entrances, regions = create_final_connections_and_regions(sv_options) - _, randomized_connections = randomize_connections(rand, sv_options, regions, entrances) + _, randomized_connections = randomize_connections(rand, sv_options, content, regions, entrances) for connection in vanilla_connections: if flag in connection.flag: @@ -90,11 +92,12 @@ def test_entrance_randomization_without_island(self): ExcludeGingerIsland.internal_name: ExcludeGingerIsland.option_true, SkillProgression.internal_name: SkillProgression.option_progressive_with_masteries, }) + content = create_content(sv_options) seed = get_seed() rand = random.Random(seed) with self.subTest(option=option, flag=flag, seed=seed): entrances, regions = create_final_connections_and_regions(sv_options) - _, randomized_connections = randomize_connections(rand, sv_options, regions, entrances) + _, randomized_connections = randomize_connections(rand, sv_options, content, regions, entrances) for connection in vanilla_connections: if flag in connection.flag: @@ -118,13 +121,14 @@ def test_cannot_put_island_access_on_island(self): ExcludeGingerIsland.internal_name: ExcludeGingerIsland.option_false, SkillProgression.internal_name: SkillProgression.option_progressive_with_masteries, }) + content = create_content(sv_options) for i in range(0, 100 if self.skip_long_tests else 10000): seed = get_seed() rand = random.Random(seed) with self.subTest(msg=f"Seed: {seed}"): entrances, regions = create_final_connections_and_regions(sv_options) - randomized_connections, randomized_data = randomize_connections(rand, sv_options, regions, entrances) + randomized_connections, randomized_data = randomize_connections(rand, sv_options, content, regions, entrances) connections_by_name = {connection.name: connection for connection in randomized_connections} blocked_entrances = {EntranceName.use_island_obelisk, EntranceName.boat_to_ginger_island} diff --git a/worlds/stardew_valley/test/__init__.py b/worlds/stardew_valley/test/__init__.py index 8f4e5af28f84..1a312e569d11 100644 --- a/worlds/stardew_valley/test/__init__.py +++ b/worlds/stardew_valley/test/__init__.py @@ -6,7 +6,7 @@ from contextlib import contextmanager from typing import Dict, ClassVar, Iterable, Tuple, Optional, List, Union, Any -from BaseClasses import MultiWorld, CollectionState, PlandoOptions, get_seed, Location, Item, ItemClassification +from BaseClasses import MultiWorld, CollectionState, PlandoOptions, get_seed, Location, Item from Options import VerifyKeys from test.bases import WorldTestBase from test.general import gen_steps, setup_solo_multiworld as setup_base_solo_multiworld @@ -236,7 +236,6 @@ def world_setup(self, *args, **kwargs): self.original_state = self.multiworld.state.copy() self.original_itempool = self.multiworld.itempool.copy() - self.original_prog_item_count = world.total_progression_items self.unfilled_locations = self.multiworld.get_unfilled_locations(1) if self.constructed: self.world = world # noqa @@ -246,7 +245,6 @@ def tearDown(self) -> None: self.multiworld.itempool = self.original_itempool for location in self.unfilled_locations: location.item = None - self.world.total_progression_items = self.original_prog_item_count self.multiworld.lock.release() @@ -257,20 +255,13 @@ def run_default_tests(self) -> bool: return super().run_default_tests def collect_lots_of_money(self, percent: float = 0.25): - self.multiworld.state.collect(self.world.create_item("Shipping Bin"), prevent_sweep=False) - real_total_prog_items = self.multiworld.worlds[self.player].total_progression_items + self.collect("Shipping Bin") + real_total_prog_items = self.world.total_progression_items required_prog_items = int(round(real_total_prog_items * percent)) - for i in range(required_prog_items): - self.multiworld.state.collect(self.world.create_item("Stardrop"), prevent_sweep=False) - self.multiworld.worlds[self.player].total_progression_items = real_total_prog_items + self.collect("Stardrop", required_prog_items) def collect_all_the_money(self): - self.multiworld.state.collect(self.world.create_item("Shipping Bin"), prevent_sweep=False) - real_total_prog_items = self.multiworld.worlds[self.player].total_progression_items - required_prog_items = int(round(real_total_prog_items * 0.95)) - for i in range(required_prog_items): - self.multiworld.state.collect(self.world.create_item("Stardrop"), prevent_sweep=False) - self.multiworld.worlds[self.player].total_progression_items = real_total_prog_items + self.collect_lots_of_money(0.95) def collect_everything(self): non_event_items = [item for item in self.multiworld.get_items() if item.code] @@ -278,7 +269,8 @@ def collect_everything(self): self.multiworld.state.collect(item) def collect_all_except(self, item_to_not_collect: str): - for item in self.multiworld.get_items(): + non_event_items = [item for item in self.multiworld.get_items() if item.code] + for item in non_event_items: if item.name != item_to_not_collect: self.multiworld.state.collect(item) @@ -290,25 +282,26 @@ def get_real_location_names(self) -> List[str]: def collect(self, item: Union[str, Item, Iterable[Item]], count: int = 1) -> Union[None, Item, List[Item]]: assert count > 0 + if not isinstance(item, str): super().collect(item) return + if count == 1: item = self.create_item(item) self.multiworld.state.collect(item) return item + items = [] for i in range(count): item = self.create_item(item) self.multiworld.state.collect(item) items.append(item) + return items def create_item(self, item: str) -> StardewItem: - created_item = self.world.create_item(item) - if created_item.classification & ItemClassification.progression: - self.multiworld.worlds[self.player].total_progression_items -= 1 - return created_item + return self.world.create_item(item) def remove_one_by_name(self, item: str) -> None: self.remove(self.create_item(item)) @@ -336,7 +329,6 @@ def solo_multiworld(world_options: Optional[Dict[Union[str, StardewValleyOption] original_state = multiworld.state.copy() original_itempool = multiworld.itempool.copy() unfilled_locations = multiworld.get_unfilled_locations(1) - original_prog_item_count = world.total_progression_items yield multiworld, world @@ -344,7 +336,6 @@ def solo_multiworld(world_options: Optional[Dict[Union[str, StardewValleyOption] multiworld.itempool = original_itempool for location in unfilled_locations: location.item = None - multiworld.total_progression_items = original_prog_item_count multiworld.lock.release() diff --git a/worlds/stardew_valley/test/content/__init__.py b/worlds/stardew_valley/test/content/__init__.py index 4130dae90dc3..c666a3aae14d 100644 --- a/worlds/stardew_valley/test/content/__init__.py +++ b/worlds/stardew_valley/test/content/__init__.py @@ -7,7 +7,8 @@ feature.booksanity.BooksanityDisabled(), feature.cropsanity.CropsanityDisabled(), feature.fishsanity.FishsanityNone(), - feature.friendsanity.FriendsanityNone() + feature.friendsanity.FriendsanityNone(), + feature.skill_progression.SkillProgressionVanilla(), ) diff --git a/worlds/stardew_valley/test/mods/TestMods.py b/worlds/stardew_valley/test/mods/TestMods.py index 07a75f21b1de..56138cf582a7 100644 --- a/worlds/stardew_valley/test/mods/TestMods.py +++ b/worlds/stardew_valley/test/mods/TestMods.py @@ -3,7 +3,7 @@ from BaseClasses import get_seed from .. import SVTestBase, SVTestCase, allsanity_no_mods_6_x_x, allsanity_mods_6_x_x, complete_options_with_default, solo_multiworld from ..assertion import ModAssertMixin, WorldAssertMixin -from ... import items, Group, ItemClassification +from ... import items, Group, ItemClassification, create_content from ... import options from ...items import items_by_group from ...options import SkillProgression, Walnutsanity @@ -128,12 +128,13 @@ def test_mod_entrance_randomization(self): SkillProgression.internal_name: SkillProgression.option_progressive_with_masteries, options.Mods.internal_name: frozenset(options.Mods.valid_keys) }) + content = create_content(sv_options) seed = get_seed() rand = random.Random(seed) with self.subTest(option=option, flag=flag, seed=seed): final_connections, final_regions = create_final_connections_and_regions(sv_options) - _, randomized_connections = randomize_connections(rand, sv_options, final_regions, final_connections) + _, randomized_connections = randomize_connections(rand, sv_options, content, final_regions, final_connections) for connection_name in final_connections: connection = final_connections[connection_name] diff --git a/worlds/stardew_valley/test/rules/TestArcades.py b/worlds/stardew_valley/test/rules/TestArcades.py index 2922ecfb5d9e..69e5b22cc01b 100644 --- a/worlds/stardew_valley/test/rules/TestArcades.py +++ b/worlds/stardew_valley/test/rules/TestArcades.py @@ -19,8 +19,8 @@ def test_prairie_king(self): life = self.create_item("JotPK: Extra Life") drop = self.create_item("JotPK: Increased Drop Rate") - self.multiworld.state.collect(boots, prevent_sweep=True) - self.multiworld.state.collect(gun, prevent_sweep=True) + self.multiworld.state.collect(boots) + self.multiworld.state.collect(gun) self.assertTrue(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state)) self.assertFalse(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state)) self.assertFalse(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state)) @@ -28,8 +28,8 @@ def test_prairie_king(self): self.remove(boots) self.remove(gun) - self.multiworld.state.collect(boots, prevent_sweep=True) - self.multiworld.state.collect(boots, prevent_sweep=True) + self.multiworld.state.collect(boots) + self.multiworld.state.collect(boots) self.assertTrue(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state)) self.assertFalse(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state)) self.assertFalse(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state)) @@ -37,10 +37,10 @@ def test_prairie_king(self): self.remove(boots) self.remove(boots) - self.multiworld.state.collect(boots, prevent_sweep=True) - self.multiworld.state.collect(gun, prevent_sweep=True) - self.multiworld.state.collect(ammo, prevent_sweep=True) - self.multiworld.state.collect(life, prevent_sweep=True) + self.multiworld.state.collect(boots) + self.multiworld.state.collect(gun) + self.multiworld.state.collect(ammo) + self.multiworld.state.collect(life) self.assertTrue(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state)) self.assertTrue(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state)) self.assertFalse(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state)) @@ -50,13 +50,13 @@ def test_prairie_king(self): self.remove(ammo) self.remove(life) - self.multiworld.state.collect(boots, prevent_sweep=True) - self.multiworld.state.collect(gun, prevent_sweep=True) - self.multiworld.state.collect(gun, prevent_sweep=True) - self.multiworld.state.collect(ammo, prevent_sweep=True) - self.multiworld.state.collect(ammo, prevent_sweep=True) - self.multiworld.state.collect(life, prevent_sweep=True) - self.multiworld.state.collect(drop, prevent_sweep=True) + self.multiworld.state.collect(boots) + self.multiworld.state.collect(gun) + self.multiworld.state.collect(gun) + self.multiworld.state.collect(ammo) + self.multiworld.state.collect(ammo) + self.multiworld.state.collect(life) + self.multiworld.state.collect(drop) self.assertTrue(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state)) self.assertTrue(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state)) self.assertTrue(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state)) @@ -69,17 +69,17 @@ def test_prairie_king(self): self.remove(life) self.remove(drop) - self.multiworld.state.collect(boots, prevent_sweep=True) - self.multiworld.state.collect(boots, prevent_sweep=True) - self.multiworld.state.collect(gun, prevent_sweep=True) - self.multiworld.state.collect(gun, prevent_sweep=True) - self.multiworld.state.collect(gun, prevent_sweep=True) - self.multiworld.state.collect(gun, prevent_sweep=True) - self.multiworld.state.collect(ammo, prevent_sweep=True) - self.multiworld.state.collect(ammo, prevent_sweep=True) - self.multiworld.state.collect(ammo, prevent_sweep=True) - self.multiworld.state.collect(life, prevent_sweep=True) - self.multiworld.state.collect(drop, prevent_sweep=True) + self.multiworld.state.collect(boots) + self.multiworld.state.collect(boots) + self.multiworld.state.collect(gun) + self.multiworld.state.collect(gun) + self.multiworld.state.collect(gun) + self.multiworld.state.collect(gun) + self.multiworld.state.collect(ammo) + self.multiworld.state.collect(ammo) + self.multiworld.state.collect(ammo) + self.multiworld.state.collect(life) + self.multiworld.state.collect(drop) self.assertTrue(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state)) self.assertTrue(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state)) self.assertTrue(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state)) diff --git a/worlds/stardew_valley/test/rules/TestBuildings.py b/worlds/stardew_valley/test/rules/TestBuildings.py index cacd6ea381b6..d1f60b20e0db 100644 --- a/worlds/stardew_valley/test/rules/TestBuildings.py +++ b/worlds/stardew_valley/test/rules/TestBuildings.py @@ -23,7 +23,7 @@ def test_big_coop_blueprint(self): self.assertFalse(big_coop_blueprint_rule(self.multiworld.state), f"Rule is {repr(self.multiworld.get_location('Big Coop Blueprint', self.player).access_rule)}") - self.multiworld.state.collect(self.create_item("Progressive Coop"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Progressive Coop")) self.assertTrue(big_coop_blueprint_rule(self.multiworld.state), f"Rule is {repr(self.multiworld.get_location('Big Coop Blueprint', self.player).access_rule)}") @@ -33,10 +33,10 @@ def test_deluxe_coop_blueprint(self): self.collect_lots_of_money() self.assertFalse(self.world.logic.region.can_reach_location("Deluxe Coop Blueprint")(self.multiworld.state)) - self.multiworld.state.collect(self.create_item("Progressive Coop"), prevent_sweep=True) + self.multiworld.state.collect(self.create_item("Progressive Coop")) self.assertFalse(self.world.logic.region.can_reach_location("Deluxe Coop Blueprint")(self.multiworld.state)) - self.multiworld.state.collect(self.create_item("Progressive Coop"), prevent_sweep=True) + self.multiworld.state.collect(self.create_item("Progressive Coop")) self.assertTrue(self.world.logic.region.can_reach_location("Deluxe Coop Blueprint")(self.multiworld.state)) def test_big_shed_blueprint(self): @@ -48,6 +48,6 @@ def test_big_shed_blueprint(self): self.assertFalse(big_shed_rule(self.multiworld.state), f"Rule is {repr(self.multiworld.get_location('Big Shed Blueprint', self.player).access_rule)}") - self.multiworld.state.collect(self.create_item("Progressive Shed"), prevent_sweep=True) + self.multiworld.state.collect(self.create_item("Progressive Shed")) self.assertTrue(big_shed_rule(self.multiworld.state), f"Rule is {repr(self.multiworld.get_location('Big Shed Blueprint', self.player).access_rule)}") diff --git a/worlds/stardew_valley/test/rules/TestCookingRecipes.py b/worlds/stardew_valley/test/rules/TestCookingRecipes.py index 7ab9d61cb942..d5f9da73c9d7 100644 --- a/worlds/stardew_valley/test/rules/TestCookingRecipes.py +++ b/worlds/stardew_valley/test/rules/TestCookingRecipes.py @@ -17,14 +17,14 @@ def test_can_learn_qos_recipe(self): rule = self.world.logic.region.can_reach_location(location) self.assert_rule_false(rule, self.multiworld.state) - self.multiworld.state.collect(self.create_item("Progressive House"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Radish Seeds"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Spring"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Summer"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Progressive House")) + self.multiworld.state.collect(self.create_item("Radish Seeds")) + self.multiworld.state.collect(self.create_item("Spring")) + self.multiworld.state.collect(self.create_item("Summer")) self.collect_lots_of_money() self.assert_rule_false(rule, self.multiworld.state) - self.multiworld.state.collect(self.create_item("The Queen of Sauce"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("The Queen of Sauce")) self.assert_rule_true(rule, self.multiworld.state) @@ -42,21 +42,21 @@ def test_can_learn_qos_recipe(self): rule = self.world.logic.region.can_reach_location(location) self.assert_rule_false(rule, self.multiworld.state) - self.multiworld.state.collect(self.create_item("Progressive House"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Radish Seeds"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Summer"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Progressive House")) + self.multiworld.state.collect(self.create_item("Radish Seeds")) + self.multiworld.state.collect(self.create_item("Summer")) self.collect_lots_of_money() self.assert_rule_false(rule, self.multiworld.state) spring = self.create_item("Spring") qos = self.create_item("The Queen of Sauce") - self.multiworld.state.collect(spring, prevent_sweep=False) - self.multiworld.state.collect(qos, prevent_sweep=False) + self.multiworld.state.collect(spring) + self.multiworld.state.collect(qos) self.assert_rule_false(rule, self.multiworld.state) self.multiworld.state.remove(spring) self.multiworld.state.remove(qos) - self.multiworld.state.collect(self.create_item("Radish Salad Recipe"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Radish Salad Recipe")) self.assert_rule_true(rule, self.multiworld.state) def test_get_chefsanity_check_recipe(self): @@ -64,20 +64,20 @@ def test_get_chefsanity_check_recipe(self): rule = self.world.logic.region.can_reach_location(location) self.assert_rule_false(rule, self.multiworld.state) - self.multiworld.state.collect(self.create_item("Spring"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Spring")) self.collect_lots_of_money() self.assert_rule_false(rule, self.multiworld.state) seeds = self.create_item("Radish Seeds") summer = self.create_item("Summer") house = self.create_item("Progressive House") - self.multiworld.state.collect(seeds, prevent_sweep=False) - self.multiworld.state.collect(summer, prevent_sweep=False) - self.multiworld.state.collect(house, prevent_sweep=False) + self.multiworld.state.collect(seeds) + self.multiworld.state.collect(summer) + self.multiworld.state.collect(house) self.assert_rule_false(rule, self.multiworld.state) self.multiworld.state.remove(seeds) self.multiworld.state.remove(summer) self.multiworld.state.remove(house) - self.multiworld.state.collect(self.create_item("The Queen of Sauce"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("The Queen of Sauce")) self.assert_rule_true(rule, self.multiworld.state) diff --git a/worlds/stardew_valley/test/rules/TestCraftingRecipes.py b/worlds/stardew_valley/test/rules/TestCraftingRecipes.py index 4719edea1d59..46a1b73d0b7a 100644 --- a/worlds/stardew_valley/test/rules/TestCraftingRecipes.py +++ b/worlds/stardew_valley/test/rules/TestCraftingRecipes.py @@ -25,7 +25,7 @@ def test_can_craft_recipe(self): self.collect_all_the_money() self.assert_rule_false(rule, self.multiworld.state) - self.multiworld.state.collect(self.create_item("Marble Brazier Recipe"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Marble Brazier Recipe")) self.assert_rule_true(rule, self.multiworld.state) def test_can_learn_crafting_recipe(self): @@ -38,16 +38,16 @@ def test_can_learn_crafting_recipe(self): def test_can_craft_festival_recipe(self): recipe = all_crafting_recipes_by_name["Jack-O-Lantern"] - self.multiworld.state.collect(self.create_item("Pumpkin Seeds"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Torch Recipe"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Pumpkin Seeds")) + self.multiworld.state.collect(self.create_item("Torch Recipe")) self.collect_lots_of_money() rule = self.world.logic.crafting.can_craft(recipe) self.assert_rule_false(rule, self.multiworld.state) - self.multiworld.state.collect(self.create_item("Fall"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Fall")) self.assert_rule_false(rule, self.multiworld.state) - self.multiworld.state.collect(self.create_item("Jack-O-Lantern Recipe"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Jack-O-Lantern Recipe")) self.assert_rule_true(rule, self.multiworld.state) def test_require_furnace_recipe_for_smelting_checks(self): @@ -64,7 +64,7 @@ def test_require_furnace_recipe_for_smelting_checks(self): self.collect_all_the_money() self.assert_rules_false(rules, self.multiworld.state) - self.multiworld.state.collect(self.create_item("Furnace Recipe"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Furnace Recipe")) self.assert_rules_true(rules, self.multiworld.state) @@ -79,16 +79,16 @@ class TestCraftsanityWithFestivalsLogic(SVTestBase): def test_can_craft_festival_recipe(self): recipe = all_crafting_recipes_by_name["Jack-O-Lantern"] - self.multiworld.state.collect(self.create_item("Pumpkin Seeds"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Fall"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Pumpkin Seeds")) + self.multiworld.state.collect(self.create_item("Fall")) self.collect_lots_of_money() rule = self.world.logic.crafting.can_craft(recipe) self.assert_rule_false(rule, self.multiworld.state) - self.multiworld.state.collect(self.create_item("Jack-O-Lantern Recipe"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Jack-O-Lantern Recipe")) self.assert_rule_false(rule, self.multiworld.state) - self.multiworld.state.collect(self.create_item("Torch Recipe"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Torch Recipe")) self.assert_rule_true(rule, self.multiworld.state) @@ -109,7 +109,7 @@ def test_can_craft_recipe(self): def test_can_craft_festival_recipe(self): recipe = all_crafting_recipes_by_name["Jack-O-Lantern"] - self.multiworld.state.collect(self.create_item("Pumpkin Seeds"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Pumpkin Seeds")) self.collect_lots_of_money() rule = self.world.logic.crafting.can_craft(recipe) result = rule(self.multiworld.state) @@ -126,7 +126,7 @@ def test_requires_mining_levels_for_smelting_checks(self): self.collect([self.create_item("Progressive Sword")] * 4) self.collect([self.create_item("Progressive Mine Elevator")] * 24) self.collect([self.create_item("Progressive Trash Can")] * 2) - self.multiworld.state.collect(self.create_item("Furnace Recipe"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Furnace Recipe")) self.collect([self.create_item("Combat Level")] * 10) self.collect([self.create_item("Fishing Level")] * 10) self.collect_all_the_money() @@ -147,11 +147,11 @@ class TestNoCraftsanityWithFestivalsLogic(SVTestBase): def test_can_craft_festival_recipe(self): recipe = all_crafting_recipes_by_name["Jack-O-Lantern"] - self.multiworld.state.collect(self.create_item("Pumpkin Seeds"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Fall"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Pumpkin Seeds")) + self.multiworld.state.collect(self.create_item("Fall")) self.collect_lots_of_money() rule = self.world.logic.crafting.can_craft(recipe) self.assert_rule_false(rule, self.multiworld.state) - self.multiworld.state.collect(self.create_item("Jack-O-Lantern Recipe"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Jack-O-Lantern Recipe")) self.assert_rule_true(rule, self.multiworld.state) diff --git a/worlds/stardew_valley/test/rules/TestDonations.py b/worlds/stardew_valley/test/rules/TestDonations.py index 984a3ebc38b4..3927bd09a48b 100644 --- a/worlds/stardew_valley/test/rules/TestDonations.py +++ b/worlds/stardew_valley/test/rules/TestDonations.py @@ -18,7 +18,7 @@ def test_cannot_make_any_donation_without_museum_access(self): for donation in locations_by_tag[LocationTags.MUSEUM_DONATIONS]: self.assertFalse(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state)) - self.multiworld.state.collect(self.create_item(railroad_item), prevent_sweep=False) + self.multiworld.state.collect(self.create_item(railroad_item)) for donation in locations_by_tag[LocationTags.MUSEUM_DONATIONS]: self.assertTrue(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state)) @@ -39,7 +39,7 @@ def test_cannot_make_any_donation_without_museum_access(self): for donation in donation_locations: self.assertFalse(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state)) - self.multiworld.state.collect(self.create_item(railroad_item), prevent_sweep=False) + self.multiworld.state.collect(self.create_item(railroad_item)) for donation in donation_locations: self.assertTrue(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state)) @@ -58,7 +58,7 @@ def test_cannot_make_any_donation_without_museum_access(self): for donation in locations_by_tag[LocationTags.MUSEUM_MILESTONES]: self.assertFalse(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state)) - self.multiworld.state.collect(self.create_item(railroad_item), prevent_sweep=False) + self.multiworld.state.collect(self.create_item(railroad_item)) for donation in locations_by_tag[LocationTags.MUSEUM_MILESTONES]: self.assertTrue(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state)) diff --git a/worlds/stardew_valley/test/rules/TestFriendship.py b/worlds/stardew_valley/test/rules/TestFriendship.py index fb186ca99480..3e9109ed5010 100644 --- a/worlds/stardew_valley/test/rules/TestFriendship.py +++ b/worlds/stardew_valley/test/rules/TestFriendship.py @@ -11,34 +11,34 @@ class TestFriendsanityDatingRules(SVTestBase): def test_earning_dating_heart_requires_dating(self): self.collect_all_the_money() - self.multiworld.state.collect(self.create_item("Fall"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Beach Bridge"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Progressive House"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Fall")) + self.multiworld.state.collect(self.create_item("Beach Bridge")) + self.multiworld.state.collect(self.create_item("Progressive House")) for i in range(3): - self.multiworld.state.collect(self.create_item("Progressive Pickaxe"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Progressive Weapon"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Progressive Axe"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Progressive Barn"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Progressive Pickaxe")) + self.multiworld.state.collect(self.create_item("Progressive Weapon")) + self.multiworld.state.collect(self.create_item("Progressive Axe")) + self.multiworld.state.collect(self.create_item("Progressive Barn")) for i in range(10): - self.multiworld.state.collect(self.create_item("Foraging Level"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Farming Level"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Mining Level"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Combat Level"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Progressive Mine Elevator"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Progressive Mine Elevator"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Foraging Level")) + self.multiworld.state.collect(self.create_item("Farming Level")) + self.multiworld.state.collect(self.create_item("Mining Level")) + self.multiworld.state.collect(self.create_item("Combat Level")) + self.multiworld.state.collect(self.create_item("Progressive Mine Elevator")) + self.multiworld.state.collect(self.create_item("Progressive Mine Elevator")) npc = "Abigail" heart_name = f"{npc} <3" step = 3 self.assert_can_reach_heart_up_to(npc, 3, step) - self.multiworld.state.collect(self.create_item(heart_name), prevent_sweep=False) + self.multiworld.state.collect(self.create_item(heart_name)) self.assert_can_reach_heart_up_to(npc, 6, step) - self.multiworld.state.collect(self.create_item(heart_name), prevent_sweep=False) + self.multiworld.state.collect(self.create_item(heart_name)) self.assert_can_reach_heart_up_to(npc, 8, step) - self.multiworld.state.collect(self.create_item(heart_name), prevent_sweep=False) + self.multiworld.state.collect(self.create_item(heart_name)) self.assert_can_reach_heart_up_to(npc, 10, step) - self.multiworld.state.collect(self.create_item(heart_name), prevent_sweep=False) + self.multiworld.state.collect(self.create_item(heart_name)) self.assert_can_reach_heart_up_to(npc, 14, step) def assert_can_reach_heart_up_to(self, npc: str, max_reachable: int, step: int): diff --git a/worlds/stardew_valley/test/rules/TestShipping.py b/worlds/stardew_valley/test/rules/TestShipping.py index 973d8d3ada7d..b26d1e94ee2c 100644 --- a/worlds/stardew_valley/test/rules/TestShipping.py +++ b/worlds/stardew_valley/test/rules/TestShipping.py @@ -76,7 +76,7 @@ def test_all_shipsanity_locations_require_shipping_bin(self): with self.subTest(location.name): self.remove(bin_item) self.assertFalse(self.world.logic.region.can_reach_location(location.name)(self.multiworld.state)) - self.multiworld.state.collect(bin_item, prevent_sweep=False) + self.multiworld.state.collect(bin_item) shipsanity_rule = self.world.logic.region.can_reach_location(location.name) self.assert_rule_true(shipsanity_rule, self.multiworld.state) self.remove(bin_item) diff --git a/worlds/stardew_valley/test/rules/TestStateRules.py b/worlds/stardew_valley/test/rules/TestStateRules.py index 7d10f4ceb1d3..49577d2223e0 100644 --- a/worlds/stardew_valley/test/rules/TestStateRules.py +++ b/worlds/stardew_valley/test/rules/TestStateRules.py @@ -1,12 +1,22 @@ -import unittest +from .. import SVTestBase, allsanity_mods_6_x_x +from ...stardew_rule import HasProgressionPercent -from BaseClasses import ItemClassification -from ...test import solo_multiworld +class TestHasProgressionPercentWithVictory(SVTestBase): + options = allsanity_mods_6_x_x() -class TestHasProgressionPercent(unittest.TestCase): - def test_max_item_amount_is_full_collection(self): - # Not caching because it fails too often for some reason - with solo_multiworld(world_caching=False) as (multiworld, world): - progression_item_count = sum(1 for i in multiworld.get_items() if i.classification & ItemClassification.progression) - self.assertEqual(world.total_progression_items, progression_item_count - 1) # -1 to skip Victory + def test_has_100_progression_percent_is_false_while_items_are_missing(self): + has_100_progression_percent = HasProgressionPercent(1, 100) + + for i, item in enumerate([i for i in self.multiworld.get_items() if i.advancement and i.code][1:]): + if item.name != "Victory": + self.collect(item) + self.assertFalse(has_100_progression_percent(self.multiworld.state), + f"Rule became true after {i} items, total_progression_items is {self.world.total_progression_items}") + + def test_has_100_progression_percent_account_for_victory_not_being_collected(self): + has_100_progression_percent = HasProgressionPercent(1, 100) + + self.collect_all_except("Victory") + + self.assert_rule_true(has_100_progression_percent, self.multiworld.state) diff --git a/worlds/stardew_valley/test/rules/TestTools.py b/worlds/stardew_valley/test/rules/TestTools.py index 5f0fe8ef3ffb..5b8975f4e707 100644 --- a/worlds/stardew_valley/test/rules/TestTools.py +++ b/worlds/stardew_valley/test/rules/TestTools.py @@ -21,30 +21,30 @@ def test_sturgeon(self): self.assert_rule_false(sturgeon_rule, self.multiworld.state) summer = self.create_item("Summer") - self.multiworld.state.collect(summer, prevent_sweep=False) + self.multiworld.state.collect(summer) self.assert_rule_false(sturgeon_rule, self.multiworld.state) fishing_rod = self.create_item("Progressive Fishing Rod") - self.multiworld.state.collect(fishing_rod, prevent_sweep=False) - self.multiworld.state.collect(fishing_rod, prevent_sweep=False) + self.multiworld.state.collect(fishing_rod) + self.multiworld.state.collect(fishing_rod) self.assert_rule_false(sturgeon_rule, self.multiworld.state) fishing_level = self.create_item("Fishing Level") - self.multiworld.state.collect(fishing_level, prevent_sweep=False) + self.multiworld.state.collect(fishing_level) self.assert_rule_false(sturgeon_rule, self.multiworld.state) - self.multiworld.state.collect(fishing_level, prevent_sweep=False) - self.multiworld.state.collect(fishing_level, prevent_sweep=False) - self.multiworld.state.collect(fishing_level, prevent_sweep=False) - self.multiworld.state.collect(fishing_level, prevent_sweep=False) - self.multiworld.state.collect(fishing_level, prevent_sweep=False) + self.multiworld.state.collect(fishing_level) + self.multiworld.state.collect(fishing_level) + self.multiworld.state.collect(fishing_level) + self.multiworld.state.collect(fishing_level) + self.multiworld.state.collect(fishing_level) self.assert_rule_true(sturgeon_rule, self.multiworld.state) self.remove(summer) self.assert_rule_false(sturgeon_rule, self.multiworld.state) winter = self.create_item("Winter") - self.multiworld.state.collect(winter, prevent_sweep=False) + self.multiworld.state.collect(winter) self.assert_rule_true(sturgeon_rule, self.multiworld.state) self.remove(fishing_rod) @@ -53,24 +53,24 @@ def test_sturgeon(self): def test_old_master_cannoli(self): self.multiworld.state.prog_items = {1: Counter()} - self.multiworld.state.collect(self.create_item("Progressive Axe"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Progressive Axe"), prevent_sweep=False) - self.multiworld.state.collect(self.create_item("Summer"), prevent_sweep=False) + self.multiworld.state.collect(self.create_item("Progressive Axe")) + self.multiworld.state.collect(self.create_item("Progressive Axe")) + self.multiworld.state.collect(self.create_item("Summer")) self.collect_lots_of_money() rule = self.world.logic.region.can_reach_location("Old Master Cannoli") self.assert_rule_false(rule, self.multiworld.state) fall = self.create_item("Fall") - self.multiworld.state.collect(fall, prevent_sweep=False) + self.multiworld.state.collect(fall) self.assert_rule_false(rule, self.multiworld.state) tuesday = self.create_item("Traveling Merchant: Tuesday") - self.multiworld.state.collect(tuesday, prevent_sweep=False) + self.multiworld.state.collect(tuesday) self.assert_rule_false(rule, self.multiworld.state) rare_seed = self.create_item("Rare Seed") - self.multiworld.state.collect(rare_seed, prevent_sweep=False) + self.multiworld.state.collect(rare_seed) self.assert_rule_true(rule, self.multiworld.state) self.remove(fall) @@ -80,11 +80,11 @@ def test_old_master_cannoli(self): green_house = self.create_item("Greenhouse") self.collect(self.create_item(Event.fall_farming)) - self.multiworld.state.collect(green_house, prevent_sweep=False) + self.multiworld.state.collect(green_house) self.assert_rule_false(rule, self.multiworld.state) friday = self.create_item("Traveling Merchant: Friday") - self.multiworld.state.collect(friday, prevent_sweep=False) + self.multiworld.state.collect(friday) self.assertTrue(self.multiworld.get_location("Old Master Cannoli", 1).access_rule(self.multiworld.state)) self.remove(green_house) @@ -111,7 +111,7 @@ def test_cannot_get_any_tool_without_blacksmith_access(self): for material in [ToolMaterial.copper, ToolMaterial.iron, ToolMaterial.gold, ToolMaterial.iridium]: self.assert_rule_false(self.world.logic.tool.has_tool(tool, material), self.multiworld.state) - self.multiworld.state.collect(self.create_item(railroad_item), prevent_sweep=False) + self.multiworld.state.collect(self.create_item(railroad_item)) for tool in [Tool.pickaxe, Tool.axe, Tool.hoe, Tool.trash_can, Tool.watering_can]: for material in [ToolMaterial.copper, ToolMaterial.iron, ToolMaterial.gold, ToolMaterial.iridium]: @@ -125,7 +125,7 @@ def test_cannot_get_fishing_rod_without_willy_access(self): for fishing_rod_level in [3, 4]: self.assert_rule_false(self.world.logic.tool.has_fishing_rod(fishing_rod_level), self.multiworld.state) - self.multiworld.state.collect(self.create_item(railroad_item), prevent_sweep=False) + self.multiworld.state.collect(self.create_item(railroad_item)) for fishing_rod_level in [3, 4]: self.assert_rule_true(self.world.logic.tool.has_fishing_rod(fishing_rod_level), self.multiworld.state) diff --git a/worlds/stardew_valley/test/rules/TestWeapons.py b/worlds/stardew_valley/test/rules/TestWeapons.py index 972170b93c75..383f26e841d2 100644 --- a/worlds/stardew_valley/test/rules/TestWeapons.py +++ b/worlds/stardew_valley/test/rules/TestWeapons.py @@ -10,40 +10,40 @@ class TestWeaponsLogic(SVTestBase): } def test_mine(self): - self.multiworld.state.collect(self.create_item("Progressive Pickaxe"), prevent_sweep=True) - self.multiworld.state.collect(self.create_item("Progressive Pickaxe"), prevent_sweep=True) - self.multiworld.state.collect(self.create_item("Progressive Pickaxe"), prevent_sweep=True) - self.multiworld.state.collect(self.create_item("Progressive Pickaxe"), prevent_sweep=True) - self.multiworld.state.collect(self.create_item("Progressive House"), prevent_sweep=True) + self.multiworld.state.collect(self.create_item("Progressive Pickaxe")) + self.multiworld.state.collect(self.create_item("Progressive Pickaxe")) + self.multiworld.state.collect(self.create_item("Progressive Pickaxe")) + self.multiworld.state.collect(self.create_item("Progressive Pickaxe")) + self.multiworld.state.collect(self.create_item("Progressive House")) self.collect([self.create_item("Combat Level")] * 10) self.collect([self.create_item("Mining Level")] * 10) self.collect([self.create_item("Progressive Mine Elevator")] * 24) - self.multiworld.state.collect(self.create_item("Bus Repair"), prevent_sweep=True) - self.multiworld.state.collect(self.create_item("Skull Key"), prevent_sweep=True) + self.multiworld.state.collect(self.create_item("Bus Repair")) + self.multiworld.state.collect(self.create_item("Skull Key")) - self.GiveItemAndCheckReachableMine("Progressive Sword", 1) - self.GiveItemAndCheckReachableMine("Progressive Dagger", 1) - self.GiveItemAndCheckReachableMine("Progressive Club", 1) + self.give_item_and_check_reachable_mine("Progressive Sword", 1) + self.give_item_and_check_reachable_mine("Progressive Dagger", 1) + self.give_item_and_check_reachable_mine("Progressive Club", 1) - self.GiveItemAndCheckReachableMine("Progressive Sword", 2) - self.GiveItemAndCheckReachableMine("Progressive Dagger", 2) - self.GiveItemAndCheckReachableMine("Progressive Club", 2) + self.give_item_and_check_reachable_mine("Progressive Sword", 2) + self.give_item_and_check_reachable_mine("Progressive Dagger", 2) + self.give_item_and_check_reachable_mine("Progressive Club", 2) - self.GiveItemAndCheckReachableMine("Progressive Sword", 3) - self.GiveItemAndCheckReachableMine("Progressive Dagger", 3) - self.GiveItemAndCheckReachableMine("Progressive Club", 3) + self.give_item_and_check_reachable_mine("Progressive Sword", 3) + self.give_item_and_check_reachable_mine("Progressive Dagger", 3) + self.give_item_and_check_reachable_mine("Progressive Club", 3) - self.GiveItemAndCheckReachableMine("Progressive Sword", 4) - self.GiveItemAndCheckReachableMine("Progressive Dagger", 4) - self.GiveItemAndCheckReachableMine("Progressive Club", 4) + self.give_item_and_check_reachable_mine("Progressive Sword", 4) + self.give_item_and_check_reachable_mine("Progressive Dagger", 4) + self.give_item_and_check_reachable_mine("Progressive Club", 4) - self.GiveItemAndCheckReachableMine("Progressive Sword", 5) - self.GiveItemAndCheckReachableMine("Progressive Dagger", 5) - self.GiveItemAndCheckReachableMine("Progressive Club", 5) + self.give_item_and_check_reachable_mine("Progressive Sword", 5) + self.give_item_and_check_reachable_mine("Progressive Dagger", 5) + self.give_item_and_check_reachable_mine("Progressive Club", 5) - def GiveItemAndCheckReachableMine(self, item_name: str, reachable_level: int): + def give_item_and_check_reachable_mine(self, item_name: str, reachable_level: int): item = self.multiworld.create_item(item_name, self.player) - self.multiworld.state.collect(item, prevent_sweep=True) + self.multiworld.state.collect(item) rule = self.world.logic.mine.can_mine_in_the_mines_floor_1_40() if reachable_level > 0: self.assert_rule_true(rule, self.multiworld.state) diff --git a/worlds/stardew_valley/test/stability/TestStability.py b/worlds/stardew_valley/test/stability/TestStability.py index 137a7172aff4..b4d0f30ea51f 100644 --- a/worlds/stardew_valley/test/stability/TestStability.py +++ b/worlds/stardew_valley/test/stability/TestStability.py @@ -7,9 +7,6 @@ from BaseClasses import get_seed from .. import SVTestCase -# There seems to be 4 bytes that appear at random at the end of the output, breaking the json... I don't know where they came from. -BYTES_TO_REMOVE = 4 - # at 0x102ca98a0> lambda_regex = re.compile(r"^ at (.*)>$") @@ -27,8 +24,8 @@ def test_all_locations_and_items_are_the_same_between_two_generations(self): output_a = subprocess.check_output([sys.executable, '-m', 'worlds.stardew_valley.test.stability.StabilityOutputScript', '--seed', str(seed)]) output_b = subprocess.check_output([sys.executable, '-m', 'worlds.stardew_valley.test.stability.StabilityOutputScript', '--seed', str(seed)]) - result_a = json.loads(output_a[:-BYTES_TO_REMOVE]) - result_b = json.loads(output_b[:-BYTES_TO_REMOVE]) + result_a = json.loads(output_a) + result_b = json.loads(output_b) for i, ((room_a, bundles_a), (room_b, bundles_b)) in enumerate(zip(result_a["bundles"].items(), result_b["bundles"].items())): self.assertEqual(room_a, room_b, f"Bundle rooms at index {i} is different between both executions. Seed={seed}") diff --git a/worlds/timespinner/__init__.py b/worlds/timespinner/__init__.py index a2a5c7ce9c78..ca31d08326b5 100644 --- a/worlds/timespinner/__init__.py +++ b/worlds/timespinner/__init__.py @@ -1,4 +1,4 @@ -from typing import Dict, List, Set, Tuple, TextIO +from typing import Dict, List, Set, Tuple, TextIO, Any, Optional from BaseClasses import Item, Tutorial, ItemClassification from .Items import get_item_names_per_category from .Items import item_table, starter_melee_weapons, starter_spells, filler_items, starter_progression_items @@ -55,13 +55,18 @@ def generate_early(self) -> None: self.precalculated_weights = PreCalculatedWeights(self.options, self.random) # in generate_early the start_inventory isnt copied over to precollected_items yet, so we can still modify the options directly - if self.options.start_inventory.value.pop('Meyef', 0) > 0: + if self.options.start_inventory.value.pop("Meyef", 0) > 0: self.options.start_with_meyef.value = Toggle.option_true - if self.options.start_inventory.value.pop('Talaria Attachment', 0) > 0: + if self.options.start_inventory.value.pop("Talaria Attachment", 0) > 0: self.options.quick_seed.value = Toggle.option_true - if self.options.start_inventory.value.pop('Jewelry Box', 0) > 0: + if self.options.start_inventory.value.pop("Jewelry Box", 0) > 0: self.options.start_with_jewelry_box.value = Toggle.option_true + self.interpret_slot_data(None) + + if self.options.quick_seed: + self.multiworld.push_precollected(self.create_item("Talaria Attachment")) + def create_regions(self) -> None: create_regions_and_locations(self.multiworld, self.player, self.options, self.precalculated_weights) @@ -144,6 +149,76 @@ def fill_slot_data(self) -> Dict[str, object]: "LakeSereneBridge": self.precalculated_weights.flood_lake_serene_bridge, "Lab": self.precalculated_weights.flood_lab } + + def interpret_slot_data(self, slot_data: Optional[Dict[str, Any]]) -> Optional[Dict[str, Any]]: + """Used by Universal Tracker to correctly rebuild state""" + + if not slot_data \ + and hasattr(self.multiworld, "re_gen_passthrough") \ + and isinstance(self.multiworld.re_gen_passthrough, dict) \ + and "Timespinner" in self.multiworld.re_gen_passthrough: + slot_data = self.multiworld.re_gen_passthrough["Timespinner"] + + if not slot_data: + return None + + self.options.start_with_jewelry_box.value = slot_data["StartWithJewelryBox"] + self.options.downloadable_items.value = slot_data["DownloadableItems"] + self.options.eye_spy.value = slot_data["EyeSpy"] + self.options.start_with_meyef.value = slot_data["StartWithMeyef"] + self.options.quick_seed.value = slot_data["QuickSeed"] + self.options.specific_keycards.value = slot_data["SpecificKeycards"] + self.options.inverted.value = slot_data["Inverted"] + self.options.gyre_archives.value = slot_data["GyreArchives"] + self.options.cantoran.value = slot_data["Cantoran"] + self.options.lore_checks.value = slot_data["LoreChecks"] + self.options.boss_rando.value = slot_data["BossRando"] + self.options.damage_rando.value = slot_data["DamageRando"] + self.options.damage_rando_overrides.value = slot_data["DamageRandoOverrides"] + self.options.hp_cap.value = slot_data["HpCap"] + self.options.level_cap.value = slot_data["LevelCap"] + self.options.extra_earrings_xp.value = slot_data["ExtraEarringsXP"] + self.options.boss_healing.value = slot_data["BossHealing"] + self.options.shop_fill.value = slot_data["ShopFill"] + self.options.shop_warp_shards.value = slot_data["ShopWarpShards"] + self.options.shop_multiplier.value = slot_data["ShopMultiplier"] + self.options.loot_pool.value = slot_data["LootPool"] + self.options.drop_rate_category.value = slot_data["DropRateCategory"] + self.options.fixed_drop_rate.value = slot_data["FixedDropRate"] + self.options.loot_tier_distro.value = slot_data["LootTierDistro"] + self.options.show_bestiary.value = slot_data["ShowBestiary"] + self.options.show_drops.value = slot_data["ShowDrops"] + self.options.enter_sandman.value = slot_data["EnterSandman"] + self.options.dad_percent.value = slot_data["DadPercent"] + self.options.rising_tides.value = slot_data["RisingTides"] + self.options.unchained_keys.value = slot_data["UnchainedKeys"] + self.options.back_to_the_future.value = slot_data["PresentAccessWithWheelAndSpindle"] + self.options.traps.value = slot_data["Traps"] + self.options.death_link.value = slot_data["DeathLink"] + # Readonly slot_data["StinkyMaw"] + # data + # Readonly slot_data["PersonalItems"] + self.precalculated_weights.pyramid_keys_unlock = slot_data["PyramidKeysGate"] + self.precalculated_weights.present_key_unlock = slot_data["PresentGate"] + self.precalculated_weights.past_key_unlock = slot_data["PastGate"] + self.precalculated_weights.time_key_unlock = slot_data["TimeGate"] + # rising tides + if (slot_data["Basement"] > 1): + self.precalculated_weights.flood_basement = True + if (slot_data["Basement"] == 2): + self.precalculated_weights.flood_basement_high = True + self.precalculated_weights.flood_xarion = slot_data["Xarion"] + self.precalculated_weights.flood_maw = slot_data["Maw"] + self.precalculated_weights.flood_pyramid_shaft = slot_data["PyramidShaft"] + self.precalculated_weights.flood_pyramid_back = slot_data["BackPyramid"] + self.precalculated_weights.flood_moat = slot_data["CastleMoat"] + self.precalculated_weights.flood_courtyard = slot_data["CastleCourtyard"] + self.precalculated_weights.flood_lake_desolation = slot_data["LakeDesolation"] + self.precalculated_weights.flood_lake_serene = not slot_data["DryLakeSerene"] + self.precalculated_weights.flood_lake_serene_bridge = slot_data["LakeSereneBridge"] + self.precalculated_weights.flood_lab = slot_data["Lab"] + + return slot_data def write_spoiler_header(self, spoiler_handle: TextIO) -> None: if self.options.unchained_keys: diff --git a/worlds/witness/data/static_items.py b/worlds/witness/data/static_items.py index e5103ef3807e..c64df741982e 100644 --- a/worlds/witness/data/static_items.py +++ b/worlds/witness/data/static_items.py @@ -1,4 +1,4 @@ -from typing import Dict, List, Set +from typing import Dict, List, Set, cast from BaseClasses import ItemClassification @@ -41,7 +41,19 @@ def populate_items() -> None: ITEM_GROUPS.setdefault("Symbols", set()).add(item_name) elif definition.category is ItemCategory.DOOR: classification = ItemClassification.progression - ITEM_GROUPS.setdefault("Doors", set()).add(item_name) + + first_entity_hex = cast(DoorItemDefinition, definition).panel_id_hexes[0] + entity_type = static_witness_logic.ENTITIES_BY_HEX[first_entity_hex]["entityType"] + + if entity_type == "Door": + ITEM_GROUPS.setdefault("Doors", set()).add(item_name) + elif entity_type == "Panel": + ITEM_GROUPS.setdefault("Panel Keys", set()).add(item_name) + elif entity_type in {"EP", "Obelisk Side", "Obelisk"}: + ITEM_GROUPS.setdefault("Obelisk Keys", set()).add(item_name) + else: + raise ValueError(f"Couldn't figure out what type of door item {definition} is.") + elif definition.category is ItemCategory.LASER: classification = ItemClassification.progression_skip_balancing ITEM_GROUPS.setdefault("Lasers", set()).add(item_name) diff --git a/worlds/witness/player_logic.py b/worlds/witness/player_logic.py index ec4ea066e579..58f15532f58c 100644 --- a/worlds/witness/player_logic.py +++ b/worlds/witness/player_logic.py @@ -984,7 +984,7 @@ def make_event_panel_lists(self) -> None: Makes event-item pairs for entities with associated events, unless these entities are disabled. """ - self.ALWAYS_EVENT_NAMES_BY_HEX[self.VICTORY_LOCATION] = "Victory" + self.USED_EVENT_NAMES_BY_HEX[self.VICTORY_LOCATION].append("Victory") for event_hex, event_name in self.ALWAYS_EVENT_NAMES_BY_HEX.items(): self.USED_EVENT_NAMES_BY_HEX[event_hex].append(event_name) diff --git a/worlds/witness/test/test_disable_non_randomized.py b/worlds/witness/test/test_disable_non_randomized.py index e7cb1597b2ba..bf285f035d5b 100644 --- a/worlds/witness/test/test_disable_non_randomized.py +++ b/worlds/witness/test/test_disable_non_randomized.py @@ -3,6 +3,8 @@ class TestDisableNonRandomized(WitnessTestBase): + run_default_tests = False + options = { "disable_non_randomized_puzzles": True, "shuffle_doors": "panels", diff --git a/worlds/witness/test/test_roll_other_options.py b/worlds/witness/test/test_roll_other_options.py index 0429b097eac3..05f3235a1f4d 100644 --- a/worlds/witness/test/test_roll_other_options.py +++ b/worlds/witness/test/test_roll_other_options.py @@ -62,3 +62,10 @@ class TestPostgameGroupedDoors(WitnessTestBase): "door_groupings": "regional", "victory_condition": "elevator", } + + +class TestPostgamePanels(WitnessTestBase): + options = { + "victory_condition": "mountain_box_long", + "shuffle_postgame": True + } diff --git a/worlds/yugioh06/__init__.py b/worlds/yugioh06/__init__.py index 90bbed1a2174..9070683f33d5 100644 --- a/worlds/yugioh06/__init__.py +++ b/worlds/yugioh06/__init__.py @@ -1,6 +1,6 @@ import os import pkgutil -from typing import Any, ClassVar, Dict, List +from typing import Any, ClassVar, Dict, List, Set import settings from BaseClasses import Entrance, Item, ItemClassification, Location, MultiWorld, Region, Tutorial @@ -17,12 +17,14 @@ draft_opponents, excluded_items, item_to_index, - tier_1_opponents, useful, + tier_1_opponents, + tier_2_opponents, + tier_3_opponents, + tier_4_opponents, + tier_5_opponents, ) -from .items import ( - challenges as challenges, -) +from .items import challenges as challenges from .locations import ( Bonuses, Campaign_Opponents, @@ -109,9 +111,17 @@ class Yugioh06World(World): for k, v in Required_Cards.items(): location_name_to_id[k] = v + start_id - item_name_groups = { - "Core Booster": core_booster, - "Campaign Boss Beaten": ["Tier 1 Beaten", "Tier 2 Beaten", "Tier 3 Beaten", "Tier 4 Beaten", "Tier 5 Beaten"], + item_name_groups: Dict[str, Set[str]] = { + "Core Booster": set(core_booster), + "Campaign Boss Beaten": {"Tier 1 Beaten", "Tier 2 Beaten", "Tier 3 Beaten", "Tier 4 Beaten", "Tier 5 Beaten"}, + "Challenge": set(challenges), + "Tier 1 Opponent": set(tier_1_opponents), + "Tier 2 Opponent": set(tier_2_opponents), + "Tier 3 Opponent": set(tier_3_opponents), + "Tier 4 Opponent": set(tier_4_opponents), + "Tier 5 Opponent": set(tier_5_opponents), + "Campaign Opponent": set(tier_1_opponents + tier_2_opponents + tier_3_opponents + + tier_4_opponents + tier_5_opponents) } removed_challenges: List[str] diff --git a/worlds/yugioh06/items.py b/worlds/yugioh06/items.py index f0f877fd9f7b..0cfcf32992f2 100644 --- a/worlds/yugioh06/items.py +++ b/worlds/yugioh06/items.py @@ -183,6 +183,35 @@ "Campaign Tier 1 Column 5", ] +tier_2_opponents: List[str] = [ + "Campaign Tier 2 Column 1", + "Campaign Tier 2 Column 2", + "Campaign Tier 2 Column 3", + "Campaign Tier 2 Column 4", + "Campaign Tier 2 Column 5", +] + +tier_3_opponents: List[str] = [ + "Campaign Tier 3 Column 1", + "Campaign Tier 3 Column 2", + "Campaign Tier 3 Column 3", + "Campaign Tier 3 Column 4", + "Campaign Tier 3 Column 5", +] + +tier_4_opponents: List[str] = [ + "Campaign Tier 4 Column 1", + "Campaign Tier 4 Column 2", + "Campaign Tier 4 Column 3", + "Campaign Tier 4 Column 4", + "Campaign Tier 4 Column 5", +] + +tier_5_opponents: List[str] = [ + "Campaign Tier 5 Column 1", + "Campaign Tier 5 Column 2", +] + Banlist_Items: List[str] = [ "No Banlist", "Banlist September 2003",