Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pokemon Emerald: Fix possible dexsanity/legendary hunt softlock #3443

Merged
merged 5 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading