Skip to content

Commit

Permalink
[PKMN RB] Make Encounters in one location unique (#3994)
Browse files Browse the repository at this point in the history
* Makes encounters in a location generate unique Pokémon

* vyneras actually got it to work

* V5 Update Fix Part 1

* Part 2

* final puzzle piece
  • Loading branch information
palex00 authored Dec 1, 2024
1 parent b83b486 commit e5374eb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions worlds/pokemon_rb/encounters.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ def process_pokemon_locations(self):
encounter_slots = encounter_slots_master.copy()

zone_mapping = {}
zone_placed_mons = {}

if self.options.randomize_wild_pokemon:
mons_list = [pokemon for pokemon in poke_data.pokemon_data.keys() if pokemon not in poke_data.legendary_pokemon
or self.options.randomize_legendary_pokemon.value == 3]
Expand All @@ -180,11 +182,13 @@ def process_pokemon_locations(self):
zone = " - ".join(location.name.split(" - ")[:-1])
if zone not in zone_mapping:
zone_mapping[zone] = {}
if zone not in zone_placed_mons:
zone_placed_mons[zone] = []
original_mon = slot.original_item
if self.options.area_1_to_1_mapping and original_mon in zone_mapping[zone]:
mon = zone_mapping[zone][original_mon]
else:
mon = randomize_pokemon(self, original_mon, mons_list,
mon = randomize_pokemon(self, original_mon, [m for m in mons_list if m not in zone_placed_mons[zone]],
self.options.randomize_wild_pokemon.value, self.random)
#
while ("Pokemon Tower 6F" in slot.name and
Expand All @@ -201,6 +205,7 @@ def process_pokemon_locations(self):
location.item.location = location
locations.append(location)
zone_mapping[zone][original_mon] = mon
zone_placed_mons[zone].append(mon)

mons_to_add = []
remaining_pokemon = [pokemon for pokemon in poke_data.pokemon_data.keys() if placed_mons[pokemon] == 0 and
Expand Down Expand Up @@ -270,4 +275,4 @@ def process_pokemon_locations(self):
location.item = self.create_item(slot.original_item)
location.locked = True
location.item.location = location
placed_mons[location.item.name] += 1
placed_mons[location.item.name] += 1

0 comments on commit e5374eb

Please sign in to comment.