From 2dfb212e53b050904317afc4960cc41ac76e8a5f Mon Sep 17 00:00:00 2001 From: Bryce Wilson Date: Tue, 4 Jun 2024 12:21:58 -0700 Subject: [PATCH] Pokemon Emerald: Fix possible dexsanity/legendary hunt softlock (#3443) * Pokemon Emerald: Remove mirage tower from allowed dexsanity maps * Pokemon Emerald: Prevent placing wailord/relicanth in out of logic maps * Pokemon Emerald: Clarify docstring Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> * Pokemon Emerald: Update changelog --------- Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> --- worlds/pokemon_emerald/CHANGELOG.md | 1 + worlds/pokemon_emerald/data.py | 11 +++++++++-- worlds/pokemon_emerald/pokemon.py | 10 +++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/worlds/pokemon_emerald/CHANGELOG.md b/worlds/pokemon_emerald/CHANGELOG.md index e967b2039b12..0437c0dae8ff 100644 --- a/worlds/pokemon_emerald/CHANGELOG.md +++ b/worlds/pokemon_emerald/CHANGELOG.md @@ -12,6 +12,7 @@ and won't show up in the wild. Previously they would be forced to show up exactl - The Lilycove Wailmer now logically block you from the east. Actual game behavior is still unchanged for now. - Water encounters in Slateport now correctly require Surf. +- Mirage Tower can no longer be your only logical access to a species in the wild, since it can permanently disappear. - Updated the tracker link in the setup guide. # 2.1.1 diff --git a/worlds/pokemon_emerald/data.py b/worlds/pokemon_emerald/data.py index e717a225561c..d89ab5febb33 100644 --- a/worlds/pokemon_emerald/data.py +++ b/worlds/pokemon_emerald/data.py @@ -25,13 +25,20 @@ } """These maps exist but don't show up in the rando or are unused, and so should be discarded""" -POSTGAME_MAPS = { +OUT_OF_LOGIC_MAPS = { "MAP_DESERT_UNDERPASS", "MAP_SAFARI_ZONE_NORTHEAST", "MAP_SAFARI_ZONE_SOUTHEAST", "MAP_METEOR_FALLS_STEVENS_CAVE", + "MAP_MIRAGE_TOWER_1F", + "MAP_MIRAGE_TOWER_2F", + "MAP_MIRAGE_TOWER_3F", + "MAP_MIRAGE_TOWER_4F", } -"""These maps have encounters and are locked behind beating the champion. Those encounter slots should be ignored for logical access to a species.""" +""" +These maps have encounters and are locked behind beating the champion or are missable. +Those encounter slots should be ignored for logical access to a species. +""" NUM_REAL_SPECIES = 386 diff --git a/worlds/pokemon_emerald/pokemon.py b/worlds/pokemon_emerald/pokemon.py index 8aa25934af8d..c60e5e9d4f14 100644 --- a/worlds/pokemon_emerald/pokemon.py +++ b/worlds/pokemon_emerald/pokemon.py @@ -4,9 +4,8 @@ import functools from typing import TYPE_CHECKING, Dict, List, Set, Optional, Tuple -from Options import Toggle - -from .data import NUM_REAL_SPECIES, POSTGAME_MAPS, EncounterTableData, LearnsetMove, MiscPokemonData, SpeciesData, data +from .data import (NUM_REAL_SPECIES, OUT_OF_LOGIC_MAPS, EncounterTableData, LearnsetMove, MiscPokemonData, + SpeciesData, data) from .options import (Goal, HmCompatibility, LevelUpMoves, RandomizeAbilities, RandomizeLegendaryEncounters, RandomizeMiscPokemon, RandomizeStarters, RandomizeTypes, RandomizeWildPokemon, TmTutorCompatibility) @@ -266,7 +265,8 @@ def randomize_wild_encounters(world: "PokemonEmeraldWorld") -> None: species_old_to_new_map: Dict[int, int] = {} for species_id in table.slots: if species_id not in species_old_to_new_map: - if not placed_priority_species and len(priority_species) > 0: + if not placed_priority_species and len(priority_species) > 0 \ + and map_name not in OUT_OF_LOGIC_MAPS: new_species_id = priority_species.pop() placed_priority_species = True else: @@ -329,7 +329,7 @@ def randomize_wild_encounters(world: "PokemonEmeraldWorld") -> None: new_species_id = world.random.choice(candidates).species_id species_old_to_new_map[species_id] = new_species_id - if world.options.dexsanity and map_data.name not in POSTGAME_MAPS: + if world.options.dexsanity and map_name not in OUT_OF_LOGIC_MAPS: already_placed.add(new_species_id) # Actually create the new list of slots and encounter table