Pokemon Emerald: Clean up dexsanity spoiler and hints (#3832)
* Pokemon Emerald: Clean up dexsanity spoiler and hints * Pokemon Emerald: Add +, do less hacks * Pokemon Emerald: Update changelog * Pokemon Emerald: Replace arrow with word in changelog * Pokemon Emerald: Fix changelog
This commit is contained in:
parent
81b9a53a37
commit
18e8d50768
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
- Added many new item and location groups.
|
|
||||||
- Added a Swedish translation of the setup guide.
|
- Added a Swedish translation of the setup guide.
|
||||||
- The client communicates map transitions to any trackers connected to the slot.
|
- The client communicates map transitions to any trackers connected to the slot.
|
||||||
- Added the player's Normalize Encounter Rates option to slot data for trackers.
|
- Added the player's Normalize Encounter Rates option to slot data for trackers.
|
||||||
|
|
|
@ -629,21 +629,34 @@ class PokemonEmeraldWorld(World):
|
||||||
|
|
||||||
spoiler_handle.write(f"\n\nWild Pokemon ({self.player_name}):\n\n")
|
spoiler_handle.write(f"\n\nWild Pokemon ({self.player_name}):\n\n")
|
||||||
|
|
||||||
|
slot_to_rod_suffix = {
|
||||||
|
0: " (Old Rod)",
|
||||||
|
1: " (Old Rod)",
|
||||||
|
2: " (Good Rod)",
|
||||||
|
3: " (Good Rod)",
|
||||||
|
4: " (Good Rod)",
|
||||||
|
5: " (Super Rod)",
|
||||||
|
6: " (Super Rod)",
|
||||||
|
7: " (Super Rod)",
|
||||||
|
8: " (Super Rod)",
|
||||||
|
9: " (Super Rod)",
|
||||||
|
}
|
||||||
|
|
||||||
species_maps = defaultdict(set)
|
species_maps = defaultdict(set)
|
||||||
for map in self.modified_maps.values():
|
for map in self.modified_maps.values():
|
||||||
if map.land_encounters is not None:
|
if map.land_encounters is not None:
|
||||||
for encounter in map.land_encounters.slots:
|
for encounter in map.land_encounters.slots:
|
||||||
species_maps[encounter].add(map.name[4:])
|
species_maps[encounter].add(map.label + " (Land)")
|
||||||
|
|
||||||
if map.water_encounters is not None:
|
if map.water_encounters is not None:
|
||||||
for encounter in map.water_encounters.slots:
|
for encounter in map.water_encounters.slots:
|
||||||
species_maps[encounter].add(map.name[4:])
|
species_maps[encounter].add(map.label + " (Water)")
|
||||||
|
|
||||||
if map.fishing_encounters is not None:
|
if map.fishing_encounters is not None:
|
||||||
for encounter in map.fishing_encounters.slots:
|
for slot, encounter in enumerate(map.fishing_encounters.slots):
|
||||||
species_maps[encounter].add(map.name[4:])
|
species_maps[encounter].add(map.label + slot_to_rod_suffix[slot])
|
||||||
|
|
||||||
lines = [f"{emerald_data.species[species].label}: {', '.join(maps)}\n"
|
lines = [f"{emerald_data.species[species].label}: {', '.join(sorted(maps))}\n"
|
||||||
for species, maps in species_maps.items()]
|
for species, maps in species_maps.items()]
|
||||||
lines.sort()
|
lines.sort()
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
@ -655,35 +668,35 @@ class PokemonEmeraldWorld(World):
|
||||||
if self.options.dexsanity:
|
if self.options.dexsanity:
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
slot_to_rod = {
|
slot_to_rod_suffix = {
|
||||||
0: "_OLD_ROD",
|
0: " (Old Rod)",
|
||||||
1: "_OLD_ROD",
|
1: " (Old Rod)",
|
||||||
2: "_GOOD_ROD",
|
2: " (Good Rod)",
|
||||||
3: "_GOOD_ROD",
|
3: " (Good Rod)",
|
||||||
4: "_GOOD_ROD",
|
4: " (Good Rod)",
|
||||||
5: "_SUPER_ROD",
|
5: " (Super Rod)",
|
||||||
6: "_SUPER_ROD",
|
6: " (Super Rod)",
|
||||||
7: "_SUPER_ROD",
|
7: " (Super Rod)",
|
||||||
8: "_SUPER_ROD",
|
8: " (Super Rod)",
|
||||||
9: "_SUPER_ROD",
|
9: " (Super Rod)",
|
||||||
}
|
}
|
||||||
|
|
||||||
species_maps = defaultdict(set)
|
species_maps = defaultdict(set)
|
||||||
for map in self.modified_maps.values():
|
for map in self.modified_maps.values():
|
||||||
if map.land_encounters is not None:
|
if map.land_encounters is not None:
|
||||||
for encounter in map.land_encounters.slots:
|
for encounter in map.land_encounters.slots:
|
||||||
species_maps[encounter].add(map.name[4:] + "_GRASS")
|
species_maps[encounter].add(map.label + " (Land)")
|
||||||
|
|
||||||
if map.water_encounters is not None:
|
if map.water_encounters is not None:
|
||||||
for encounter in map.water_encounters.slots:
|
for encounter in map.water_encounters.slots:
|
||||||
species_maps[encounter].add(map.name[4:] + "_WATER")
|
species_maps[encounter].add(map.label + " (Water)")
|
||||||
|
|
||||||
if map.fishing_encounters is not None:
|
if map.fishing_encounters is not None:
|
||||||
for slot, encounter in enumerate(map.fishing_encounters.slots):
|
for slot, encounter in enumerate(map.fishing_encounters.slots):
|
||||||
species_maps[encounter].add(map.name[4:] + slot_to_rod[slot])
|
species_maps[encounter].add(map.label + slot_to_rod_suffix[slot])
|
||||||
|
|
||||||
hint_data[self.player] = {
|
hint_data[self.player] = {
|
||||||
self.location_name_to_id[f"Pokedex - {emerald_data.species[species].label}"]: ", ".join(maps)
|
self.location_name_to_id[f"Pokedex - {emerald_data.species[species].label}"]: ", ".join(sorted(maps))
|
||||||
for species, maps in species_maps.items()
|
for species, maps in species_maps.items()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,7 @@ class EncounterTableData(NamedTuple):
|
||||||
@dataclass
|
@dataclass
|
||||||
class MapData:
|
class MapData:
|
||||||
name: str
|
name: str
|
||||||
|
label: str
|
||||||
header_address: int
|
header_address: int
|
||||||
land_encounters: Optional[EncounterTableData]
|
land_encounters: Optional[EncounterTableData]
|
||||||
water_encounters: Optional[EncounterTableData]
|
water_encounters: Optional[EncounterTableData]
|
||||||
|
@ -357,6 +358,8 @@ def load_json_data(data_name: str) -> Union[List[Any], Dict[str, Any]]:
|
||||||
|
|
||||||
|
|
||||||
def _init() -> None:
|
def _init() -> None:
|
||||||
|
import re
|
||||||
|
|
||||||
extracted_data: Dict[str, Any] = load_json_data("extracted_data.json")
|
extracted_data: Dict[str, Any] = load_json_data("extracted_data.json")
|
||||||
data.constants = extracted_data["constants"]
|
data.constants = extracted_data["constants"]
|
||||||
data.ram_addresses = extracted_data["misc_ram_addresses"]
|
data.ram_addresses = extracted_data["misc_ram_addresses"]
|
||||||
|
@ -366,6 +369,7 @@ def _init() -> None:
|
||||||
|
|
||||||
# Create map data
|
# Create map data
|
||||||
for map_name, map_json in extracted_data["maps"].items():
|
for map_name, map_json in extracted_data["maps"].items():
|
||||||
|
assert isinstance(map_name, str)
|
||||||
if map_name in IGNORABLE_MAPS:
|
if map_name in IGNORABLE_MAPS:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -389,8 +393,35 @@ def _init() -> None:
|
||||||
map_json["fishing_encounters"]["address"]
|
map_json["fishing_encounters"]["address"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Derive a user-facing label
|
||||||
|
label = []
|
||||||
|
for word in map_name[4:].split("_"):
|
||||||
|
# 1F, B1F, 2R, etc.
|
||||||
|
re_match = re.match("^B?\d+[FRP]$", word)
|
||||||
|
if re_match:
|
||||||
|
label.append(word)
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Route 103, Hall 1, House 5, etc.
|
||||||
|
re_match = re.match("^([A-Z]+)(\d+)$", word)
|
||||||
|
if re_match:
|
||||||
|
label.append(re_match.group(1).capitalize())
|
||||||
|
label.append(re_match.group(2).lstrip("0"))
|
||||||
|
continue
|
||||||
|
|
||||||
|
if word == "OF":
|
||||||
|
label.append("of")
|
||||||
|
continue
|
||||||
|
|
||||||
|
if word == "SS":
|
||||||
|
label.append("S.S.")
|
||||||
|
continue
|
||||||
|
|
||||||
|
label.append(word.capitalize())
|
||||||
|
|
||||||
data.maps[map_name] = MapData(
|
data.maps[map_name] = MapData(
|
||||||
map_name,
|
map_name,
|
||||||
|
" ".join(label),
|
||||||
map_json["header_address"],
|
map_json["header_address"],
|
||||||
land_encounters,
|
land_encounters,
|
||||||
water_encounters,
|
water_encounters,
|
||||||
|
|
Loading…
Reference in New Issue