Archipelago icon indicating copy to clipboard operation
Archipelago copied to clipboard

Pokemon Emerald: Rework tags/dynamically create item and location groups

Open Zunawe opened this issue 1 year ago • 0 comments

What is this fixing or adding?

Currently, items and locations are both assigned "tags" in the data files that define them. For items, these tags are used to balance the item pool and to avoid creating duplicates of items with the "Unique" tag, as duplicates would have no use to the player. For locations, these tags are used to enable and disable locations. Location tags are essentially used as an enum. All locations have exactly one tag that corresponds with whether they should be included in randomization based on some player option.

So this PR actually converts those existing location tags into a category enum. A script was run on worlds/pokemon_emerald/data/locations.json to map the tag to a category field, and to empty the tags list. And that category is used in the same way the tag was. Tags are also no longer copied to actual Locations in favor of a key that can be used to index into the dataclasses.

For both items and locations, tags are now converted directly into item and location groups in worlds/pokemon_emerald/groups.py. Some item tags were changed to look nicer to humans. Existing item groups were converted to tags and are no longer explicitly defined. The same is true for the "Gym TMs" location group, which is the only change made to worlds/pokemon_emerald/data/locations.json that wasn't done automatically.

For locations, location categories are converted to location groups in worlds/pokemon_emerald/groups.py by mapping the enum to a human-friendly label. Every in-game map is also associated with a group name, and since every location belongs to a region, and every region belongs to a map, it can automatically associate every location with a group representing some geographical area. (Pokedex locations are the odd ones out and have to be filtered; the locations themselves are "in Littleroot" because they're locked by events that get placed dynamically based on wild encounter randomization.)

A sanity check was added to make sure the maps being used for location groups exist. In case of changes made to the names that get automatically pulled into extracted_data.json, or accidental misspellings.

Thanks to @Tsukino-uwu for categorizing all the maps.

This PR supersedes the need for #3234.

How was this tested?

Generated a few times with a random yaml and while enabling/disabling options to check that the reported location count made sense. Also scrolled through the data package.

Zunawe avatar May 04 '24 04:05 Zunawe