Pokémon R/B: Badge plando fix (#2628)
Only attempt to place badges in badge locations if they are empty. Return unplaced badges to the item pool if fewer than 8 locations are being filled. This should fix errors that occur when items are placed into badge locations via plando, or whatever other worlds may do.
This commit is contained in:
parent
b99c734954
commit
576c705106
|
@ -281,18 +281,20 @@ class PokemonRedBlueWorld(World):
|
|||
self.multiworld.itempool.remove(badge)
|
||||
progitempool.remove(badge)
|
||||
for _ in range(5):
|
||||
badgelocs = [self.multiworld.get_location(loc, self.player) for loc in [
|
||||
"Pewter Gym - Brock Prize", "Cerulean Gym - Misty Prize",
|
||||
"Vermilion Gym - Lt. Surge Prize", "Celadon Gym - Erika Prize",
|
||||
"Fuchsia Gym - Koga Prize", "Saffron Gym - Sabrina Prize",
|
||||
"Cinnabar Gym - Blaine Prize", "Viridian Gym - Giovanni Prize"]]
|
||||
badgelocs = [
|
||||
self.multiworld.get_location(loc, self.player) for loc in [
|
||||
"Pewter Gym - Brock Prize", "Cerulean Gym - Misty Prize",
|
||||
"Vermilion Gym - Lt. Surge Prize", "Celadon Gym - Erika Prize",
|
||||
"Fuchsia Gym - Koga Prize", "Saffron Gym - Sabrina Prize",
|
||||
"Cinnabar Gym - Blaine Prize", "Viridian Gym - Giovanni Prize"
|
||||
] if self.multiworld.get_location(loc, self.player).item is None]
|
||||
state = self.multiworld.get_all_state(False)
|
||||
self.multiworld.random.shuffle(badges)
|
||||
self.multiworld.random.shuffle(badgelocs)
|
||||
badgelocs_copy = badgelocs.copy()
|
||||
# allow_partial so that unplaced badges aren't lost, for debugging purposes
|
||||
fill_restrictive(self.multiworld, state, badgelocs_copy, badges, True, True, allow_partial=True)
|
||||
if badges:
|
||||
if len(badges) > 8 - len(badgelocs):
|
||||
for location in badgelocs:
|
||||
if location.item:
|
||||
badges.append(location.item)
|
||||
|
@ -302,6 +304,7 @@ class PokemonRedBlueWorld(World):
|
|||
for location in badgelocs:
|
||||
if location.item:
|
||||
fill_locations.remove(location)
|
||||
progitempool += badges
|
||||
break
|
||||
else:
|
||||
raise FillError(f"Failed to place badges for player {self.player}")
|
||||
|
|
Loading…
Reference in New Issue