diff --git a/Fill.py b/Fill.py index 2d6257eae30a..291ea7e882b7 100644 --- a/Fill.py +++ b/Fill.py @@ -198,10 +198,16 @@ def fill_restrictive(multiworld: MultiWorld, base_state: CollectionState, locati # There are leftover unplaceable items and locations that won't accept them if multiworld.can_beat_game(): logging.warning( - f'Not all items placed. Game beatable anyway. (Could not place {unplaced_items})') + f"Not all items placed. Game beatable anyway.\nCould not place:\n" + f"{', '.join(str(item) for item in unplaced_items)}") else: - raise FillError(f'No more spots to place {unplaced_items}, locations {locations} are invalid. ' - f'Already placed {len(placements)}: {", ".join(str(place) for place in placements)}') + raise FillError(f"No more spots to place {len(unplaced_items)} items. Remaining locations are invalid.\n" + f"Unplaced items:\n" + f"{', '.join(str(item) for item in unplaced_items)}\n" + f"Unfilled locations:\n" + f"{', '.join(str(location) for location in locations)}\n" + f"Already placed {len(placements)}:\n" + f"{', '.join(str(place) for place in placements)}") item_pool.extend(unplaced_items) @@ -273,8 +279,13 @@ def remaining_fill(multiworld: MultiWorld, if unplaced_items and locations: # There are leftover unplaceable items and locations that won't accept them - raise FillError(f'No more spots to place {unplaced_items}, locations {locations} are invalid. ' - f'Already placed {len(placements)}: {", ".join(str(place) for place in placements)}') + raise FillError(f"No more spots to place {len(unplaced_items)} items. Remaining locations are invalid.\n" + f"Unplaced items:\n" + f"{', '.join(str(item) for item in unplaced_items)}\n" + f"Unfilled locations:\n" + f"{', '.join(str(location) for location in locations)}\n" + f"Already placed {len(placements)}:\n" + f"{', '.join(str(place) for place in placements)}") itempool.extend(unplaced_items) @@ -457,7 +468,9 @@ def mark_for_locking(location: Location): fill_restrictive(multiworld, multiworld.state, defaultlocations, progitempool, name="Progression") if progitempool: raise FillError( - f'Not enough locations for progress items. There are {len(progitempool)} more items than locations') + f"Not enough locations for progression items. " + f"There are {len(progitempool)} more progression items than there are available locations." + ) accessibility_corrections(multiworld, multiworld.state, defaultlocations) for location in lock_later: @@ -470,7 +483,9 @@ def mark_for_locking(location: Location): remaining_fill(multiworld, excludedlocations, filleritempool, "Remaining Excluded") if excludedlocations: raise FillError( - f"Not enough filler items for excluded locations. There are {len(excludedlocations)} more locations than items") + f"Not enough filler items for excluded locations. " + f"There are {len(excludedlocations)} more excluded locations than filler or trap items." + ) restitempool = filleritempool + usefulitempool @@ -481,13 +496,13 @@ def mark_for_locking(location: Location): if unplaced or unfilled: logging.warning( - f'Unplaced items({len(unplaced)}): {unplaced} - Unfilled Locations({len(unfilled)}): {unfilled}') + f"Unplaced items({len(unplaced)}): {unplaced} - Unfilled Locations({len(unfilled)}): {unfilled}") items_counter = Counter(location.item.player for location in multiworld.get_locations() if location.item) locations_counter = Counter(location.player for location in multiworld.get_locations()) items_counter.update(item.player for item in unplaced) locations_counter.update(location.player for location in unfilled) print_data = {"items": items_counter, "locations": locations_counter} - logging.info(f'Per-Player counts: {print_data})') + logging.info(f"Per-Player counts: {print_data})") def flood_items(multiworld: MultiWorld) -> None: diff --git a/Generate.py b/Generate.py index 56979334b547..f646e994dcac 100644 --- a/Generate.py +++ b/Generate.py @@ -26,6 +26,7 @@ from worlds.alttp.Text import TextTable from worlds.AutoWorld import AutoWorldRegister from worlds.generic import PlandoConnection +from worlds import failed_world_loads def mystery_argparse(): @@ -458,7 +459,11 @@ def roll_settings(weights: dict, plando_options: PlandoOptions = PlandoOptions.b ret.game = get_choice("game", weights) if ret.game not in AutoWorldRegister.world_types: - picks = Utils.get_fuzzy_results(ret.game, AutoWorldRegister.world_types, limit=1)[0] + picks = Utils.get_fuzzy_results(ret.game, list(AutoWorldRegister.world_types) + failed_world_loads, limit=1)[0] + if picks[0] in failed_world_loads: + raise Exception(f"No functional world found to handle game {ret.game}. " + f"Did you mean '{picks[0]}' ({picks[1]}% sure)? " + f"If so, it appears the world failed to initialize correctly.") raise Exception(f"No world found to handle game {ret.game}. Did you mean '{picks[0]}' ({picks[1]}% sure)? " f"Check your spelling or installation of that world.") diff --git a/Launcher.py b/Launcher.py index 890957958391..9fd5d91df042 100644 --- a/Launcher.py +++ b/Launcher.py @@ -100,7 +100,7 @@ def update_settings(): # Functions Component("Open host.yaml", func=open_host_yaml), Component("Open Patch", func=open_patch), - Component("Generate Template Settings", func=generate_yamls), + Component("Generate Template Options", func=generate_yamls), Component("Discord Server", icon="discord", func=lambda: webbrowser.open("https://discord.gg/8Z65BR2")), Component("18+ Discord Server", icon="discord", func=lambda: webbrowser.open("https://discord.gg/fqvNCCRsu4")), Component("Browse Files", func=browse_files), diff --git a/README.md b/README.md index b231ec1f3af9..50c5c557b979 100644 --- a/README.md +++ b/README.md @@ -87,9 +87,9 @@ We recognize that there is a strong community of incredibly smart people that ha Archipelago was directly forked from bonta0's `multiworld_31` branch of ALttPEntranceRandomizer (this project has a long legacy of its own, please check it out linked above) on January 12, 2020. The repository was then named to _MultiWorld-Utilities_ to better encompass its intended function. As Archipelago matured, then known as "Berserker's MultiWorld" by some, we found it necessary to transform our repository into a root level repository (as opposed to a 'forked repo') and change the name (which came later) to better reflect our project. ## Running Archipelago -For most people all you need to do is head over to the [releases](https://github.com/ArchipelagoMW/Archipelago/releases) page then download and run the appropriate installer. The installers function on Windows only. +For most people, all you need to do is head over to the [releases](https://github.com/ArchipelagoMW/Archipelago/releases) page then download and run the appropriate installer, or AppImage for Linux-based systems. -If you are running Archipelago from a non-Windows system then the likely scenario is that you are comfortable running source code directly. Please see our doc on [running Archipelago from source](docs/running%20from%20source.md). +If you are a developer or are running on a platform with no compiled releases available, please see our doc on [running Archipelago from source](docs/running%20from%20source.md). ## Related Repositories This project makes use of multiple other projects. We wouldn't be here without these other repositories and the contributions of their developers, past and present. diff --git a/WebHostLib/check.py b/WebHostLib/check.py index e739dda02d79..da6bfe861a6c 100644 --- a/WebHostLib/check.py +++ b/WebHostLib/check.py @@ -28,7 +28,7 @@ def check(): results, _ = roll_options(options) if len(options) > 1: # offer combined file back - combined_yaml = "---\n".join(f"# original filename: {file_name}\n{file_content.decode('utf-8-sig')}" + combined_yaml = "\n---\n".join(f"# original filename: {file_name}\n{file_content.decode('utf-8-sig')}" for file_name, file_content in options.items()) combined_yaml = base64.b64encode(combined_yaml.encode("utf-8-sig")).decode() else: diff --git a/WebHostLib/templates/tracker__Starcraft2.html b/WebHostLib/templates/tracker__Starcraft2.html index 089e7d6c2239..d365d126338d 100644 --- a/WebHostLib/templates/tracker__Starcraft2.html +++ b/WebHostLib/templates/tracker__Starcraft2.html @@ -294,7 +294,8 @@

{{ player_name }}'s Starcraft 2 Tracker

{{ sc2_icon('HERC') }} {{ sc2_icon('Juggernaut Plating (HERC)') }} {{ sc2_icon('Kinetic Foam (HERC)') }} - + {{ sc2_icon('Resource Efficiency (HERC)') }} + {{ sc2_icon('Widow Mine') }} {{ sc2_icon('Drilling Claws (Widow Mine)') }} {{ sc2_icon('Concealment (Widow Mine)') }} diff --git a/WebHostLib/tracker.py b/WebHostLib/tracker.py index 95bca57493c2..0b74c6067624 100644 --- a/WebHostLib/tracker.py +++ b/WebHostLib/tracker.py @@ -124,10 +124,13 @@ def get_player_received_items(self, team: int, player: int) -> List[NetworkItem] @_cache_results def get_player_inventory_counts(self, team: int, player: int) -> collections.Counter: """Retrieves a dictionary of all items received by their id and their received count.""" - items = self.get_player_received_items(team, player) + received_items = self.get_player_received_items(team, player) + starting_items = self.get_player_starting_inventory(team, player) inventory = collections.Counter() - for item in items: + for item in received_items: inventory[item.item] += 1 + for item in starting_items: + inventory[item] += 1 return inventory @@ -358,10 +361,13 @@ def get_enabled_multiworld_trackers(room: Room) -> Dict[str, Callable]: def render_generic_tracker(tracker_data: TrackerData, team: int, player: int) -> str: game = tracker_data.get_player_game(team, player) - # Add received index to all received items, excluding starting inventory. received_items_in_order = {} - for received_index, network_item in enumerate(tracker_data.get_player_received_items(team, player), start=1): - received_items_in_order[network_item.item] = received_index + starting_inventory = tracker_data.get_player_starting_inventory(team, player) + for index, item in enumerate(starting_inventory): + received_items_in_order[item] = index + for index, network_item in enumerate(tracker_data.get_player_received_items(team, player), + start=len(starting_inventory)): + received_items_in_order[network_item.item] = index return render_template( template_name_or_list="genericTracker.html", @@ -1674,6 +1680,7 @@ def render_Starcraft2_tracker(tracker_data: TrackerData, team: int, player: int) "Resource Efficiency (Spectre)": github_icon_base_url + "blizzard/btn-ability-hornerhan-salvagebonus.png", "Juggernaut Plating (HERC)": organics_icon_base_url + "JuggernautPlating.png", "Kinetic Foam (HERC)": organics_icon_base_url + "KineticFoam.png", + "Resource Efficiency (HERC)": github_icon_base_url + "blizzard/btn-ability-hornerhan-salvagebonus.png", "Hellion": "https://static.wikia.nocookie.net/starcraft/images/5/56/Hellion_SC2_Icon1.jpg", "Vulture": github_icon_base_url + "blizzard/btn-unit-terran-vulture.png", diff --git a/docs/adding games.md b/docs/adding games.md index e9f7860fc650..9d2860b4a196 100644 --- a/docs/adding games.md +++ b/docs/adding games.md @@ -1,269 +1,78 @@ -# How do I add a game to Archipelago? - -This guide is going to try and be a broad summary of how you can do just that. -There are two key steps to incorporating a game into Archipelago: - -- Game Modification -- Archipelago Server Integration - -Refer to the following documents as well: - -- [network protocol.md](/docs/network%20protocol.md) for network communication between client and server. -- [world api.md](/docs/world%20api.md) for documentation on server side code and creating a world package. - -# Game Modification - -One half of the work required to integrate a game into Archipelago is the development of the game client. This is -typically done through a modding API or other modification process, described further down. - -As an example, modifications to a game typically include (more on this later): - -- Hooking into when a 'location check' is completed. -- Networking with the Archipelago server. -- Optionally, UI or HUD updates to show status of the multiworld session or Archipelago server connection. - -In order to determine how to modify a game, refer to the following sections. - -## Engine Identification - -This is a good way to make the modding process much easier. Being able to identify what engine a game was made in is -critical. The first step is to look at a game's files. Let's go over what some game files might look like. It’s -important that you be able to see file extensions, so be sure to enable that feature in your file viewer of choice. -Examples are provided below. - -### Creepy Castle - -![Creepy Castle Root Directory in Windows Explorer](/docs/img/creepy-castle-directory.png) - -This is the delightful title Creepy Castle, which is a fantastic game that I highly recommend. It’s also your worst-case -scenario as a modder. All that’s present here is an executable file and some meta-information that Steam uses. You have -basically nothing here to work with. If you want to change this game, the only option you have is to do some pretty -nasty disassembly and reverse engineering work, which is outside the scope of this tutorial. Let’s look at some other -examples of game releases. - -### Heavy Bullets - -![Heavy Bullets Root Directory in Window's Explorer](/docs/img/heavy-bullets-directory.png) - -Here’s the release files for another game, Heavy Bullets. We see a .exe file, like expected, and a few more files. -“hello.txt” is a text file, which we can quickly skim in any text editor. Many games have them in some form, usually -with a name like README.txt, and they may contain information about a game, such as a EULA, terms of service, licensing -information, credits, and general info about the game. You usually won’t find anything too helpful here, but it never -hurts to check. In this case, it contains some credits and a changelog for the game, so nothing too important. -“steam_api.dll” is a file you can safely ignore, it’s just some code used to interface with Steam. -The directory “HEAVY_BULLETS_Data”, however, has some good news. - -![Heavy Bullets Data Directory in Window's Explorer](/docs/img/heavy-bullets-data-directory.png) - -Jackpot! It might not be obvious what you’re looking at here, but I can instantly tell from this folder’s contents that -what we have is a game made in the Unity Engine. If you look in the sub-folders, you’ll seem some .dll files which -affirm our suspicions. Telltale signs for this are directories titled “Managed” and “Mono”, as well as the numbered, -extension-less level files and the sharedassets files. If you've identified the game as a Unity game, some useful tools -and information to help you on your journey can be found at this -[Unity Game Hacking guide.](https://github.com/imadr/Unity-game-hacking) - -### Stardew Valley - -![Stardew Valley Root Directory in Window's Explorer](/docs/img/stardew-valley-directory.png) - -This is the game contents of Stardew Valley. A lot more to look at here, but some key takeaways. -Notice the .dll files which include “CSharp” in their name. This tells us that the game was made in C#, which is good -news. Many games made in C# can be modified using the same tools found in our Unity game hacking toolset; namely BepInEx -and MonoMod. - -### Gato Roboto - -![Gato Roboto Root Directory in Window's Explorer](/docs/img/gato-roboto-directory.png) - -Our last example is the game Gato Roboto. This game is made in GameMaker, which is another green flag to look out for. -The giveaway is the file titled "data.win". This immediately tips us off that this game was made in GameMaker. For -modifying GameMaker games the [Undertale Mod Tool](https://github.com/krzys-h/UndertaleModTool) is incredibly helpful. - -This isn't all you'll ever see looking at game files, but it's a good place to start. -As a general rule, the more files a game has out in plain sight, the more you'll be able to change. -This especially applies in the case of code or script files - always keep a lookout for anything you can use to your -advantage! - -## Open or Leaked Source Games - -As a side note, many games have either been made open source, or have had source files leaked at some point. -This can be a boon to any would-be modder, for obvious reasons. Always be sure to check - a quick internet search for -"(Game) Source Code" might not give results often, but when it does, you're going to have a much better time. - -Be sure never to distribute source code for games that you decompile or find if you do not have express permission to do -so, or to redistribute any materials obtained through similar methods, as this is illegal and unethical. - -## Modifying Release Versions of Games - -However, for now we'll assume you haven't been so lucky, and have to work with only what’s sitting in your install -directory. Some developers are kind enough to deliberately leave you ways to alter their games, like modding tools, -but these are often not geared to the kind of work you'll be doing and may not help much. - -As a general rule, any modding tool that lets you write actual code is something worth using. - -### Research - -The first step is to research your game. Even if you've been dealt the worst hand in terms of engine modification, -it's possible other motivated parties have concocted useful tools for your game already. -Always be sure to search the Internet for the efforts of other modders. - -### Other helpful tools - -Depending on the game’s underlying engine, there may be some tools you can use either in lieu of or in addition to -existing game tools. - -#### [CheatEngine](https://cheatengine.org/) - -CheatEngine is a tool with a very long and storied history. -Be warned that because it performs live modifications to the memory of other processes, it will likely be flagged as -malware (because this behavior is most commonly found in malware and rarely used by other programs). -If you use CheatEngine, you need to have a deep understanding of how computers work at the nuts and bolts level, -including binary data formats, addressing, and assembly language programming. - -The tool itself is highly complex and even I have not yet charted its expanses. -However, it can also be a very powerful tool in the right hands, allowing you to query and modify gamestate without ever -modifying the actual game itself. -In theory it is compatible with any piece of software you can run on your computer, but there is no "easy way" to do -anything with it. - -### What Modifications You Should Make to the Game - -We talked about this briefly in [Game Modification](#game-modification) section. -The next step is to know what you need to make the game do now that you can modify it. Here are your key goals: - -- Know when the player has checked a location, and react accordingly -- Be able to receive items from the server on the fly -- Keep an index for items received in order to resync from disconnections -- Add interface for connecting to the Archipelago server with passwords and sessions -- Add commands for manually rewarding, re-syncing, releasing, and other actions - -Refer to the [Network Protocol documentation](/docs/network%20protocol.md) for how to communicate with Archipelago's -servers. - -## But my Game is a console game. Can I still add it? - -That depends – what console? - -### My Game is a recent game for the PS4/Xbox-One/Nintendo Switch/etc - -Most games for recent generations of console platforms are inaccessible to the typical modder. It is generally advised -that you do not attempt to work with these games as they are difficult to modify and are protected by their copyright -holders. Most modern AAA game studios will provide a modding interface or otherwise deny modifications for their console -games. - -### My Game isn’t that old, it’s for the Wii/PS2/360/etc - -This is very complex, but doable. -If you don't have good knowledge of stuff like Assembly programming, this is not where you want to learn it. -There exist many disassembly and debugging tools, but more recent content may have lackluster support. - -### My Game is a classic for the SNES/Sega Genesis/etc - -That’s a lot more feasible. -There are many good tools available for understanding and modifying games on these older consoles, and the emulation -community will have figured out the bulk of the console’s secrets. -Look for debugging tools, but be ready to learn assembly. -Old consoles usually have their own unique dialects of ASM you’ll need to get used to. - -Also make sure there’s a good way to interface with a running emulator, since that’s the only way you can connect these -older consoles to the Internet. -There are also hardware mods and flash carts, which can do the same things an emulator would when connected to a -computer, but these will require the same sort of interface software to be written in order to work properly; from your -perspective the two won't really look any different. - -### My Game is an exclusive for the Super Baby Magic Dream Boy. It’s this console from the Soviet Union that- - -Unless you have a circuit schematic for the Super Baby Magic Dream Boy sitting on your desk, no. -Obscurity is your enemy – there will likely be little to no emulator or modding information, and you’d essentially be -working from scratch. - -## How to Distribute Game Modifications - -**NEVER EVER distribute anyone else's copyrighted work UNLESS THEY EXPLICITLY GIVE YOU PERMISSION TO DO SO!!!** - -This is a good way to get any project you're working on sued out from under you. -The right way to distribute modified versions of a game's binaries, assuming that the licensing terms do not allow you -to copy them wholesale, is as patches. - -There are many patch formats, which I'll cover in brief. The common theme is that you can’t distribute anything that -wasn't made by you. Patches are files that describe how your modified file differs from the original one, thus avoiding -the issue of distributing someone else’s original work. - -Users who have a copy of the game just need to apply the patch, and those who don’t are unable to play. - -### Patches - -#### IPS - -IPS patches are a simple list of chunks to replace in the original to generate the output. It is not possible to encode -moving of a chunk, so they may inadvertently contain copyrighted material and should be avoided unless you know it's -fine. - -#### UPS, BPS, VCDIFF (xdelta), bsdiff - -Other patch formats generate the difference between two streams (delta patches) with varying complexity. This way it is -possible to insert bytes or move chunks without including any original data. Bsdiff is highly optimized and includes -compression, so this format is used by APBP. - -Only a bsdiff module is integrated into AP. If the final patch requires or is based on any other patch, convert them to -bsdiff or APBP before adding it to the AP source code as "basepatch.bsdiff4" or "basepatch.apbp". - -#### APBP Archipelago Binary Patch - -Starting with version 4 of the APBP format, this is a ZIP file containing metadata in `archipelago.json` and additional -files required by the game / patching process. For ROM-based games the ZIP will include a `delta.bsdiff4` which is the -bsdiff between the original and the randomized ROM. - -To make using APBP easy, they can be generated by inheriting from `worlds.Files.APDeltaPatch`. - -### Mod files - -Games which support modding will usually just let you drag and drop the mod’s files into a folder somewhere. -Mod files come in many forms, but the rules about not distributing other people's content remain the same. -They can either be generic and modify the game using a seed or `slot_data` from the AP websocket, or they can be -generated per seed. If at all possible, it's generally best practice to collect your world information from `slot_data` -so that the users don't have to move files around in order to play. - -If the mod is generated by AP and is installed from a ZIP file, it may be possible to include APBP metadata for easy -integration into the Webhost by inheriting from `worlds.Files.APContainer`. - -## Archipelago Integration - -In order for your game to communicate with the Archipelago server and generate the necessary randomized information, -you must create a world package in the main Archipelago repo. This section will cover the requisites and expectations -and show the basics of a world. More in depth documentation on the available API can be read in -the [world api doc.](/docs/world%20api.md) -For setting up your working environment with Archipelago refer -to [running from source](/docs/running%20from%20source.md) and the [style guide](/docs/style.md). - -### Requirements - -A world implementation requires a few key things from its implementation - -- A folder within `worlds` that contains an `__init__.py` - - This is what defines it as a Python package and how it's able to be imported - into Archipelago's generation system. During generation time only code that is - defined within this file will be run. It's suggested to split up your information - into more files to improve readability, but all of that information can be - imported at its base level within your world. -- A `World` subclass where you create your world and define all of its rules - and the following requirements: - - Your items and locations need a `item_name_to_id` and `location_name_to_id`, - respectively, mapping. - - An `option_definitions` mapping of your game options with the format - `{name: Class}`, where `name` uses Python snake_case. - - You must define your world's `create_item` method, because this may be called - by the generator in certain circumstances - - When creating your world you submit items and regions to the Multiworld. - - These are lists of said objects which you can access at - `self.multiworld.itempool` and `self.multiworld.regions`. Best practice for - adding to these lists is with either `append` or `extend`, where `append` is a - single object and `extend` is a list. - - Do not use `=` as this will delete other worlds' items and regions. - - Regions are containers for holding your world's Locations. - - Locations are where players will "check" for items and must exist within - a region. It's also important for your world's submitted items to be the same as - its submitted locations count. - - You must always have a "Menu" Region from which the generation algorithm - uses to enter the game and access locations. -- Make sure to check out [world maintainer.md](/docs/world%20maintainer.md) before publishing. \ No newline at end of file +# Adding Games + +Adding a new game to Archipelago has two major parts: + +* Game Modification to communicate with Archipelago server (hereafter referred to as "client") +* Archipelago Generation and Server integration plugin (hereafter referred to as "world") + +This document will attempt to illustrate the bare minimum requirements and expectations of both parts of a new world +integration. As game modification wildly varies by system and engine, and has no bearing on the Archipelago protocol, +it will not be detailed here. + +## Client + +The client is an intermediary program between the game and the Archipelago server. This can either be a direct +modification to the game, an external program, or both. This can be implemented in nearly any modern language, but it +must fulfill a few requirements in order to function as expected. The specific requirements the game client must follow +to behave as expected are: + +* Handle both secure and unsecure websocket connections +* Detect and react when a location has been "checked" by the player by sending a network packet to the server +* Receive and parse network packets when the player receives an item from the server, and reward it to the player on +demand + * **Any** of your items can be received any number of times, up to and far surpassing those that the game might +normally expect from features such as starting inventory, item link replacement, or item cheating + * Players and the admin can cheat items to the player at any time with a server command, and these items may not have +a player or location attributed to them +* Be able to change the port for saved connection info + * Rooms hosted on the website attempt to reserve their port, but since there are a limited number of ports, this +privilege can be lost, requiring the room to be moved to a new port +* Reconnect if the connection is unstable and lost while playing +* Keep an index for items received in order to resync. The ItemsReceived Packets are a single list with guaranteed +order. +* Receive items that were sent to the player while they were not connected to the server + * The player being able to complete checks while offline and sending them when reconnecting is a good bonus, but not +strictly required +* Send a status update packet alerting the server that the player has completed their goal + +Libraries for most modern languages and the spec for various packets can be found in the +[network protocol](/docs/network%20protocol.md) API reference document. + +## World + +The world is your game integration for the Archipelago generator, webhost, and multiworld server. It contains all the +information necessary for creating the items and locations to be randomized, the logic for item placement, the +datapackage information so other game clients can recognize your game data, and documentation. Your world must be +written as a Python package to be loaded by Archipelago. This is currently done by creating a fork of the Archipelago +repository and creating a new world package in `/worlds/`. A bare minimum world implementation must satisfy the +following requirements: + +* A folder within `/worlds/` that contains an `__init__.py` +* A `World` subclass where you create your world and define all of its rules +* A unique game name +* For webhost documentation and behaviors, a `WebWorld` subclass that must be instantiated in the `World` class +definition + * The game_info doc must follow the format `{language_code}_{game_name}.md` +* A mapping for items and locations defining their names and ids for clients to be able to identify them. These are +`item_name_to_id` and `location_name_to_id`, respectively. +* Create an item when `create_item` is called both by your code and externally +* An `options_dataclass` defining the options players have available to them +* A `Region` for your player with the name "Menu" to start from +* Create a non-zero number of locations and add them to your regions +* Create a non-zero number of items **equal** to the number of locations and add them to the multiworld itempool +* All items submitted to the multiworld itempool must not be manually placed by the World. If you need to place specific +items, there are multiple ways to do so, but they should not be added to the multiworld itempool. + +Notable caveats: +* The "Menu" region will always be considered the "start" for the player +* The "Menu" region is *always* considered accessible; i.e. the player is expected to always be able to return to the +start of the game from anywhere +* When submitting regions or items to the multiworld (multiworld.regions and multiworld.itempool respectively), use +`append`, `extend`, or `+=`. **Do not use `=`** +* Regions are simply containers for locations that share similar access rules. They do not have to map to +concrete, physical areas within your game and can be more abstract like tech trees or a questline. + +The base World class can be found in [AutoWorld](/worlds/AutoWorld.py). Methods available for your world to call during +generation can be found in [BaseClasses](/BaseClasses.py) and [Fill](/Fill.py). Some examples and documentation +regarding the API can be found in the [world api doc](/docs/world%20api.md). +Before publishing, make sure to also check out [world maintainer.md](/docs/world%20maintainer.md). diff --git a/docs/img/creepy-castle-directory.png b/docs/img/creepy-castle-directory.png deleted file mode 100644 index af4fdc584dc0..000000000000 Binary files a/docs/img/creepy-castle-directory.png and /dev/null differ diff --git a/docs/img/gato-roboto-directory.png b/docs/img/gato-roboto-directory.png deleted file mode 100644 index fda0eb5ff992..000000000000 Binary files a/docs/img/gato-roboto-directory.png and /dev/null differ diff --git a/docs/img/heavy-bullets-data-directory.png b/docs/img/heavy-bullets-data-directory.png deleted file mode 100644 index 9fdcba1ca02a..000000000000 Binary files a/docs/img/heavy-bullets-data-directory.png and /dev/null differ diff --git a/docs/img/heavy-bullets-directory.png b/docs/img/heavy-bullets-directory.png deleted file mode 100644 index 8bc14836c601..000000000000 Binary files a/docs/img/heavy-bullets-directory.png and /dev/null differ diff --git a/docs/img/stardew-valley-directory.png b/docs/img/stardew-valley-directory.png deleted file mode 100644 index 64bbf66ec299..000000000000 Binary files a/docs/img/stardew-valley-directory.png and /dev/null differ diff --git a/docs/network protocol.md b/docs/network protocol.md index 9f2c07883b9d..604ff6708fca 100644 --- a/docs/network protocol.md +++ b/docs/network protocol.md @@ -31,6 +31,9 @@ There are also a number of community-supported libraries available that implemen | GameMaker: Studio 2.x+ | [see Discord](https://discord.com/channels/731205301247803413/1166418532519653396) | | ## Synchronizing Items +After a client connects, it will receive all previously collected items for its associated slot in a [ReceivedItems](#ReceivedItems) packet. This will include items the client may have already processed in a previous play session. +To ensure the client is able to reject those items if it needs to, each item in the packet has an associated `index` argument. You will need to find a way to save the "last processed item index" to the player's local savegame, a local file, or something to that effect. Before connecting, you should load that "last processed item index" value and compare against it in your received items handling. + When the client receives a [ReceivedItems](#ReceivedItems) packet, if the `index` argument does not match the next index that the client expects then it is expected that the client will re-sync items with the server. This can be accomplished by sending the server a [Sync](#Sync) packet and then a [LocationChecks](#LocationChecks) packet. Even if the client detects a desync, it can still accept the items provided in this packet to prevent gameplay interruption. diff --git a/docs/options api.md b/docs/options api.md index 6205089f3dc3..f1c01ac7e7e9 100644 --- a/docs/options api.md +++ b/docs/options api.md @@ -10,10 +10,9 @@ Archipelago will be abbreviated as "AP" from now on. ## Option Definitions Option parsing in AP is done using different Option classes. For each option you would like to have in your game, you need to create: -- A new option class with a docstring detailing what the option will do to your user. -- A `display_name` to be displayed on the webhost. -- A new entry in the `option_definitions` dict for your World. -By style and convention, the internal names should be snake_case. +- A new option class, with a docstring detailing what the option does, to be exposed to the user. +- A new entry in the `options_dataclass` definition for your World. +By style and convention, the dataclass attributes should be `snake_case`. ### Option Creation - If the option supports having multiple sub_options, such as Choice options, these can be defined with @@ -43,7 +42,7 @@ from Options import Toggle, Range, Choice, PerGameCommonOptions class StartingSword(Toggle): """Adds a sword to your starting inventory.""" - display_name = "Start With Sword" + display_name = "Start With Sword" # this is the option name as it's displayed to the user on the webhost and in the spoiler log class Difficulty(Choice): diff --git a/requirements.txt b/requirements.txt index 9531e3058e8a..d1a7b763f37f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,4 +11,4 @@ certifi>=2023.11.17 cython>=3.0.8 cymem>=2.0.8 orjson>=3.9.10 -typing-extensions>=4.7.0 +typing_extensions>=4.7.0 diff --git a/worlds/__init__.py b/worlds/__init__.py index 168bba7abf41..53b0c5ceb948 100644 --- a/worlds/__init__.py +++ b/worlds/__init__.py @@ -20,9 +20,13 @@ "user_folder", "GamesPackage", "DataPackage", + "failed_world_loads", } +failed_world_loads: List[str] = [] + + class GamesPackage(TypedDict, total=False): item_name_groups: Dict[str, List[str]] item_name_to_id: Dict[str, int] @@ -87,6 +91,7 @@ def load(self) -> bool: file_like.seek(0) import logging logging.exception(file_like.read()) + failed_world_loads.append(os.path.basename(self.path).rsplit(".", 1)[0]) return False diff --git a/worlds/cv64/docs/en_Castlevania 64.md b/worlds/cv64/docs/en_Castlevania 64.md index 692bbfe86a71..55f7eb03012f 100644 --- a/worlds/cv64/docs/en_Castlevania 64.md +++ b/worlds/cv64/docs/en_Castlevania 64.md @@ -91,7 +91,7 @@ either filler, useful, or a trap. When you pick up someone else's item, you will not receive anything and the item textbox will show up to announce what you found and who it was for. The color of the text will tell you its classification: -- Light brown-ish: Common +- Light brown-ish: Filler - White/Yellow: Useful - Yellow/Green: Progression - Yellow/Red: Trap diff --git a/worlds/cv64/options.py b/worlds/cv64/options.py index e1be03897dcf..495bb51c5ef8 100644 --- a/worlds/cv64/options.py +++ b/worlds/cv64/options.py @@ -144,8 +144,9 @@ class HardLogic(Toggle): class MultiHitBreakables(Toggle): - """Adds the items that drop from the objects that break in three hits to the pool. There are 17 of these throughout - the game, adding up to 74 checks in total with all stages. + """Adds the items that drop from the objects that break in three hits to the pool. There are 18 of these throughout + the game, adding up to 79 or 80 checks (depending on sub-weapons + being shuffled anywhere or not) in total with all stages. The game will be modified to remember exactly which of their items you've picked up instead of simply whether they were broken or not.""" display_name = "Multi-hit Breakables" diff --git a/worlds/generic/docs/plando_en.md b/worlds/generic/docs/plando_en.md index d6a09cf4e610..161b1e465b33 100644 --- a/worlds/generic/docs/plando_en.md +++ b/worlds/generic/docs/plando_en.md @@ -201,7 +201,7 @@ Kirby's Dream Land 3: As this is currently only supported by A Link to the Past, instead of finding an explanation here, please refer to the relevant guide: [A Link to the Past Plando Guide](/tutorial/A%20Link%20to%20the%20Past/plando/en) -## Connections Plando +## Connection Plando This is currently only supported by a few games, including A Link to the Past, Minecraft, and Ocarina of Time. As the way that these games interact with their connections is different, only the basics are explained here. More specific information for connection plando in A Link to the Past can be found in diff --git a/worlds/generic/docs/setup_en.md b/worlds/generic/docs/setup_en.md index b99cdbc0fe54..ef2413378960 100644 --- a/worlds/generic/docs/setup_en.md +++ b/worlds/generic/docs/setup_en.md @@ -39,7 +39,7 @@ to your Archipelago installation. ### What is a YAML? YAML is the file format which Archipelago uses in order to configure a player's world. It allows you to dictate which -game you will be playing as well as the settings you would like for that game. +game you will be playing as well as the options you would like for that game. YAML is a format very similar to JSON however it is made to be more human-readable. If you are ever unsure of the validity of your YAML file you may check the file by uploading it to the check page on the Archipelago website: @@ -48,10 +48,10 @@ validity of your YAML file you may check the file by uploading it to the check p ### Creating a YAML YAML files may be generated on the Archipelago website by visiting the [games page](/games) and clicking the -"Settings Page" link under the relevant game. Clicking "Export Settings" in a game's settings page will download the +"Options Page" link under the relevant game. Clicking "Export Options" in a game's options page will download the YAML to your system. -Alternatively, you can run `ArchipelagoLauncher.exe` and click on `Generate Template Settings` to create a set of template +Alternatively, you can run `ArchipelagoLauncher.exe` and click on `Generate Template Options` to create a set of template YAMLs for each game in your Archipelago install (including for APWorlds). These will be placed in your `Players/Templates` folder. In a multiworld there must be one YAML per world. Any number of players can play on each world using either the game's @@ -66,17 +66,17 @@ each player is planning on playing their own game then they will each need a YAM #### On the website The easiest way to get started playing an Archipelago generated game, after following the base setup from the game's -setup guide, is to find the game on the [Archipelago Games List](/games), click on `Settings Page`, set the settings for +setup guide, is to find the game on the [Archipelago Games List](/games), click on `Options Page`, set the options for how you want to play, and click `Generate Game` at the bottom of the page. This will create a page for the seed, from which you can create a room, and then [connect](#connecting-to-an-archipelago-server). -If you have downloaded the settings, or have created a settings file manually, this file can be uploaded on the +If you have downloaded the options, or have created an options file manually, this file can be uploaded on the [Generation Page](/generate) where you can also set any specific hosting settings. #### On your local installation To generate a game on your local machine, make sure to install the Archipelago software. Navigate to your Archipelago -installation (usually C:\ProgramData\Archipelago), and place the settings file you have either created or downloaded +installation (usually C:\ProgramData\Archipelago), and place the options file you have either created or downloaded from the website in the `Players` folder. Run `ArchipelagoGenerate.exe`, or click on `Generate` in the launcher, and it will inform you whether the generation @@ -97,7 +97,7 @@ resources, and host the resulting multiworld on the website. #### Gather All Player YAMLs -All players that wish to play in the generated multiworld must have a YAML file which contains the settings that they +All players that wish to play in the generated multiworld must have a YAML file which contains the options that they wish to play with. One person should gather all files from all participants in the generated multiworld. It is possible for a single player to have multiple games, or even multiple slots of a single game, but each YAML must have a unique player name. @@ -129,7 +129,7 @@ need the corresponding ROM files. Sometimes there are various settings that you may want to change before rolling a seed such as enabling race mode, auto-release, plando support, or setting a password. -All of these settings, plus other options, may be changed by modifying the `host.yaml` file in the Archipelago +All of these settings, plus more, can be changed by modifying the `host.yaml` file in the Archipelago installation folder. You can quickly access this file by clicking on `Open host.yaml` in the launcher. The settings chosen here are baked into the `.archipelago` file that gets output with the other files after generation, so if you are rolling locally, ensure this file is edited to your liking **before** rolling the seed. This file is overwritten @@ -207,4 +207,4 @@ when creating your [YAML file](#creating-a-yaml). If the game is hosted on the w room page. The name is case-sensitive. * `Password` is the password set by the host in order to join the multiworld. By default, this will be empty and is almost never required, but one can be set when generating the game. Generally, leave this field blank when it exists, -unless you know that a password was set, and what that password is. \ No newline at end of file +unless you know that a password was set, and what that password is. diff --git a/worlds/hk/Options.py b/worlds/hk/Options.py index 21e8c179e82e..70c7c1689661 100644 --- a/worlds/hk/Options.py +++ b/worlds/hk/Options.py @@ -1,4 +1,5 @@ import typing +import re from .ExtractedData import logic_options, starts, pool_options from .Rules import cost_terms @@ -11,12 +12,16 @@ else: Random = typing.Any - locations = {"option_" + start: i for i, start in enumerate(starts)} # This way the dynamic start names are picked up by the MetaClass Choice belongs to -StartLocation = type("StartLocation", (Choice,), {"__module__": __name__, "auto_display_name": False, **locations, - "__doc__": "Choose your start location. " - "This is currently only locked to King's Pass."}) +StartLocation = type("StartLocation", (Choice,), { + "__module__": __name__, + "auto_display_name": False, + "display_name": "Start Location", + "__doc__": "Choose your start location. " + "This is currently only locked to King's Pass.", + **locations, +}) del (locations) option_docstrings = { @@ -49,8 +54,7 @@ "RandomizeBossEssence": "Randomize boss essence drops, such as those for defeating Warrior Dreams, into the item " "pool and open their locations\n for randomization.", "RandomizeGrubs": "Randomize Grubs into the item pool and open their locations for randomization.", - "RandomizeMimics": "Randomize Mimic Grubs into the item pool and open their locations for randomization." - "Mimic Grubs are always placed\n in your own game.", + "RandomizeMimics": "Randomize Mimic Grubs into the item pool and open their locations for randomization.", "RandomizeMaps": "Randomize Maps into the item pool. This causes Cornifer to give you a message allowing you to see" " and buy an item\n that is randomized into that location as well.", "RandomizeStags": "Randomize Stag Stations unlocks into the item pool as well as placing randomized items " @@ -99,8 +103,12 @@ "RandomizeKeys", "RandomizeMaskShards", "RandomizeVesselFragments", + "RandomizeCharmNotches", "RandomizePaleOre", - "RandomizeRelics" + "RandomizeRancidEggs" + "RandomizeRelics", + "RandomizeStags", + "RandomizeLifebloodCocoons" } shop_to_option = { @@ -117,6 +125,7 @@ hollow_knight_randomize_options: typing.Dict[str, type(Option)] = {} +splitter_pattern = re.compile(r'(? typing.List[int]: random_source.shuffle(charms) return charms else: - charms = [0]*self.charm_count + charms = [0] * self.charm_count for x in range(self.value): - index = random_source.randint(0, self.charm_count-1) + index = random_source.randint(0, self.charm_count - 1) while charms[index] > 5: - index = random_source.randint(0, self.charm_count-1) + index = random_source.randint(0, self.charm_count - 1) charms[index] += 1 return charms @@ -404,6 +417,7 @@ class WhitePalace(Choice): class ExtraPlatforms(DefaultOnToggle): """Places additional platforms to make traveling throughout Hallownest more convenient.""" + display_name = "Extra Platforms" class AddUnshuffledLocations(Toggle): @@ -413,6 +427,7 @@ class AddUnshuffledLocations(Toggle): Note: This will increase the number of location checks required to purchase hints to the total maximum. """ + display_name = "Add Unshuffled Locations" class DeathLinkShade(Choice): @@ -430,6 +445,7 @@ class DeathLinkShade(Choice): option_shadeless = 1 option_shade = 2 default = 2 + display_name = "Deathlink Shade Handling" class DeathLinkBreaksFragileCharms(Toggle): @@ -439,6 +455,7 @@ class DeathLinkBreaksFragileCharms(Toggle): ** Self-death fragile charm behavior is not changed; if a self-death normally breaks fragile charms in vanilla, it will continue to do so. """ + display_name = "Deathlink Breaks Fragile Charms" class StartingGeo(Range): @@ -462,18 +479,20 @@ class CostSanity(Choice): alias_yes = 1 option_shopsonly = 2 option_notshops = 3 - display_name = "Cost Sanity" + display_name = "Costsanity" class CostSanityHybridChance(Range): """The chance that a CostSanity cost will include two components instead of one, e.g. Grubs + Essence""" range_end = 100 default = 10 + display_name = "Costsanity Hybrid Chance" cost_sanity_weights: typing.Dict[str, type(Option)] = {} for term, cost in cost_terms.items(): option_name = f"CostSanity{cost.option}Weight" + display_name = f"Costsanity {cost.option} Weight" extra_data = { "__module__": __name__, "range_end": 1000, "__doc__": ( @@ -486,10 +505,10 @@ class CostSanityHybridChance(Range): extra_data["__doc__"] += " Geo costs will never be chosen for Grubfather, Seer, or Egg Shop." option = type(option_name, (Range,), extra_data) + option.display_name = display_name globals()[option.__name__] = option cost_sanity_weights[option.__name__] = option - hollow_knight_options: typing.Dict[str, type(Option)] = { **hollow_knight_randomize_options, RandomizeElevatorPass.__name__: RandomizeElevatorPass, diff --git a/worlds/hk/docs/en_Hollow Knight.md b/worlds/hk/docs/en_Hollow Knight.md index e31eb892a004..94398ec6ac14 100644 --- a/worlds/hk/docs/en_Hollow Knight.md +++ b/worlds/hk/docs/en_Hollow Knight.md @@ -8,7 +8,9 @@ config file. ## What does randomization do to this game? Randomization swaps around the locations of items. The items being swapped around are chosen within your YAML. -Shop costs are presently always randomized. +Shop costs are presently always randomized. Items which could be randomized, but are not, will remain unmodified in +their usual locations. In particular, when the items at Grubfather and Seer are partially randomized, randomized items +will be obtained from a chest in the room, while unrandomized items will be given by the NPC as normal. ## What Hollow Knight items can appear in other players' worlds? diff --git a/worlds/hk/docs/setup_en.md b/worlds/hk/docs/setup_en.md index b85818f30eca..c046785038d8 100644 --- a/worlds/hk/docs/setup_en.md +++ b/worlds/hk/docs/setup_en.md @@ -3,6 +3,8 @@ ## Required Software * Download and unzip the Lumafly Mod Manager from the [Lumafly website](https://themulhima.github.io/Lumafly/). * A legal copy of Hollow Knight. + * Steam, Gog, and Xbox Game Pass versions of the game are supported. + * Windows, Mac, and Linux (including Steam Deck) are supported. ## Installing the Archipelago Mod using Lumafly 1. Launch Lumafly and ensure it locates your Hollow Knight installation directory. @@ -10,25 +12,25 @@ * If desired, also install "Archipelago Map Mod" to use as an in-game tracker. 3. Launch the game, you're all set! -### What to do if Lumafly fails to find your XBox Game Pass installation directory -1. Enter the XBox app and move your mouse over "Hollow Knight" on the left sidebar. -2. Click the three points then click "Manage". -3. Go to the "Files" tab and select "Browse...". -4. Click "Hollow Knight", then "Content", then click the path bar and copy it. -5. Run Lumafly as an administrator and, when it asks you for the path, paste what you copied in step 4. - -#### Alternative Method: -1. Click on your profile then "Settings". -2. Go to the "General" tab and select "CHANGE FOLDER". -3. Look for a folder where you want to install the game (preferably inside a folder on your desktop) and copy the path. -4. Run Lumafly as an administrator and, when it asks you for the path, paste what you copied in step 3. - -Note: The path folder needs to have the "Hollow Knight_Data" folder inside. +### What to do if Lumafly fails to find your installation directory +1. Find the directory manually. + * Xbox Game Pass: + 1. Enter the XBox app and move your mouse over "Hollow Knight" on the left sidebar. + 2. Click the three points then click "Manage". + 3. Go to the "Files" tab and select "Browse...". + 4. Click "Hollow Knight", then "Content", then click the path bar and copy it. + * Steam: + 1. You likely put your Steam library in a non-standard place. If this is the case, you probably know where + it is. Find your steam library and then find the Hollow Knight folder and copy the path. + * Windows - `C:\Program Files (x86)\Steam\steamapps\common\Hollow Knight` + * Linux/Steam Deck - ~/.local/share/Steam/steamapps/common/Hollow Knight + * Mac - ~/Library/Application Support/Steam/steamapps/common/Hollow Knight/hollow_knight.app +2. Run Lumafly as an administrator and, when it asks you for the path, paste the path you copied. ## Configuring your YAML File ### What is a YAML and why do I need one? -You can see the [basic multiworld setup guide](/tutorial/Archipelago/setup/en) here on the Archipelago website to learn -about why Archipelago uses YAML files and what they're for. +An YAML file is the way that you provide your player options to Archipelago. +See the [basic multiworld setup guide](/tutorial/Archipelago/setup/en) here on the Archipelago website to learn more. ### Where do I get a YAML? You can use the [game options page for Hollow Knight](/games/Hollow%20Knight/player-options) here on the Archipelago @@ -44,9 +46,7 @@ website to generate a YAML using a graphical interface. * If you are waiting for a countdown then wait for it to lapse before hitting Start. * Or hit Start then pause the game once you're in it. -## Commands -While playing the multiworld you can interact with the server using various commands listed in the -[commands guide](/tutorial/Archipelago/commands/en). As this game does not have an in-game text client at the moment, -You can optionally connect to the multiworld using the text client, which can be found in the -[main Archipelago installation](https://github.com/ArchipelagoMW/Archipelago/releases) as Archipelago Text Client to -enter these commands. +## Hints and other commands +While playing in a multiworld, you can interact with the server using various commands listed in the +[commands guide](/tutorial/Archipelago/commands/en). You can use the Archipelago Text Client to do this, +which is included in the latest release of the [Archipelago software](https://github.com/ArchipelagoMW/Archipelago/releases/latest). diff --git a/worlds/hylics2/__init__.py b/worlds/hylics2/__init__.py index 1c51bacc5d67..cb7ae4498279 100644 --- a/worlds/hylics2/__init__.py +++ b/worlds/hylics2/__init__.py @@ -34,8 +34,6 @@ class Hylics2World(World): location_name_to_id = {data["name"]: loc_id for loc_id, data in all_locations.items()} option_definitions = Options.hylics2_options - topology_present: bool = True - data_version = 3 start_location = "Waynehouse" @@ -51,10 +49,6 @@ def create_item(self, name: str) -> "Hylics2Item": return Hylics2Item(name, self.all_items[item_id]["classification"], item_id, player=self.player) - def add_item(self, name: str, classification: ItemClassification, code: int) -> "Item": - return Hylics2Item(name, classification, code, self.player) - - def create_event(self, event: str): return Hylics2Item(event, ItemClassification.progression_skip_balancing, None, self.player) @@ -62,7 +56,7 @@ def create_event(self, event: str): # set random starting location if option is enabled def generate_early(self): if self.multiworld.random_start[self.player]: - i = self.multiworld.random.randint(0, 3) + i = self.random.randint(0, 3) if i == 0: self.start_location = "Waynehouse" elif i == 1: @@ -77,26 +71,26 @@ def create_items(self): pool = [] # add regular items - for i, data in Items.item_table.items(): - if data["count"] > 0: - for j in range(data["count"]): - pool.append(self.add_item(data["name"], data["classification"], i)) + for item in Items.item_table.values(): + if item["count"] > 0: + for _ in range(item["count"]): + pool.append(self.create_item(item["name"])) # add party members if option is enabled if self.multiworld.party_shuffle[self.player]: - for i, data in Items.party_item_table.items(): - pool.append(self.add_item(data["name"], data["classification"], i)) + for item in Items.party_item_table.values(): + pool.append(self.create_item(item["name"])) # handle gesture shuffle if not self.multiworld.gesture_shuffle[self.player]: # add gestures to pool like normal - for i, data in Items.gesture_item_table.items(): - pool.append(self.add_item(data["name"], data["classification"], i)) + for item in Items.gesture_item_table.values(): + pool.append(self.create_item(item["name"])) # add '10 Bones' items if medallion shuffle is enabled if self.multiworld.medallion_shuffle[self.player]: - for i, data in Items.medallion_item_table.items(): - for j in range(data["count"]): - pool.append(self.add_item(data["name"], data["classification"], i)) + for item in Items.medallion_item_table.values(): + for _ in range(item["count"]): + pool.append(self.create_item(item["name"])) # add to world's pool self.multiworld.itempool += pool @@ -107,48 +101,45 @@ def pre_fill(self): if self.multiworld.gesture_shuffle[self.player] == 2: # vanilla locations gestures = Items.gesture_item_table self.multiworld.get_location("Waynehouse: TV", self.player)\ - .place_locked_item(self.add_item(gestures[200678]["name"], gestures[200678]["classification"], 200678)) + .place_locked_item(self.create_item("POROMER BLEB")) self.multiworld.get_location("Afterlife: TV", self.player)\ - .place_locked_item(self.add_item(gestures[200683]["name"], gestures[200683]["classification"], 200683)) + .place_locked_item(self.create_item("TELEDENUDATE")) self.multiworld.get_location("New Muldul: TV", self.player)\ - .place_locked_item(self.add_item(gestures[200679]["name"], gestures[200679]["classification"], 200679)) + .place_locked_item(self.create_item("SOUL CRISPER")) self.multiworld.get_location("Viewax's Edifice: TV", self.player)\ - .place_locked_item(self.add_item(gestures[200680]["name"], gestures[200680]["classification"], 200680)) + .place_locked_item(self.create_item("TIME SIGIL")) self.multiworld.get_location("TV Island: TV", self.player)\ - .place_locked_item(self.add_item(gestures[200681]["name"], gestures[200681]["classification"], 200681)) + .place_locked_item(self.create_item("CHARGE UP")) self.multiworld.get_location("Juice Ranch: TV", self.player)\ - .place_locked_item(self.add_item(gestures[200682]["name"], gestures[200682]["classification"], 200682)) + .place_locked_item(self.create_item("FATE SANDBOX")) self.multiworld.get_location("Foglast: TV", self.player)\ - .place_locked_item(self.add_item(gestures[200684]["name"], gestures[200684]["classification"], 200684)) + .place_locked_item(self.create_item("LINK MOLLUSC")) self.multiworld.get_location("Drill Castle: TV", self.player)\ - .place_locked_item(self.add_item(gestures[200688]["name"], gestures[200688]["classification"], 200688)) + .place_locked_item(self.create_item("NEMATODE INTERFACE")) self.multiworld.get_location("Sage Airship: TV", self.player)\ - .place_locked_item(self.add_item(gestures[200685]["name"], gestures[200685]["classification"], 200685)) + .place_locked_item(self.create_item("BOMBO - GENESIS")) elif self.multiworld.gesture_shuffle[self.player] == 1: # TVs only - gestures = list(Items.gesture_item_table.items()) - tvs = list(Locations.tv_location_table.items()) + gestures = [gesture["name"] for gesture in Items.gesture_item_table.values()] + tvs = [tv["name"] for tv in Locations.tv_location_table.values()] # if Extra Items in Logic is enabled place CHARGE UP first and make sure it doesn't get # placed at Sage Airship: TV or Foglast: TV if self.multiworld.extra_items_in_logic[self.player]: - tv = self.multiworld.random.choice(tvs) - gest = gestures.index((200681, Items.gesture_item_table[200681])) - while tv[1]["name"] == "Sage Airship: TV" or tv[1]["name"] == "Foglast: TV": - tv = self.multiworld.random.choice(tvs) - self.multiworld.get_location(tv[1]["name"], self.player)\ - .place_locked_item(self.add_item(gestures[gest][1]["name"], gestures[gest][1]["classification"], - gestures[gest])) - gestures.remove(gestures[gest]) + tv = self.random.choice(tvs) + while tv == "Sage Airship: TV" or tv == "Foglast: TV": + tv = self.random.choice(tvs) + self.multiworld.get_location(tv, self.player)\ + .place_locked_item(self.create_item("CHARGE UP")) + gestures.remove("CHARGE UP") tvs.remove(tv) - for i in range(len(gestures)): - gest = self.multiworld.random.choice(gestures) - tv = self.multiworld.random.choice(tvs) - self.multiworld.get_location(tv[1]["name"], self.player)\ - .place_locked_item(self.add_item(gest[1]["name"], gest[1]["classification"], gest[0])) - gestures.remove(gest) - tvs.remove(tv) + self.random.shuffle(gestures) + self.random.shuffle(tvs) + while gestures: + gesture = gestures.pop() + tv = tvs.pop() + self.get_location(tv).place_locked_item(self.create_item(gesture)) def fill_slot_data(self) -> Dict[str, Any]: diff --git a/worlds/kdl3/Client.py b/worlds/kdl3/Client.py index a1e68f8b67e3..e33a680bc025 100644 --- a/worlds/kdl3/Client.py +++ b/worlds/kdl3/Client.py @@ -36,8 +36,10 @@ KDL3_GIFTING_FLAG = SRAM_1_START + 0x901C KDL3_LEVEL_ADDR = SRAM_1_START + 0x9020 KDL3_IS_DEMO = SRAM_1_START + 0x5AD5 -KDL3_GAME_STATE = SRAM_1_START + 0x36D0 KDL3_GAME_SAVE = SRAM_1_START + 0x3617 +KDL3_CURRENT_WORLD = SRAM_1_START + 0x363F +KDL3_CURRENT_LEVEL = SRAM_1_START + 0x3641 +KDL3_GAME_STATE = SRAM_1_START + 0x36D0 KDL3_LIFE_COUNT = SRAM_1_START + 0x39CF KDL3_KIRBY_HP = SRAM_1_START + 0x39D1 KDL3_BOSS_HP = SRAM_1_START + 0x39D5 @@ -46,8 +48,6 @@ KDL3_HEART_STARS = SRAM_1_START + 0x53A7 KDL3_WORLD_UNLOCK = SRAM_1_START + 0x53CB KDL3_LEVEL_UNLOCK = SRAM_1_START + 0x53CD -KDL3_CURRENT_WORLD = SRAM_1_START + 0x53CF -KDL3_CURRENT_LEVEL = SRAM_1_START + 0x53D3 KDL3_BOSS_STATUS = SRAM_1_START + 0x53D5 KDL3_INVINCIBILITY_TIMER = SRAM_1_START + 0x54B1 KDL3_MG5_STATUS = SRAM_1_START + 0x5EE4 @@ -74,7 +74,9 @@ 0x0202: " was out-numbered by Pon & Con.", 0x0203: " was defeated by Ado's powerful paintings.", 0x0204: " was clobbered by King Dedede.", - 0x0205: " lost their battle against Dark Matter." + 0x0205: " lost their battle against Dark Matter.", + 0x0300: " couldn't overcome the Boss Butch.", + 0x0400: " is bad at jumping.", }) @@ -281,6 +283,11 @@ async def game_watcher(self, ctx) -> None: for i in range(5): level_data = await snes_read(ctx, KDL3_LEVEL_ADDR + (14 * i), 14) self.levels[i] = unpack("HHHHHHH", level_data) + self.levels[5] = [0x0205, # Hyper Zone + 0, # MG-5, can't send from here + 0x0300, # Boss Butch + 0x0400, # Jumping + 0, 0, 0] if self.consumables is None: consumables = await snes_read(ctx, KDL3_CONSUMABLE_FLAG, 1) @@ -314,7 +321,7 @@ async def game_watcher(self, ctx) -> None: current_world = struct.unpack("H", await snes_read(ctx, KDL3_CURRENT_WORLD, 2))[0] current_level = struct.unpack("H", await snes_read(ctx, KDL3_CURRENT_LEVEL, 2))[0] currently_dead = current_hp[0] == 0x00 - message = deathlink_messages[self.levels[current_world][current_level - 1]] + message = deathlink_messages[self.levels[current_world][current_level]] await ctx.handle_deathlink_state(currently_dead, f"{ctx.player_names[ctx.slot]}{message}") recv_count = await snes_read(ctx, KDL3_RECV_COUNT, 2) diff --git a/worlds/kdl3/Regions.py b/worlds/kdl3/Regions.py index ed0d86586615..794a565e0a56 100644 --- a/worlds/kdl3/Regions.py +++ b/worlds/kdl3/Regions.py @@ -28,16 +28,30 @@ 0x77001C, # 5-4 needs Burning } +first_world_limit = { + # We need to limit the number of very restrictive stages in level 1 on solo gens + *first_stage_blacklist, # all three of the blacklist stages need 2+ items for both checks + 0x770007, + 0x770008, + 0x770013, + 0x77001E, -def generate_valid_level(level, stage, possible_stages, slot_random): - new_stage = slot_random.choice(possible_stages) - if level == 1 and stage == 0 and new_stage in first_stage_blacklist: - return generate_valid_level(level, stage, possible_stages, slot_random) - else: - return new_stage +} + + +def generate_valid_level(world: "KDL3World", level, stage, possible_stages, placed_stages): + new_stage = world.random.choice(possible_stages) + if level == 1: + if stage == 0 and new_stage in first_stage_blacklist: + return generate_valid_level(world, level, stage, possible_stages, placed_stages) + elif not (world.multiworld.players > 1 or world.options.consumables or world.options.starsanity) and \ + new_stage in first_world_limit and \ + sum(p_stage in first_world_limit for p_stage in placed_stages) >= 2: + return generate_valid_level(world, level, stage, possible_stages, placed_stages) + return new_stage -def generate_rooms(world: "KDL3World", door_shuffle: bool, level_regions: typing.Dict[int, Region]): +def generate_rooms(world: "KDL3World", level_regions: typing.Dict[int, Region]): level_names = {LocationName.level_names[level]: level for level in LocationName.level_names} room_data = orjson.loads(get_data(__name__, os.path.join("data", "Rooms.json"))) rooms: typing.Dict[str, KDL3Room] = dict() @@ -49,8 +63,8 @@ def generate_rooms(world: "KDL3World", door_shuffle: bool, level_regions: typing room.add_locations({location: world.location_name_to_id[location] if location in world.location_name_to_id else None for location in room_entry["locations"] if (not any(x in location for x in ["1-Up", "Maxim"]) or - world.options.consumables.value) and ("Star" not in location - or world.options.starsanity.value)}, + world.options.consumables.value) and ("Star" not in location + or world.options.starsanity.value)}, KDL3Location) rooms[room.name] = room for location in room.locations: @@ -62,33 +76,25 @@ def generate_rooms(world: "KDL3World", door_shuffle: bool, level_regions: typing world.multiworld.regions.extend(world.rooms) first_rooms: typing.Dict[int, KDL3Room] = dict() - if door_shuffle: - # first, we need to generate the notable edge cases - # 5-6 is the first, being the most restrictive - # half of its rooms are required to be vanilla, but can be in different orders - # the room before it *must* contain the copy ability required to unlock the room's goal - - raise NotImplementedError() - else: - for name, room in rooms.items(): - if room.room == 0: - if room.stage == 7: - first_rooms[0x770200 + room.level - 1] = room - else: - first_rooms[0x770000 + ((room.level - 1) * 6) + room.stage] = room - exits = dict() - for def_exit in room.default_exits: - target = f"{level_names[room.level]} {room.stage} - {def_exit['room']}" - access_rule = tuple(def_exit["access_rule"]) - exits[target] = lambda state, rule=access_rule: state.has_all(rule, world.player) - room.add_exits( - exits.keys(), - exits - ) - if world.options.open_world: - if any("Complete" in location.name for location in room.locations): - room.add_locations({f"{level_names[room.level]} {room.stage} - Stage Completion": None}, - KDL3Location) + for name, room in rooms.items(): + if room.room == 0: + if room.stage == 7: + first_rooms[0x770200 + room.level - 1] = room + else: + first_rooms[0x770000 + ((room.level - 1) * 6) + room.stage] = room + exits = dict() + for def_exit in room.default_exits: + target = f"{level_names[room.level]} {room.stage} - {def_exit['room']}" + access_rule = tuple(def_exit["access_rule"]) + exits[target] = lambda state, rule=access_rule: state.has_all(rule, world.player) + room.add_exits( + exits.keys(), + exits + ) + if world.options.open_world: + if any("Complete" in location.name for location in room.locations): + room.add_locations({f"{level_names[room.level]} {room.stage} - Stage Completion": None}, + KDL3Location) for level in world.player_levels: for stage in range(6): @@ -102,7 +108,7 @@ def generate_rooms(world: "KDL3World", door_shuffle: bool, level_regions: typing if world.options.open_world or stage == 0: level_regions[level].add_exits([first_rooms[proper_stage].name]) else: - world.multiworld.get_location(world.location_id_to_name[world.player_levels[level][stage-1]], + world.multiworld.get_location(world.location_id_to_name[world.player_levels[level][stage - 1]], world.player).parent_region.add_exits([first_rooms[proper_stage].name]) level_regions[level].add_exits([first_rooms[0x770200 + level - 1].name]) @@ -141,8 +147,7 @@ def generate_valid_levels(world: "KDL3World", enforce_world: bool, enforce_patte or (enforce_pattern and ((candidate - 1) & 0x00FFFF) % 6 == stage) or (enforce_pattern == enforce_world) ] - new_stage = generate_valid_level(level, stage, stage_candidates, - world.random) + new_stage = generate_valid_level(world, level, stage, stage_candidates, levels[level]) possible_stages.remove(new_stage) levels[level][stage] = new_stage except Exception: @@ -218,7 +223,7 @@ def create_levels(world: "KDL3World") -> None: level_shuffle == 1, level_shuffle == 2) - generate_rooms(world, False, levels) + generate_rooms(world, levels) level6.add_locations({LocationName.goals[world.options.goal]: None}, KDL3Location) diff --git a/worlds/kdl3/Rules.py b/worlds/kdl3/Rules.py index 91abc21d0623..6a85ef84f054 100644 --- a/worlds/kdl3/Rules.py +++ b/worlds/kdl3/Rules.py @@ -264,7 +264,7 @@ def set_rules(world: "KDL3World") -> None: for r in [range(1, 31), range(44, 51)]: for i in r: set_rule(world.multiworld.get_location(f"Cloudy Park 4 - Star {i}", world.player), - lambda state: can_reach_clean(state, world.player)) + lambda state: can_reach_coo(state, world.player)) for i in [18, *list(range(20, 25))]: set_rule(world.multiworld.get_location(f"Cloudy Park 6 - Star {i}", world.player), lambda state: can_reach_ice(state, world.player)) diff --git a/worlds/kdl3/docs/en_Kirby's Dream Land 3.md b/worlds/kdl3/docs/en_Kirby's Dream Land 3.md index c1e36fed546a..008ee0fcc1ee 100644 --- a/worlds/kdl3/docs/en_Kirby's Dream Land 3.md +++ b/worlds/kdl3/docs/en_Kirby's Dream Land 3.md @@ -1,8 +1,8 @@ # Kirby's Dream Land 3 -## Where is the settings page? +## Where is the options page? -The [player settings page for this game](../player-settings) contains all the options you need to configure and export a +The [player options page for this game](../player-options) contains all the options you need to configure and export a config file. ## What does randomization do to this game? @@ -15,6 +15,7 @@ as Heart Stars, 1-Ups, and Invincibility Candy will be shuffled into the pool fo - Purifying a boss after acquiring a certain number of Heart Stars (indicated by their portrait flashing in the level select) - If enabled, 1-Ups and Maxim Tomatoes +- If enabled, every single Star Piece within a stage ## When the player receives an item, what happens? A sound effect will play, and Kirby will immediately receive the effects of that item, such as being able to receive Copy Abilities from enemies that diff --git a/worlds/kdl3/docs/setup_en.md b/worlds/kdl3/docs/setup_en.md index a13a0f1a74cf..a73d248d4d18 100644 --- a/worlds/kdl3/docs/setup_en.md +++ b/worlds/kdl3/docs/setup_en.md @@ -43,8 +43,8 @@ guide: [Basic Multiworld Setup Guide](/tutorial/Archipelago/setup/en) ### Where do I get a config file? -The [Player Settings](/games/Kirby's%20Dream%20Land%203/player-settings) page on the website allows you to configure -your personal settings and export a config file from them. +The [Player Options](/games/Kirby's%20Dream%20Land%203/player-options) page on the website allows you to configure +your personal options and export a config file from them. ### Verifying your config file @@ -53,7 +53,7 @@ If you would like to validate your config file to make sure it works, you may do ## Generating a Single-Player Game -1. Navigate to the [Player Settings](/games/Kirby's%20Dream%20Land%203/player-settings) page, configure your options, +1. Navigate to the [Player Options](/games/Kirby's%20Dream%20Land%203/player-options) page, configure your options, and click the "Generate Game" button. 2. You will be presented with a "Seed Info" page. 3. Click the "Create New Room" link. diff --git a/worlds/kdl3/test/test_locations.py b/worlds/kdl3/test/test_locations.py index 543f0d83926d..433b4534d1e5 100644 --- a/worlds/kdl3/test/test_locations.py +++ b/worlds/kdl3/test/test_locations.py @@ -33,7 +33,8 @@ def test_simple_heart_stars(self): self.run_location_test(LocationName.iceberg_kogoesou, ["Burning"]) self.run_location_test(LocationName.iceberg_samus, ["Ice"]) self.run_location_test(LocationName.iceberg_name, ["Burning", "Coo", "ChuChu"]) - self.run_location_test(LocationName.iceberg_angel, ["Cutter", "Burning", "Spark", "Parasol", "Needle", "Clean", "Stone", "Ice"]) + self.run_location_test(LocationName.iceberg_angel, ["Cutter", "Burning", "Spark", "Parasol", "Needle", "Clean", + "Stone", "Ice"]) def run_location_test(self, location: str, itempool: typing.List[str]): items = itempool.copy() diff --git a/worlds/ladx/__init__.py b/worlds/ladx/__init__.py index 9de3462ad059..d662b526bb61 100644 --- a/worlds/ladx/__init__.py +++ b/worlds/ladx/__init__.py @@ -184,19 +184,22 @@ def create_items(self) -> None: self.pre_fill_items = [] # For any and different world, set item rule instead - for option in ["maps", "compasses", "small_keys", "nightmare_keys", "stone_beaks", "instruments"]: - option = "shuffle_" + option + for dungeon_item_type in ["maps", "compasses", "small_keys", "nightmare_keys", "stone_beaks", "instruments"]: + option = "shuffle_" + dungeon_item_type option = self.player_options[option] dungeon_item_types[option.ladxr_item] = option.value + # The color dungeon does not contain an instrument + num_items = 8 if dungeon_item_type == "instruments" else 9 + if option.value == DungeonItemShuffle.option_own_world: self.multiworld.local_items[self.player].value |= { - ladxr_item_to_la_item_name[f"{option.ladxr_item}{i}"] for i in range(1, 10) + ladxr_item_to_la_item_name[f"{option.ladxr_item}{i}"] for i in range(1, num_items + 1) } elif option.value == DungeonItemShuffle.option_different_world: self.multiworld.non_local_items[self.player].value |= { - ladxr_item_to_la_item_name[f"{option.ladxr_item}{i}"] for i in range(1, 10) + ladxr_item_to_la_item_name[f"{option.ladxr_item}{i}"] for i in range(1, num_items + 1) } # option_original_dungeon = 0 # option_own_dungeons = 1 diff --git a/worlds/messenger/__init__.py b/worlds/messenger/__init__.py index c40ca02f42f1..5e1b12778638 100644 --- a/worlds/messenger/__init__.py +++ b/worlds/messenger/__init__.py @@ -1,4 +1,5 @@ import logging +from datetime import date from typing import Any, ClassVar, Dict, List, Optional, TextIO from BaseClasses import CollectionState, Entrance, Item, ItemClassification, MultiWorld, Tutorial @@ -9,7 +10,8 @@ from worlds.LauncherComponents import Component, Type, components from .client_setup import launch_game from .connections import CONNECTIONS, RANDOMIZED_CONNECTIONS, TRANSITIONS -from .constants import ALL_ITEMS, ALWAYS_LOCATIONS, BOSS_LOCATIONS, FILLER, NOTES, PHOBEKINS, PROG_ITEMS, USEFUL_ITEMS +from .constants import ALL_ITEMS, ALWAYS_LOCATIONS, BOSS_LOCATIONS, FILLER, NOTES, PHOBEKINS, PROG_ITEMS, TRAPS, \ + USEFUL_ITEMS from .options import AvailablePortals, Goal, Logic, MessengerOptions, NotesNeeded, ShuffleTransitions from .portals import PORTALS, add_closed_portal_reqs, disconnect_portals, shuffle_portals, validate_portals from .regions import LEVELS, MEGA_SHARDS, LOCATIONS, REGION_CONNECTIONS @@ -110,7 +112,7 @@ class MessengerWorld(World): }, } - required_client_version = (0, 4, 3) + required_client_version = (0, 4, 4) web = MessengerWeb() @@ -127,6 +129,7 @@ class MessengerWorld(World): portal_mapping: List[int] transitions: List[Entrance] reachable_locs: int = 0 + filler: Dict[str, int] def generate_early(self) -> None: if self.options.goal == Goal.option_power_seal_hunt: @@ -146,8 +149,9 @@ def generate_early(self) -> None: self.starting_portals = [f"{portal} Portal" for portal in starting_portals[:3] + self.random.sample(starting_portals[3:], k=self.options.available_portals - 3)] + # super complicated method for adding searing crags to starting portals if it wasn't chosen - # need to add a check for transition shuffle when that gets added back in + # TODO add a check for transition shuffle when that gets added back in if not self.options.shuffle_portals and "Searing Crags Portal" not in self.starting_portals: self.starting_portals.append("Searing Crags Portal") if len(self.starting_portals) > 4: @@ -155,6 +159,10 @@ def generate_early(self) -> None: if portal in self.starting_portals] self.starting_portals.remove(self.random.choice(portals_to_strip)) + self.filler = FILLER.copy() + if (not hasattr(self.options, "traps") and date.today() < date(2024, 4, 2)) or self.options.traps: + self.filler.update(TRAPS) + self.plando_portals = [] self.portal_mapping = [] self.spoiler_portal_mapping = {} @@ -182,12 +190,13 @@ def create_regions(self) -> None: def create_items(self) -> None: # create items that are always in the item pool main_movement_items = ["Rope Dart", "Wingsuit"] + precollected_names = [item.name for item in self.multiworld.precollected_items[self.player]] itempool: List[MessengerItem] = [ self.create_item(item) for item in self.item_name_to_id - if "Time Shard" not in item and item not in { + if item not in { "Power Seal", *NOTES, *FIGURINES, *main_movement_items, - *{collected_item.name for collected_item in self.multiworld.precollected_items[self.player]}, + *precollected_names, *FILLER, *TRAPS, } ] @@ -199,7 +208,7 @@ def create_items(self) -> None: if self.options.goal == Goal.option_open_music_box: # make a list of all notes except those in the player's defined starting inventory, and adjust the # amount we need to put in the itempool and precollect based on that - notes = [note for note in NOTES if note not in self.multiworld.precollected_items[self.player]] + notes = [note for note in NOTES if note not in precollected_names] self.random.shuffle(notes) precollected_notes_amount = NotesNeeded.range_end - \ self.options.notes_needed - \ @@ -228,8 +237,8 @@ def create_items(self) -> None: remaining_fill = len(self.multiworld.get_unfilled_locations(self.player)) - len(itempool) if remaining_fill < 10: self._filler_items = self.random.choices( - list(FILLER)[2:], - weights=list(FILLER.values())[2:], + list(self.filler)[2:], + weights=list(self.filler.values())[2:], k=remaining_fill ) filler = [self.create_filler() for _ in range(remaining_fill)] @@ -300,8 +309,8 @@ def fill_slot_data(self) -> Dict[str, Any]: def get_filler_item_name(self) -> str: if not getattr(self, "_filler_items", None): self._filler_items = [name for name in self.random.choices( - list(FILLER), - weights=list(FILLER.values()), + list(self.filler), + weights=list(self.filler.values()), k=20 )] return self._filler_items.pop(0) @@ -335,6 +344,9 @@ def get_item_classification(self, name: str) -> ItemClassification: if name in {*USEFUL_ITEMS, *USEFUL_SHOP_ITEMS}: return ItemClassification.useful + + if name in TRAPS: + return ItemClassification.trap return ItemClassification.filler diff --git a/worlds/messenger/constants.py b/worlds/messenger/constants.py index 0c4d6a944cef..ea15c71068db 100644 --- a/worlds/messenger/constants.py +++ b/worlds/messenger/constants.py @@ -48,6 +48,11 @@ "Time Shard (500)": 5, } +TRAPS = { + "Teleport Trap": 5, + "Prophecy Trap": 10, +} + # item_name_to_id needs to be deterministic and match upstream ALL_ITEMS = [ *NOTES, @@ -71,6 +76,8 @@ *SHOP_ITEMS, *FIGURINES, "Money Wrench", + "Teleport Trap", + "Prophecy Trap", ] # locations diff --git a/worlds/messenger/docs/en_The Messenger.md b/worlds/messenger/docs/en_The Messenger.md index f071ba1c1435..8248a4755d3f 100644 --- a/worlds/messenger/docs/en_The Messenger.md +++ b/worlds/messenger/docs/en_The Messenger.md @@ -49,30 +49,29 @@ for it. The groups you can use for The Messenger are: ## Other changes * The player can return to the Tower of Time HQ at any point by selecting the button from the options menu - * This can cause issues if used at specific times. Current known: - * During Boss fights - * After Courage Note collection (Corrupted Future chase) - * This is currently an expected action in logic. If you do need to teleport during this chase sequence, it - is recommended to quit to title and reload the save + * This can cause issues if used at specific times. If used in any of these known problematic areas, immediately +quit to title and reload the save. The currently known areas include: + * During Boss fights + * After Courage Note collection (Corrupted Future chase) * After reaching ninja village a teleport option is added to the menu to reach it quickly * Toggle Windmill Shuriken button is added to option menu once the item is received -* The mod option menu will also have a hint item button, as well as a release and collect button that are all placed when - the player fulfills the necessary conditions. +* The mod option menu will also have a hint item button, as well as a release and collect button that are all placed +when the player fulfills the necessary conditions. * After running the game with the mod, a config file (APConfig.toml) will be generated in your game folder that can be - used to modify certain settings such as text size and color. This can also be used to specify a player name that can't - be entered in game. +used to modify certain settings such as text size and color. This can also be used to specify a player name that can't +be entered in game. ## Known issues * Ruxxtin Coffin cutscene will sometimes not play correctly, but will still reward the item * If you receive the Magic Firefly while in Quillshroom Marsh, The De-curse Queen cutscene will not play. You can exit - to Searing Crags and re-enter to get it to play correctly. -* Sometimes upon teleporting back to HQ, Ninja will run left and enter a different portal than the one entered by the - player. This may also cause a softlock. +to Searing Crags and re-enter to get it to play correctly. +* Teleporting back to HQ, then returning to the same level you just left through a Portal can cause Ninja to run left +and enter a different portal than the one entered by the player or lead to other incorrect inputs, causing a soft lock * Text entry menus don't accept controller input * In power seal hunt mode, the chest must be opened by entering the shop from a level. Teleporting to HQ and opening the - chest will not work. +chest will not work. ## What do I do if I have a problem? -If you believe something happened that isn't intended, please get the `log.txt` from the folder of your game installation -and send a bug report either on GitHub or the [Archipelago Discord Server](http://archipelago.gg/discord) +If you believe something happened that isn't intended, please get the `log.txt` from the folder of your game +installation and send a bug report either on GitHub or the [Archipelago Discord Server](http://archipelago.gg/discord) diff --git a/worlds/messenger/docs/setup_en.md b/worlds/messenger/docs/setup_en.md index d986b70f9c98..c1770e747442 100644 --- a/worlds/messenger/docs/setup_en.md +++ b/worlds/messenger/docs/setup_en.md @@ -18,17 +18,17 @@ Read changes to the base game on the [Game Info Page](/games/The%20Messenger/inf 3. Click on "The Messenger" 4. Follow the prompts +These steps can also be followed to launch the game and check for mod updates after the initial setup. + ### Manual Installation 1. Download and install Courier Mod Loader using the instructions on the release page * [Latest release is currently 0.7.1](https://github.com/Brokemia/Courier/releases) 2. Download and install the randomizer mod 1. Download the latest TheMessengerRandomizerAP.zip from - [The Messenger Randomizer Mod AP releases page](https://github.com/alwaysintreble/TheMessengerRandomizerModAP/releases) +[The Messenger Randomizer Mod AP releases page](https://github.com/alwaysintreble/TheMessengerRandomizerModAP/releases) 2. Extract the zip file to `TheMessenger/Mods/` of your game's install location - * You cannot have both the non-AP randomizer and the AP randomizer installed at the same time. The AP randomizer - is backwards compatible, so the non-AP mod can be safely removed, and you can still play seeds generated from the - non-AP randomizer. + * You cannot have both the non-AP randomizer and the AP randomizer installed at the same time 3. Optionally, Backup your save game * On Windows 1. Press `Windows Key + R` to open run @@ -46,13 +46,13 @@ Read changes to the base game on the [Game Info Page](/games/The%20Messenger/inf 3. Enter connection info using the relevant option buttons * **The game is limited to alphanumerical characters, `.`, and `-`.** * This defaults to `archipelago.gg` and does not need to be manually changed if connecting to a game hosted on the - website. +website. * If using a name that cannot be entered in the in game menus, there is a config file (APConfig.toml) in the game - directory. When using this, all connection information must be entered in the file. +directory. When using this, all connection information must be entered in the file. 4. Select the `Connect to Archipelago` button 5. Navigate to save file selection 6. Start a new game - * If you're already connected, deleting a save will not disconnect you and is completely safe. + * If you're already connected, deleting an existing save will not disconnect you and is completely safe. ## Continuing a MultiWorld Game diff --git a/worlds/messenger/options.py b/worlds/messenger/options.py index c56ee700438f..990975a926f9 100644 --- a/worlds/messenger/options.py +++ b/worlds/messenger/options.py @@ -1,4 +1,5 @@ from dataclasses import dataclass +from datetime import date from typing import Dict from schema import And, Optional, Or, Schema @@ -88,7 +89,7 @@ class ShuffleTransitions(Choice): class Goal(Choice): - """Requirement to finish the game.""" + """Requirement to finish the game. To win with the power seal hunt goal, you must enter the Music Box through the shop chest.""" display_name = "Goal" option_open_music_box = 0 option_power_seal_hunt = 1 @@ -123,6 +124,11 @@ class RequiredSeals(Range): default = range_end +class Traps(Toggle): + """Whether traps should be included in the itempool.""" + display_name = "Include Traps" + + class ShopPrices(Range): """Percentage modifier for shuffled item prices in shops""" display_name = "Shop Prices Modifier" @@ -199,3 +205,6 @@ class MessengerOptions(DeathLinkMixin, PerGameCommonOptions): percent_seals_required: RequiredSeals shop_price: ShopPrices shop_price_plan: PlannedShopPrices + + if date.today() > date(2024, 4, 1): + traps: Traps diff --git a/worlds/messenger/portals.py b/worlds/messenger/portals.py index 64438b018400..51f51d7e379e 100644 --- a/worlds/messenger/portals.py +++ b/worlds/messenger/portals.py @@ -1,3 +1,4 @@ +from copy import deepcopy from typing import List, TYPE_CHECKING from BaseClasses import CollectionState, PlandoOptions @@ -18,24 +19,6 @@ ] -REGION_ORDER = [ - "Autumn Hills", - "Forlorn Temple", - "Catacombs", - "Bamboo Creek", - "Howling Grotto", - "Quillshroom Marsh", - "Searing Crags", - "Glacial Peak", - "Tower of Time", - "Cloud Ruins", - "Underworld", - "Riviere Turquoise", - "Elemental Skylands", - "Sunken Shrine", -] - - SHOP_POINTS = { "Autumn Hills": [ "Climbing Claws", @@ -204,30 +187,48 @@ } +REGION_ORDER = [ + "Autumn Hills", + "Forlorn Temple", + "Catacombs", + "Bamboo Creek", + "Howling Grotto", + "Quillshroom Marsh", + "Searing Crags", + "Glacial Peak", + "Tower of Time", + "Cloud Ruins", + "Underworld", + "Riviere Turquoise", + "Elemental Skylands", + "Sunken Shrine", +] + + def shuffle_portals(world: "MessengerWorld") -> None: - def create_mapping(in_portal: str, warp: str) -> None: - nonlocal available_portals + """shuffles the output of the portals from the main hub""" + def create_mapping(in_portal: str, warp: str) -> str: + """assigns the chosen output to the input""" parent = out_to_parent[warp] exit_string = f"{parent.strip(' ')} - " if "Portal" in warp: exit_string += "Portal" world.portal_mapping.append(int(f"{REGION_ORDER.index(parent)}00")) - elif warp_point in SHOP_POINTS[parent]: - exit_string += f"{warp_point} Shop" - world.portal_mapping.append(int(f"{REGION_ORDER.index(parent)}1{SHOP_POINTS[parent].index(warp_point)}")) + elif warp in SHOP_POINTS[parent]: + exit_string += f"{warp} Shop" + world.portal_mapping.append(int(f"{REGION_ORDER.index(parent)}1{SHOP_POINTS[parent].index(warp)}")) else: - exit_string += f"{warp_point} Checkpoint" - world.portal_mapping.append(int(f"{REGION_ORDER.index(parent)}2{CHECKPOINTS[parent].index(warp_point)}")) + exit_string += f"{warp} Checkpoint" + world.portal_mapping.append(int(f"{REGION_ORDER.index(parent)}2{CHECKPOINTS[parent].index(warp)}")) world.spoiler_portal_mapping[in_portal] = exit_string connect_portal(world, in_portal, exit_string) - available_portals.remove(warp) - if shuffle_type < ShufflePortals.option_anywhere: - available_portals = [port for port in available_portals if port not in shop_points[parent]] + return parent def handle_planned_portals(plando_connections: List[PlandoConnection]) -> None: + """checks the provided plando connections for portals and connects them""" for connection in plando_connections: if connection.entrance not in PORTALS: continue @@ -236,22 +237,28 @@ def handle_planned_portals(plando_connections: List[PlandoConnection]) -> None: world.plando_portals.append(connection.entrance) shuffle_type = world.options.shuffle_portals - shop_points = SHOP_POINTS.copy() + shop_points = deepcopy(SHOP_POINTS) for portal in PORTALS: shop_points[portal].append(f"{portal} Portal") if shuffle_type > ShufflePortals.option_shops: - shop_points.update(CHECKPOINTS) + for area, points in CHECKPOINTS.items(): + shop_points[area] += points out_to_parent = {checkpoint: parent for parent, checkpoints in shop_points.items() for checkpoint in checkpoints} available_portals = [val for zone in shop_points.values() for val in zone] + world.random.shuffle(available_portals) plando = world.multiworld.plando_connections[world.player] if plando and world.multiworld.plando_options & PlandoOptions.connections: handle_planned_portals(plando) - world.multiworld.plando_connections[world.player] = [connection for connection in plando - if connection.entrance not in PORTALS] + for portal in PORTALS: - warp_point = world.random.choice(available_portals) - create_mapping(portal, warp_point) + if portal in world.plando_portals: + continue + warp_point = available_portals.pop() + parent = create_mapping(portal, warp_point) + if shuffle_type < ShufflePortals.option_anywhere: + available_portals = [port for port in available_portals if port not in shop_points[parent]] + world.random.shuffle(available_portals) def connect_portal(world: "MessengerWorld", portal: str, out_region: str) -> None: diff --git a/worlds/pokemon_emerald/__init__.py b/worlds/pokemon_emerald/__init__.py index 384bec9f4501..c7f060a72969 100644 --- a/worlds/pokemon_emerald/__init__.py +++ b/worlds/pokemon_emerald/__init__.py @@ -300,6 +300,7 @@ def exclude_locations(location_names: List[str]): # Locations which are directly unlocked by defeating Norman. exclude_locations([ + "Petalburg Gym - Leader Norman", "Petalburg Gym - Balance Badge", "Petalburg Gym - TM42 from Norman", "Petalburg City - HM03 from Wally's Uncle", @@ -568,14 +569,6 @@ def generate_output(self, output_directory: str) -> None: self.modified_misc_pokemon = copy.deepcopy(emerald_data.misc_pokemon) self.modified_starters = copy.deepcopy(emerald_data.starters) - randomize_abilities(self) - randomize_learnsets(self) - randomize_tm_hm_compatibility(self) - randomize_legendary_encounters(self) - randomize_misc_pokemon(self) - randomize_opponent_parties(self) - randomize_starters(self) - # Modify catch rate min_catch_rate = min(self.options.min_catch_rate.value, 255) for species in self.modified_species.values(): @@ -590,6 +583,14 @@ def generate_output(self, output_directory: str) -> None: new_moves.add(new_move) self.modified_tmhm_moves[i] = new_move + randomize_abilities(self) + randomize_learnsets(self) + randomize_tm_hm_compatibility(self) + randomize_legendary_encounters(self) + randomize_misc_pokemon(self) + randomize_opponent_parties(self) + randomize_starters(self) + create_patch(self, output_directory) del self.modified_trainers diff --git a/worlds/pokemon_emerald/data.py b/worlds/pokemon_emerald/data.py index c4f7d7711c81..786740a9e48f 100644 --- a/worlds/pokemon_emerald/data.py +++ b/worlds/pokemon_emerald/data.py @@ -646,7 +646,7 @@ def _init() -> None: ("SPECIES_CHIKORITA", "Chikorita", 152), ("SPECIES_BAYLEEF", "Bayleef", 153), ("SPECIES_MEGANIUM", "Meganium", 154), - ("SPECIES_CYNDAQUIL", "Cindaquil", 155), + ("SPECIES_CYNDAQUIL", "Cyndaquil", 155), ("SPECIES_QUILAVA", "Quilava", 156), ("SPECIES_TYPHLOSION", "Typhlosion", 157), ("SPECIES_TOTODILE", "Totodile", 158), diff --git a/worlds/pokemon_emerald/data/locations.json b/worlds/pokemon_emerald/data/locations.json index fdaec9b83ca0..6affdf414688 100644 --- a/worlds/pokemon_emerald/data/locations.json +++ b/worlds/pokemon_emerald/data/locations.json @@ -1784,7 +1784,7 @@ "tags": ["BerryTree"] }, "BERRY_TREE_65": { - "label": "Route 123 - Berry Master Berry Tree 9", + "label": "Route 123 - Berry Tree Berry Master 9", "tags": ["BerryTree"] }, "BERRY_TREE_66": { @@ -2497,7 +2497,7 @@ "tags": ["Pokedex"] }, "POKEDEX_REWARD_155": { - "label": "Pokedex - Cindaquil", + "label": "Pokedex - Cyndaquil", "tags": ["Pokedex"] }, "POKEDEX_REWARD_156": { diff --git a/worlds/pokemon_emerald/opponents.py b/worlds/pokemon_emerald/opponents.py index f485282515a1..09e947546d7c 100644 --- a/worlds/pokemon_emerald/opponents.py +++ b/worlds/pokemon_emerald/opponents.py @@ -80,7 +80,7 @@ def randomize_opponent_parties(world: "PokemonEmeraldWorld") -> None: per_species_tmhm_moves[new_species.species_id] = sorted({ world.modified_tmhm_moves[i] for i, is_compatible in enumerate(int_to_bool_array(new_species.tm_hm_compatibility)) - if is_compatible + if is_compatible and world.modified_tmhm_moves[i] not in world.blacklisted_moves }) # TMs and HMs compatible with the species diff --git a/worlds/sc2/Items.py b/worlds/sc2/Items.py index 85fb34e875af..8277d0e7e13d 100644 --- a/worlds/sc2/Items.py +++ b/worlds/sc2/Items.py @@ -661,11 +661,11 @@ def get_full_item_list(): description=RESOURCE_EFFICIENCY_DESCRIPTION_TEMPLATE.format("HERC")), ItemNames.HERC_JUGGERNAUT_PLATING: ItemData(285 + SC2WOL_ITEM_ID_OFFSET, "Armory 6", 16, SC2Race.TERRAN, - parent_item=ItemNames.WARHOUND, origin={"ext"}, + parent_item=ItemNames.HERC, origin={"ext"}, description="Increases HERC armor by 2."), ItemNames.HERC_KINETIC_FOAM: ItemData(286 + SC2WOL_ITEM_ID_OFFSET, "Armory 6", 17, SC2Race.TERRAN, - parent_item=ItemNames.WARHOUND, origin={"ext"}, + parent_item=ItemNames.HERC, origin={"ext"}, description="Increases HERC life by 50."), ItemNames.HELLION_TWIN_LINKED_FLAMETHROWER: diff --git a/worlds/sc2/Locations.py b/worlds/sc2/Locations.py index 5a03f2232348..22b400a238dd 100644 --- a/worlds/sc2/Locations.py +++ b/worlds/sc2/Locations.py @@ -1620,7 +1620,7 @@ def get_locations(world: Optional[World]) -> Tuple[LocationData, ...]: plando_locations = get_plando_locations(world) exclude_locations = get_option_value(world, "exclude_locations") location_table = [location for location in location_table - if (LocationType is LocationType.VICTORY or location.name not in exclude_locations) + if (location.type is LocationType.VICTORY or location.name not in exclude_locations) and location.type not in excluded_location_types or location.name in plando_locations] for i, location_data in enumerate(location_table): diff --git a/worlds/shorthike/docs/en_A Short Hike.md b/worlds/shorthike/docs/en_A Short Hike.md index 516bf28e47fc..11b5b4b8ca85 100644 --- a/worlds/shorthike/docs/en_A Short Hike.md +++ b/worlds/shorthike/docs/en_A Short Hike.md @@ -26,5 +26,4 @@ To achieve the Help Everyone goal, the following characters will need to be help ## Can I have more than one save at a time? -No, unfortunately only one save slot is available for use in A Short Hike. -Starting a new save will erase the old one _permanently_. \ No newline at end of file +You can have up to 3 saves at a time. To switch between them, use the Save Data button in the options menu. diff --git a/worlds/shorthike/docs/setup_en.md b/worlds/shorthike/docs/setup_en.md index e327d8bed93c..85d5a8f5eb16 100644 --- a/worlds/shorthike/docs/setup_en.md +++ b/worlds/shorthike/docs/setup_en.md @@ -14,12 +14,13 @@ ## Installation -1. Download the [Modding Tools](https://github.com/BrandenEK/AShortHike.ModdingTools/releases), and follow -the [installation instructions](https://github.com/BrandenEK/AShortHike.ModdingTools#a-short-hike-modding-tools) on the GitHub page. +1. Open the [Modding Tools GitHub page](https://github.com/BrandenEK/AShortHike.ModdingTools/), and follow +the installation instructions. After this step, your `A Short Hike/` folder should have an empty `Modding/` subfolder. 2. After the Modding Tools have been installed, download the -[Randomizer](https://github.com/BrandenEK/AShortHike.Randomizer/releases) and extract the contents of it -into the `Modding` folder. +[Randomizer](https://github.com/BrandenEK/AShortHike.Randomizer/releases) zip, extract it, and move the contents +of the `Randomizer/` folder into your `Modding/` folder. After this step, your `Modding/` folder should have + `data/` and `plugins/` subfolders. ## Connecting @@ -29,4 +30,4 @@ Enter in the Server Port, Name, and Password (optional) in the popup menu that a ## Tracking Install PopTracker from the link above and place the PopTracker pack into the packs folder. -Connect to Archipelago via the AP button in the top left. \ No newline at end of file +Connect to Archipelago via the AP button in the top left. diff --git a/worlds/smw/docs/en_Super Mario World.md b/worlds/smw/docs/en_Super Mario World.md index 26623bac83d3..f7a12839df4d 100644 --- a/worlds/smw/docs/en_Super Mario World.md +++ b/worlds/smw/docs/en_Super Mario World.md @@ -25,10 +25,16 @@ There are two goals which can be chosen: ## What items and locations get shuffled? -Each unique level exit awards a location check. Optionally, collecting five Dragon Coins in each level can also award a location check. +Each unique level exit awards a location check. Additionally, the following in-level actions can be set to award a location check: +- Collecting Five Dragon Coins +- Collecting 3-Up Moons +- Activating Bonus Blocks +- Receiving Hidden 1-Ups +- Hitting Blocks containing coins or items + Mario's various abilities and powerups as described above are placed into the item pool. If the player is playing Yoshi Egg Hunt, a certain number of Yoshi Eggs will be placed into the item pool. -Any additional items that are needed to fill out the item pool with be 1-Up Mushrooms. +Any additional items that are needed to fill out the item pool will be 1-Up Mushrooms, bundles of coins, or, if enabled, various trap items. ## Which items can be in another player's world? diff --git a/worlds/soe/__init__.py b/worlds/soe/__init__.py index bbe018da5329..dcca722ad1fe 100644 --- a/worlds/soe/__init__.py +++ b/worlds/soe/__init__.py @@ -13,7 +13,7 @@ from worlds.AutoWorld import WebWorld, World from worlds.generic.Rules import add_item_rule, set_rule from .logic import SoEPlayerLogic -from .options import Difficulty, EnergyCore, SoEOptions +from .options import Difficulty, EnergyCore, Sniffamizer, SniffIngredients, SoEOptions from .patch import SoEDeltaPatch, get_base_rom_path if typing.TYPE_CHECKING: @@ -64,20 +64,28 @@ pyevermizer.CHECK_BOSS: _id_base + 50, # bosses 64050..6499 pyevermizer.CHECK_GOURD: _id_base + 100, # gourds 64100..64399 pyevermizer.CHECK_NPC: _id_base + 400, # npc 64400..64499 - # TODO: sniff 64500..64799 + # blank 64500..64799 pyevermizer.CHECK_EXTRA: _id_base + 800, # extra items 64800..64899 pyevermizer.CHECK_TRAP: _id_base + 900, # trap 64900..64999 + pyevermizer.CHECK_SNIFF: _id_base + 1000 # sniff 65000..65592 } # cache native evermizer items and locations _items = pyevermizer.get_items() +_sniff_items = pyevermizer.get_sniff_items() # optional, not part of the default location pool _traps = pyevermizer.get_traps() _extras = pyevermizer.get_extra_items() # items that are not placed by default _locations = pyevermizer.get_locations() +_sniff_locations = pyevermizer.get_sniff_locations() # optional, not part of the default location pool # fix up texts for AP for _loc in _locations: if _loc.type == pyevermizer.CHECK_GOURD: - _loc.name = f'{_loc.name} #{_loc.index}' + _loc.name = f"{_loc.name} #{_loc.index}" +for _loc in _sniff_locations: + if _loc.type == pyevermizer.CHECK_SNIFF: + _loc.name = f"{_loc.name} Sniff #{_loc.index}" +del _loc + # item helpers _ingredients = ( 'Wax', 'Water', 'Vinegar', 'Root', 'Oil', 'Mushroom', 'Mud Pepper', 'Meteorite', 'Limestone', 'Iron', @@ -97,7 +105,7 @@ def _match_item_name(item: pyevermizer.Item, substr: str) -> bool: def _get_location_mapping() -> typing.Tuple[typing.Dict[str, int], typing.Dict[int, pyevermizer.Location]]: name_to_id = {} id_to_raw = {} - for loc in _locations: + for loc in itertools.chain(_locations, _sniff_locations): ap_id = _id_offset[loc.type] + loc.index id_to_raw[ap_id] = loc name_to_id[loc.name] = ap_id @@ -108,7 +116,7 @@ def _get_location_mapping() -> typing.Tuple[typing.Dict[str, int], typing.Dict[i def _get_item_mapping() -> typing.Tuple[typing.Dict[str, int], typing.Dict[int, pyevermizer.Item]]: name_to_id = {} id_to_raw = {} - for item in itertools.chain(_items, _extras, _traps): + for item in itertools.chain(_items, _sniff_items, _extras, _traps): if item.name in name_to_id: continue ap_id = _id_offset[item.type] + item.index @@ -168,9 +176,9 @@ class SoEWorld(World): options: SoEOptions settings: typing.ClassVar[SoESettings] topology_present = False - data_version = 4 + data_version = 5 web = SoEWebWorld() - required_client_version = (0, 3, 5) + required_client_version = (0, 4, 4) item_name_to_id, item_id_to_raw = _get_item_mapping() location_name_to_id, location_id_to_raw = _get_location_mapping() @@ -238,16 +246,26 @@ def get_sphere_index(evermizer_loc: pyevermizer.Location) -> int: spheres.setdefault(get_sphere_index(loc), {}).setdefault(loc.type, []).append( SoELocation(self.player, loc.name, self.location_name_to_id[loc.name], ingame, loc.difficulty > max_difficulty)) + # extend pool if feature and setting enabled + if hasattr(Sniffamizer, "option_everywhere") and self.options.sniffamizer == Sniffamizer.option_everywhere: + for loc in _sniff_locations: + spheres.setdefault(get_sphere_index(loc), {}).setdefault(loc.type, []).append( + SoELocation(self.player, loc.name, self.location_name_to_id[loc.name], ingame, + loc.difficulty > max_difficulty)) # location balancing data trash_fills: typing.Dict[int, typing.Dict[int, typing.Tuple[int, int, int, int]]] = { - 0: {pyevermizer.CHECK_GOURD: (20, 40, 40, 40)}, # remove up to 40 gourds from sphere 1 - 1: {pyevermizer.CHECK_GOURD: (70, 90, 90, 90)}, # remove up to 90 gourds from sphere 2 + 0: {pyevermizer.CHECK_GOURD: (20, 40, 40, 40), # remove up to 40 gourds from sphere 1 + pyevermizer.CHECK_SNIFF: (100, 130, 130, 130)}, # remove up to 130 sniff spots from sphere 1 + 1: {pyevermizer.CHECK_GOURD: (70, 90, 90, 90), # remove up to 90 gourds from sphere 2 + pyevermizer.CHECK_SNIFF: (160, 200, 200, 200)}, # remove up to 200 sniff spots from sphere 2 } # mark some as excluded based on numbers above for trash_sphere, fills in trash_fills.items(): for typ, counts in fills.items(): + if typ not in spheres[trash_sphere]: + continue # e.g. player does not have sniff locations count = counts[self.options.difficulty.value] for location in self.random.sample(spheres[trash_sphere][typ], count): assert location.name != "Energy Core #285", "Error in sphere generation" @@ -299,6 +317,15 @@ def create_items(self) -> None: # remove one pair of wings that will be placed in generate_basic items.remove(self.create_item("Wings")) + # extend pool if feature and setting enabled + if hasattr(Sniffamizer, "option_everywhere") and self.options.sniffamizer == Sniffamizer.option_everywhere: + if self.options.sniff_ingredients == SniffIngredients.option_vanilla_ingredients: + # vanilla ingredients + items += list(map(lambda item: self.create_item(item), _sniff_items)) + else: + # random ingredients + items += [self.create_item(self.get_filler_item_name()) for _ in _sniff_items] + def is_ingredient(item: pyevermizer.Item) -> bool: for ingredient in _ingredients: if _match_item_name(item, ingredient): @@ -345,7 +372,12 @@ def set_rules(self) -> None: set_rule(self.multiworld.get_location('Done', self.player), lambda state: self.logic.has(state, pyevermizer.P_FINAL_BOSS)) set_rule(self.multiworld.get_entrance('New Game', self.player), lambda state: True) - for loc in _locations: + locations: typing.Iterable[pyevermizer.Location] + if hasattr(Sniffamizer, "option_everywhere") and self.options.sniffamizer == Sniffamizer.option_everywhere: + locations = itertools.chain(_locations, _sniff_locations) + else: + locations = _locations + for loc in locations: location = self.multiworld.get_location(loc.name, self.player) set_rule(location, self.make_rule(loc.requires)) diff --git a/worlds/soe/logic.py b/worlds/soe/logic.py index ee81c76e58de..92ffb14b3f95 100644 --- a/worlds/soe/logic.py +++ b/worlds/soe/logic.py @@ -1,4 +1,5 @@ import typing +from itertools import chain from typing import Callable, Set from . import pyevermizer @@ -11,10 +12,12 @@ # TODO: resolve/flatten/expand rules to get rid of recursion below where possible # Logic.rules are all rules including locations, excluding those with no progress (i.e. locations that only drop items) -rules = [rule for rule in pyevermizer.get_logic() if len(rule.provides) > 0] +rules = pyevermizer.get_logic() # Logic.items are all items and extra items excluding non-progression items and duplicates +# NOTE: we are skipping sniff items here because none of them is supposed to provide progression item_names: Set[str] = set() -items = [item for item in filter(lambda item: item.progression, pyevermizer.get_items() + pyevermizer.get_extra_items()) +items = [item for item in filter(lambda item: item.progression, # type: ignore[arg-type] + chain(pyevermizer.get_items(), pyevermizer.get_extra_items())) if item.name not in item_names and not item_names.add(item.name)] # type: ignore[func-returns-value] diff --git a/worlds/soe/options.py b/worlds/soe/options.py index c5ac02c22d03..5ecd0f9e6666 100644 --- a/worlds/soe/options.py +++ b/worlds/soe/options.py @@ -1,4 +1,5 @@ from dataclasses import dataclass, fields +from datetime import datetime from typing import Any, ClassVar, cast, Dict, Iterator, List, Tuple, Protocol from Options import AssembleOptions, Choice, DeathLink, DefaultOnToggle, Option, PerGameCommonOptions, \ @@ -158,13 +159,30 @@ class Ingredienizer(EvermizerFlags, OffOnFullChoice): flags = ['i', '', 'I'] -class Sniffamizer(EvermizerFlags, OffOnFullChoice): - """On Shuffles, Full randomizes drops in sniff locations""" +class Sniffamizer(EvermizerFlags, Choice): + """ + Off: all vanilla items in sniff spots + Shuffle: sniff items shuffled into random sniff spots + """ display_name = "Sniffamizer" + option_off = 0 + option_shuffle = 1 + if datetime.today().year > 2024 or datetime.today().month > 3: + option_everywhere = 2 + __doc__ = __doc__ + " Everywhere: add sniff spots to multiworld pool" + alias_true = 1 default = 1 flags = ['s', '', 'S'] +class SniffIngredients(EvermizerFlag, Choice): + """Select which items should be used as sniff items""" + display_name = "Sniff Ingredients" + option_vanilla_ingredients = 0 + option_random_ingredients = 1 + flag = 'v' + + class Callbeadamizer(EvermizerFlags, OffOnFullChoice): """On Shuffles call bead characters, Full shuffles individual spells""" display_name = "Callbeadamizer" @@ -207,7 +225,7 @@ def __new__(mcs, name: str, bases: Tuple[type], attrs: Dict[Any, Any]) -> "ItemC attrs["display_name"] = f"{attrs['item_name']} Chance" attrs["range_start"] = 0 attrs["range_end"] = 100 - cls = super(ItemChanceMeta, mcs).__new__(mcs, name, bases, attrs) + cls = super(ItemChanceMeta, mcs).__new__(mcs, name, bases, attrs) # type: ignore[no-untyped-call] return cast(ItemChanceMeta, cls) @@ -268,6 +286,7 @@ class SoEOptions(PerGameCommonOptions): short_boss_rush: ShortBossRush ingredienizer: Ingredienizer sniffamizer: Sniffamizer + sniff_ingredients: SniffIngredients callbeadamizer: Callbeadamizer musicmizer: Musicmizer doggomizer: Doggomizer diff --git a/worlds/soe/requirements.txt b/worlds/soe/requirements.txt index 710f51ddb09a..4bcacb33c33c 100644 --- a/worlds/soe/requirements.txt +++ b/worlds/soe/requirements.txt @@ -1,36 +1,36 @@ -pyevermizer==0.46.1 \ - --hash=sha256:9fd71b5e4af26a5dd24a9cbf5320bf0111eef80320613401a1c03011b1515806 \ - --hash=sha256:23f553ed0509d9a238b2832f775e0b5abd7741b38ab60d388294ee8a7b96c5fb \ - --hash=sha256:7189b67766418a3e7e6c683f09c5e758aa1a5c24316dd9b714984bac099c4b75 \ - --hash=sha256:befa930711e63d5d5892f67fd888b2e65e746363e74599c53e71ecefb90ae16a \ - --hash=sha256:202933ce21e0f33859537bf3800d9a626c70262a9490962e3f450171758507ca \ - --hash=sha256:c20ca69311c696528e1122ebc7d33775ee971f538c0e3e05dd3bfd4de10b82d4 \ - --hash=sha256:74dc689a771ae5ffcd5257e763f571ee890e3e87bdb208233b7f451522c00d66 \ - --hash=sha256:072296baef464daeb6304cf58827dcbae441ad0803039aee1c0caa10d56e0674 \ - --hash=sha256:7921baf20d52d92d6aeb674125963c335b61abb7e1298bde4baf069d11a2d05e \ - --hash=sha256:ca098034a84007038c2bff004582e6e6ac2fa9cc8b9251301d25d7e2adcee6da \ - --hash=sha256:22ddb29823c19be9b15e1b3627db1babfe08b486aede7d5cc463a0a1ae4c75d8 \ - --hash=sha256:bf1c441b49026d9000166be6e2f63fc351a3fda170aa3fdf18d44d5e5d044640 \ - --hash=sha256:9710aa7957b4b1f14392006237eb95803acf27897377df3e85395f057f4316b9 \ - --hash=sha256:8feb676c198bee17ab991ee015828345ac3f87c27dfdb3061d92d1fe47c184b4 \ - --hash=sha256:597026dede72178ff3627a4eb3315de8444461c7f0f856f5773993c3f9790c53 \ - --hash=sha256:70f9b964bdfb5191e8f264644c5d1af3041c66fe15261df8a99b3d719dc680d6 \ - --hash=sha256:74655c0353ffb6cda30485091d0917ce703b128cd824b612b3110a85c79a93d0 \ - --hash=sha256:0e9c74d105d4ec3af12404e85bb8776931c043657add19f798ee69465f92b999 \ - --hash=sha256:d3c13446d3d482b9cce61ac73b38effd26fcdcf7f693a405868d3aaaa4d18ca6 \ - --hash=sha256:371ac3360640ef439a5920ddfe11a34e9d2e546ed886bb8c9ed312611f9f4655 \ - --hash=sha256:6e5cf63b036f24d2ae4375a88df8d0bc93208352939521d1fcac3c829ef2c363 \ - --hash=sha256:edf28f5c4d1950d17343adf6d8d40d12c7e982d1e39535d55f7915e122cd8b0e \ - --hash=sha256:b5ef6f3b4e04f677c296f60f7f4c320ac22cd5bc09c05574460116c8641c801a \ - --hash=sha256:dd651f66720af4abe2ddae29944e299a57ff91e6fca1739e6dc1f8fd7a8c2b39 \ - --hash=sha256:4e278f5f72c27f9703bce5514d2fead8c00361caac03e94b0bf9ad8a144f1eeb \ - --hash=sha256:38f36ea1f545b835c3ecd6e081685a233ac2e3cf0eec8916adc92e4d791098a6 \ - --hash=sha256:0a2e58ed6e7c42f006cc17d32cec1f432f01b3fe490e24d71471b36e0d0d8742 \ - --hash=sha256:c1b658db76240596c03571c60635abe953f36fb55b363202971831c2872ea9a0 \ - --hash=sha256:deb5a84a6a56325eb6701336cdbf70f72adaaeab33cbe953d0e551ecf2592f20 \ - --hash=sha256:b1425c793e0825f58b3726e7afebaf5a296c07cb0d28580d0ee93dbe10dcdf63 \ - --hash=sha256:11995fb4dfd14b5c359591baee2a864c5814650ba0084524d4ea0466edfaf029 \ - --hash=sha256:5d2120b5c93ae322fe2a85d48e3eab4168a19e974a880908f1ac291c0300940f \ - --hash=sha256:254912ea4bfaaffb0abe366e73bd9ecde622677d6afaf2ce8a0c330df99fefd9 \ - --hash=sha256:540d8e4525f0b5255c1554b4589089dc58e15df22f343e9545ea00f7012efa07 \ - --hash=sha256:f69b8ebded7eed181fabe30deabae89fd10c41964f38abb26b19664bbe55c1ae +pyevermizer==0.48.0 \ + --hash=sha256:069ce348e480e04fd6208cfd0f789c600b18d7c34b5272375b95823be191ed57 \ + --hash=sha256:58164dddaba2f340b0a8b4f39605e9dac46d8b0ffb16120e2e57bef2bfc1d683 \ + --hash=sha256:115dd09d38a10f11d4629b340dfd75e2ba4089a1ff9e9748a11619829e02c876 \ + --hash=sha256:b5e79cfe721e75cd7dec306b5eecd6385ce059e31ef7523ba7f677e22161ec6f \ + --hash=sha256:382882fa9d641b9969a6c3ed89449a814bdabcb6b17b558872d95008a6cc908b \ + --hash=sha256:92f67700e9132064a90858d391dd0b8fb111aff6dfd472befed57772d89ae567 \ + --hash=sha256:fe4c453b7dbd5aa834b81f9a7aedb949a605455650b938b8b304d8e5a7edcbf7 \ + --hash=sha256:c6bdbc45daf73818f763ed59ad079f16494593395d806f772dd62605c722b3e9 \ + --hash=sha256:bb09f45448fdfd28566ae6fcc38c35a6632f4c31a9de2483848f6ce17b2359b5 \ + --hash=sha256:00a8b9014744bd1528d0d39c33ede7c0d1713ad797a331cebb33d377a5bc1064 \ + --hash=sha256:64ee69edc0a7d3b3caded78f2e46975f9beaff1ff8feaf29b87da44c45f38d7d \ + --hash=sha256:9211bdb1313e9f4869ed5bdc61f3831d39679bd08bb4087f1c1e5475d9e3018b \ + --hash=sha256:4a57821e422a1d75fe3307931a78db7a65e76955f8e401c4b347db6570390d09 \ + --hash=sha256:04670cee0a0b913f24d2b9a1e771781560e2485bda31e6cd372a08421cf85cfa \ + --hash=sha256:971fe77d0a20a1db984020ad253b613d0983f5e23ff22cba60ee5ac00d8128de \ + --hash=sha256:127265fdb49f718f54706bf15604af1cec23590afd00d423089dea4331dcfc61 \ + --hash=sha256:d47576360337c1a23f424cd49944a8d68fc4f3338e00719c9f89972c84604bef \ + --hash=sha256:879659603e51130a0de8d9885d815a2fa1df8bd6cebe6d520d1c6002302adfdb \ + --hash=sha256:6a91bfc53dd130db6424adf8ac97a1133e97b4157ed00f889d8cbd26a2a4b340 \ + --hash=sha256:f3bf35fc5eef4cda49d2de77339fc201dd3206660a3dc15db005625b15bb806c \ + --hash=sha256:e7c8d5bf59a3c16db20411bc5d8e9c9087a30b6b4edf1b5ed9f4c013291427e4 \ + --hash=sha256:054a4d84ffe75448d41e88e1e0642ef719eb6111be5fe608e71e27a558c59069 \ + --hash=sha256:e6f141ca367469c69ba7fbf65836c479ec6672c598cfcb6b39e8098c60d346bc \ + --hash=sha256:6e65eb88f0c1ff4acde1c13b24ce649b0fe3d1d3916d02d96836c781a5022571 \ + --hash=sha256:e61e8f476b6da809cf38912755ed8bb009665f589e913eb8df877e9fa763024b \ + --hash=sha256:7e7c5484c0a2e3da6064de3f73d8d988d6703db58ab0be4730cbbf1a82319237 \ + --hash=sha256:9033b954e5f4878fd94af6d2056c78e3316115521fb1c24a4416d5cbf2ad66ad \ + --hash=sha256:824c623fff8ae4da176306c458ad63ad16a06a495a16db700665eca3c115924f \ + --hash=sha256:8e31031409a8386c6a63b79d480393481badb3ba29f32ff7a0db2b4abed20ac8 \ + --hash=sha256:7dbb7bb13e1e94f69f7ccdbcf4d35776424555fce5af1ca29d0256f91fdf087a \ + --hash=sha256:3a24e331b259407b6912d6e0738aa8a675831db3b7493fcf54dc17cb0cb80d37 \ + --hash=sha256:fdda06662a994271e96633cba100dd92b2fcd524acef8b2f664d1aaa14503cbd \ + --hash=sha256:0f0fc81bef3dbb78ba6a7622dd4296f23c59825968a0bb0448beb16eb3397cc2 \ + --hash=sha256:e07cbef776a7468669211546887357cc88e9afcf1578b23a4a4f2480517b15d9 \ + --hash=sha256:e442212695bdf60e455673b7b9dd83a5d4b830d714376477093d2c9054d92832 diff --git a/worlds/soe/test/__init__.py b/worlds/soe/test/__init__.py index 1ab852163053..e84d7e669d2c 100644 --- a/worlds/soe/test/__init__.py +++ b/worlds/soe/test/__init__.py @@ -1,9 +1,11 @@ from test.bases import WorldTestBase from typing import Iterable +from .. import SoEWorld class SoETestBase(WorldTestBase): game = "Secret of Evermore" + world: SoEWorld def assertLocationReachability(self, reachable: Iterable[str] = (), unreachable: Iterable[str] = (), satisfied: bool = True) -> None: diff --git a/worlds/soe/test/test_sniffamizer.py b/worlds/soe/test/test_sniffamizer.py new file mode 100644 index 000000000000..45aff1fa4d6d --- /dev/null +++ b/worlds/soe/test/test_sniffamizer.py @@ -0,0 +1,130 @@ +import typing +from unittest import TestCase, skipUnless + +from . import SoETestBase +from .. import pyevermizer +from ..options import Sniffamizer + + +class TestCount(TestCase): + """ + Test that counts line up for sniff spots + """ + + def test_compare_counts(self) -> None: + self.assertEqual(len(pyevermizer.get_sniff_locations()), len(pyevermizer.get_sniff_items()), + "Sniff locations and sniff items don't line up") + + +class Bases: + # class in class to avoid running tests for helper class + class TestSniffamizerLocal(SoETestBase): + """ + Test that provided options do not add sniff items or locations + """ + def test_no_sniff_items(self) -> None: + self.assertLess(len(self.multiworld.itempool), 500, + "Unexpected number of items") + for item in self.multiworld.itempool: + if item.code is not None: + self.assertLess(item.code, 65000, + "Unexpected item type") + + def test_no_sniff_locations(self) -> None: + location_count = sum(1 for location in self.multiworld.get_locations(self.player) if location.item is None) + self.assertLess(location_count, 500, + "Unexpected number of locations") + for location in self.multiworld.get_locations(self.player): + if location.address is not None: + self.assertLess(location.address, 65000, + "Unexpected location type") + self.assertEqual(location_count, len(self.multiworld.itempool), + "Locations and item counts do not line up") + + class TestSniffamizerPool(SoETestBase): + """ + Test that provided options add sniff items and locations + """ + def test_sniff_items(self) -> None: + self.assertGreater(len(self.multiworld.itempool), 500, + "Unexpected number of items") + + def test_sniff_locations(self) -> None: + location_count = sum(1 for location in self.multiworld.get_locations(self.player) if location.item is None) + self.assertGreater(location_count, 500, + "Unexpected number of locations") + self.assertTrue(any(location.address is not None and location.address >= 65000 + for location in self.multiworld.get_locations(self.player)), + "No sniff locations") + self.assertEqual(location_count, len(self.multiworld.itempool), + "Locations and item counts do not line up") + + +class TestSniffamizerShuffle(Bases.TestSniffamizerLocal): + """ + Test that shuffle does not add extra items or locations + """ + options: typing.Dict[str, typing.Any] = { + "sniffamizer": "shuffle" + } + + def test_flags(self) -> None: + # default -> no flags + flags = self.world.options.flags + self.assertNotIn("s", flags) + self.assertNotIn("S", flags) + self.assertNotIn("v", flags) + + +@skipUnless(hasattr(Sniffamizer, "option_everywhere"), "Feature disabled") +class TestSniffamizerEverywhereVanilla(Bases.TestSniffamizerPool): + """ + Test that everywhere + vanilla ingredients does add extra items and locations + """ + options: typing.Dict[str, typing.Any] = { + "sniffamizer": "everywhere", + "sniff_ingredients": "vanilla_ingredients", + } + + def test_flags(self) -> None: + flags = self.world.options.flags + self.assertIn("S", flags) + self.assertNotIn("v", flags) + + +@skipUnless(hasattr(Sniffamizer, "option_everywhere"), "Feature disabled") +class TestSniffamizerEverywhereRandom(Bases.TestSniffamizerPool): + """ + Test that everywhere + random ingredients also adds extra items and locations + """ + options: typing.Dict[str, typing.Any] = { + "sniffamizer": "everywhere", + "sniff_ingredients": "random_ingredients", + } + + def test_flags(self) -> None: + flags = self.world.options.flags + self.assertIn("S", flags) + self.assertIn("v", flags) + + +@skipUnless(hasattr(Sniffamizer, "option_everywhere"), "Feature disabled") +class EverywhereAccessTest(SoETestBase): + """ + Test that everywhere has certain rules + """ + options: typing.Dict[str, typing.Any] = { + "sniffamizer": "everywhere", + } + + @staticmethod + def _resolve_numbers(spots: typing.Mapping[str, typing.Iterable[int]]) -> typing.List[str]: + return [f"{name} #{number}" for name, numbers in spots.items() for number in numbers] + + def test_knight_basher(self) -> None: + locations = ["Mungola", "Lightning Storm"] + self._resolve_numbers({ + "Gomi's Tower Sniff": range(473, 491), + "Gomi's Tower": range(195, 199), + }) + items = [["Knight Basher"]] + self.assertAccessDependency(locations, items) diff --git a/worlds/stardew_valley/data/villagers_data.py b/worlds/stardew_valley/data/villagers_data.py index ae6a346d56d7..718bce743b1c 100644 --- a/worlds/stardew_valley/data/villagers_data.py +++ b/worlds/stardew_valley/data/villagers_data.py @@ -13,9 +13,9 @@ class Villager: name: str bachelor: bool - locations: Tuple[str] + locations: Tuple[str, ...] birthday: str - gifts: Tuple[str] + gifts: Tuple[str, ...] available: bool mod_name: str @@ -366,10 +366,11 @@ def villager(name: str, bachelor: bool, locations: Tuple[str, ...], birthday: st return npc -def make_bachelor(mod_name: str, npc: Villager): +def adapt_wizard_to_sve(mod_name: str, npc: Villager): if npc.mod_name: mod_name = npc.mod_name - return Villager(npc.name, True, npc.locations, npc.birthday, npc.gifts, npc.available, mod_name) + # The wizard leaves his tower on sunday, for like 1 hour... Good enough to meet him! + return Villager(npc.name, True, npc.locations + forest, npc.birthday, npc.gifts, npc.available, mod_name) def register_villager_modification(mod_name: str, npc: Villager, modification_function): @@ -452,7 +453,7 @@ def register_villager_modification(mod_name: str, npc: Villager, modification_fu # Modified villagers; not included in all villagers -register_villager_modification(ModNames.sve, wizard, make_bachelor) +register_villager_modification(ModNames.sve, wizard, adapt_wizard_to_sve) all_villagers_by_name: Dict[str, Villager] = {villager.name: villager for villager in all_villagers} all_villagers_by_mod: Dict[str, List[Villager]] = {} diff --git a/worlds/stardew_valley/logic/fishing_logic.py b/worlds/stardew_valley/logic/fishing_logic.py index 65b3cdc2ac88..a7399a65d99c 100644 --- a/worlds/stardew_valley/logic/fishing_logic.py +++ b/worlds/stardew_valley/logic/fishing_logic.py @@ -73,7 +73,8 @@ def can_catch_quality_fish(self, fish_quality: str) -> StardewRule: return rod_rule & self.logic.skill.has_level(Skill.fishing, 4) if fish_quality == FishQuality.iridium: return rod_rule & self.logic.skill.has_level(Skill.fishing, 10) - return False_() + + raise ValueError(f"Quality {fish_quality} is unknown.") def can_catch_every_fish(self) -> StardewRule: rules = [self.has_max_fishing()] diff --git a/worlds/stardew_valley/logic/logic.py b/worlds/stardew_valley/logic/logic.py index 1c79e9345930..a7fcec922838 100644 --- a/worlds/stardew_valley/logic/logic.py +++ b/worlds/stardew_valley/logic/logic.py @@ -546,6 +546,7 @@ def can_succeed_luau_soup(self) -> StardewRule: def can_succeed_grange_display(self) -> StardewRule: if self.options.festival_locations != FestivalLocations.option_hard: return True_() + animal_rule = self.animal.has_animal(Generic.any) artisan_rule = self.artisan.can_keg(Generic.any) | self.artisan.can_preserves_jar(Generic.any) cooking_rule = self.money.can_spend_at(Region.saloon, 220) # Salads at the bar are good enough diff --git a/worlds/stardew_valley/logic/skill_logic.py b/worlds/stardew_valley/logic/skill_logic.py index 9134dfae40bf..35946a0a4d36 100644 --- a/worlds/stardew_valley/logic/skill_logic.py +++ b/worlds/stardew_valley/logic/skill_logic.py @@ -44,10 +44,14 @@ def can_earn_level(self, skill: str, level: int) -> StardewRule: tool_material = ToolMaterial.tiers[tool_level] months = max(1, level - 1) months_rule = self.logic.time.has_lived_months(months) - previous_level_rule = self.logic.skill.has_level(skill, level - 1) + + if self.options.skill_progression != options.SkillProgression.option_vanilla: + previous_level_rule = self.logic.skill.has_level(skill, level - 1) + else: + previous_level_rule = True_() if skill == Skill.fishing: - xp_rule = self.logic.tool.has_tool(Tool.fishing_rod, ToolMaterial.tiers[max(tool_level, 3)]) + xp_rule = self.logic.tool.has_fishing_rod(max(tool_level, 1)) elif skill == Skill.farming: xp_rule = self.logic.tool.has_tool(Tool.hoe, tool_material) & self.logic.tool.can_water(tool_level) elif skill == Skill.foraging: @@ -137,13 +141,17 @@ def can_get_fishing_xp(self) -> StardewRule: def can_fish(self, regions: Union[str, Tuple[str, ...]] = None, difficulty: int = 0) -> StardewRule: if isinstance(regions, str): regions = regions, + if regions is None or len(regions) == 0: regions = fishing_regions + skill_required = min(10, max(0, int((difficulty / 10) - 1))) if difficulty <= 40: skill_required = 0 + skill_rule = self.logic.skill.has_level(Skill.fishing, skill_required) region_rule = self.logic.region.can_reach_any(regions) + # Training rod only works with fish < 50. Fiberglass does not help you to catch higher difficulty fish, so it's skipped in logic. number_fishing_rod_required = 1 if difficulty < 50 else (2 if difficulty < 80 else 4) return self.logic.tool.has_fishing_rod(number_fishing_rod_required) & skill_rule & region_rule diff --git a/worlds/stardew_valley/logic/tool_logic.py b/worlds/stardew_valley/logic/tool_logic.py index def02b35dab6..1b1dc2a52120 100644 --- a/worlds/stardew_valley/logic/tool_logic.py +++ b/worlds/stardew_valley/logic/tool_logic.py @@ -12,10 +12,14 @@ from ..stardew_rule import StardewRule, True_, False_ from ..strings.ap_names.skill_level_names import ModSkillLevel from ..strings.region_names import Region -from ..strings.skill_names import ModSkill from ..strings.spells import MagicSpell from ..strings.tool_names import ToolMaterial, Tool +fishing_rod_prices = { + 3: 1800, + 4: 7500, +} + tool_materials = { ToolMaterial.copper: 1, ToolMaterial.iron: 2, @@ -40,27 +44,31 @@ def __init__(self, *args, **kwargs): class ToolLogic(BaseLogic[Union[ToolLogicMixin, HasLogicMixin, ReceivedLogicMixin, RegionLogicMixin, SeasonLogicMixin, MoneyLogicMixin, MagicLogicMixin]]): # Should be cached def has_tool(self, tool: str, material: str = ToolMaterial.basic) -> StardewRule: + assert tool != Tool.fishing_rod, "Use `has_fishing_rod` instead of `has_tool`." + if material == ToolMaterial.basic or tool == Tool.scythe: return True_() if self.options.tool_progression & ToolProgression.option_progressive: return self.logic.received(f"Progressive {tool}", tool_materials[material]) - return self.logic.has(f"{material} Bar") & self.logic.money.can_spend(tool_upgrade_prices[material]) + return self.logic.has(f"{material} Bar") & self.logic.money.can_spend_at(Region.blacksmith, tool_upgrade_prices[material]) def can_use_tool_at(self, tool: str, material: str, region: str) -> StardewRule: return self.has_tool(tool, material) & self.logic.region.can_reach(region) @cache_self1 def has_fishing_rod(self, level: int) -> StardewRule: + assert 1 <= level <= 4, "Fishing rod 0 isn't real, it can't hurt you. Training is 1, Bamboo is 2, Fiberglass is 3 and Iridium is 4." + if self.options.tool_progression & ToolProgression.option_progressive: return self.logic.received(f"Progressive {Tool.fishing_rod}", level) - if level <= 1: + if level <= 2: + # We assume you always have access to the Bamboo pole, because mod side there is a builtin way to get it back. return self.logic.region.can_reach(Region.beach) - prices = {2: 500, 3: 1800, 4: 7500} - level = min(level, 4) - return self.logic.money.can_spend_at(Region.fish_shop, prices[level]) + + return self.logic.money.can_spend_at(Region.fish_shop, fishing_rod_prices[level]) # Should be cached def can_forage(self, season: Union[str, Iterable[str]], region: str = Region.forest, need_hoe: bool = False) -> StardewRule: diff --git a/worlds/stardew_valley/test/TestRules.py b/worlds/stardew_valley/test/TestRules.py index 0d2fc38a19a3..787e0ce39c3e 100644 --- a/worlds/stardew_valley/test/TestRules.py +++ b/worlds/stardew_valley/test/TestRules.py @@ -8,6 +8,7 @@ FriendsanityHeartSize, BundleRandomization, SkillProgression from ..strings.entrance_names import Entrance from ..strings.region_names import Region +from ..strings.tool_names import Tool, ToolMaterial class TestProgressiveToolsLogic(SVTestBase): @@ -596,6 +597,54 @@ def swap_museum_and_bathhouse(multiworld, player): bathhouse_entrance.connect(museum_region) +class TestToolVanillaRequiresBlacksmith(SVTestBase): + options = { + options.EntranceRandomization: options.EntranceRandomization.option_buildings, + options.ToolProgression: options.ToolProgression.option_vanilla, + } + seed = 4111845104987680262 + + # Seed is hardcoded to make sure the ER is a valid roll that actually lock the blacksmith behind the Railroad Boulder Removed. + + def test_cannot_get_any_tool_without_blacksmith_access(self): + railroad_item = "Railroad Boulder Removed" + place_region_at_entrance(self.multiworld, self.player, Region.blacksmith, Entrance.enter_bathhouse_entrance) + collect_all_except(self.multiworld, 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]: + self.assert_rule_false(self.world.logic.tool.has_tool(tool, material), self.multiworld.state) + + self.multiworld.state.collect(self.world.create_item(railroad_item), event=False) + + 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]: + self.assert_rule_true(self.world.logic.tool.has_tool(tool, material), self.multiworld.state) + + def test_cannot_get_fishing_rod_without_willy_access(self): + railroad_item = "Railroad Boulder Removed" + place_region_at_entrance(self.multiworld, self.player, Region.fish_shop, Entrance.enter_bathhouse_entrance) + collect_all_except(self.multiworld, railroad_item) + + 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.world.create_item(railroad_item), event=False) + + for fishing_rod_level in [3, 4]: + self.assert_rule_true(self.world.logic.tool.has_fishing_rod(fishing_rod_level), self.multiworld.state) + + +def place_region_at_entrance(multiworld, player, region, entrance): + region_to_place = multiworld.get_region(region, player) + entrance_to_place_region = multiworld.get_entrance(entrance, player) + + entrance_to_switch = region_to_place.entrances[0] + region_to_switch = entrance_to_place_region.connected_region + entrance_to_switch.connect(region_to_switch) + entrance_to_place_region.connect(region_to_place) + + def collect_all_except(multiworld, item_to_not_collect: str): for item in multiworld.get_items(): if item.name != item_to_not_collect: diff --git a/worlds/tloz/docs/en_The Legend of Zelda.md b/worlds/tloz/docs/en_The Legend of Zelda.md index 938496a161ae..96b613673f00 100644 --- a/worlds/tloz/docs/en_The Legend of Zelda.md +++ b/worlds/tloz/docs/en_The Legend of Zelda.md @@ -41,7 +41,6 @@ filler and useful items will cost less, and uncategorized items will be in the m - Pressing Select will cycle through your inventory. - Shop purchases are tracked within sessions, indicated by the item being elevated from its normal position. - What slots from a Take Any Cave have been chosen are similarly tracked. -- ## Local Unique Commands diff --git a/worlds/tunic/docs/en_TUNIC.md b/worlds/tunic/docs/en_TUNIC.md index ad328999ac0c..f1e0056041bb 100644 --- a/worlds/tunic/docs/en_TUNIC.md +++ b/worlds/tunic/docs/en_TUNIC.md @@ -86,3 +86,5 @@ Notes: - There is no limit to the number of Shops hard-coded into place. - If you have more than one shop in a scene, you may be wrong warped when exiting a shop. - If you have a shop in every scene, and you have an odd number of shops, it will error out. + +See the [Archipelago Plando Guide](../../../tutorial/Archipelago/plando/en) for more information on Plando and Connection Plando. diff --git a/worlds/tunic/er_scripts.py b/worlds/tunic/er_scripts.py index 5756ec90be14..5d08188ace6e 100644 --- a/worlds/tunic/er_scripts.py +++ b/worlds/tunic/er_scripts.py @@ -1,4 +1,4 @@ -from typing import Dict, List, Set, Tuple, TYPE_CHECKING +from typing import Dict, List, Set, TYPE_CHECKING from BaseClasses import Region, ItemClassification, Item, Location from .locations import location_table from .er_data import Portal, tunic_er_regions, portal_mapping, \ @@ -89,7 +89,6 @@ def place_event_items(world: "TunicWorld", regions: Dict[str, Region]) -> None: def vanilla_portals() -> Dict[Portal, Portal]: portal_pairs: Dict[Portal, Portal] = {} portal_map = portal_mapping.copy() - shop_num = 1 while portal_map: portal1 = portal_map[0] @@ -98,11 +97,10 @@ def vanilla_portals() -> Dict[Portal, Portal]: portal2_sdt = portal1.destination_scene() if portal2_sdt.startswith("Shop,"): - portal2 = Portal(name=f"Shop", region="Shop", + portal2 = Portal(name="Shop", region="Shop", destination="Previous Region", tag="_") - shop_num += 1 - if portal2_sdt == "Purgatory, Purgatory_bottom": + elif portal2_sdt == "Purgatory, Purgatory_bottom": portal2_sdt = "Purgatory, Purgatory_top" for portal in portal_map: diff --git a/worlds/yoshisisland/Client.py b/worlds/yoshisisland/Client.py index c512a8316ab5..1aff36c553c7 100644 --- a/worlds/yoshisisland/Client.py +++ b/worlds/yoshisisland/Client.py @@ -36,6 +36,7 @@ class YoshisIslandSNIClient(SNIClient): game = "Yoshi's Island" + patch_suffix = ".apyi" async def deathlink_kill_player(self, ctx: "SNIContext") -> None: from SNIClient import DeathState, snes_buffered_write, snes_flush_writes, snes_read