Skip to content

Commit

Permalink
Pokemon Emerald: Fix possible dexsanity/legendary hunt softlock (#3443)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* Pokemon Emerald: Update changelog

---------

Co-authored-by: Exempt-Medic <[email protected]>
  • Loading branch information
Zunawe and Exempt-Medic authored Jun 4, 2024
1 parent c457296 commit ee1b13f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions worlds/pokemon_emerald/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions worlds/pokemon_emerald/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions worlds/pokemon_emerald/pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ee1b13f

Please sign in to comment.