mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
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:
@@ -281,18 +281,20 @@ class PokemonRedBlueWorld(World):
|
|||||||
self.multiworld.itempool.remove(badge)
|
self.multiworld.itempool.remove(badge)
|
||||||
progitempool.remove(badge)
|
progitempool.remove(badge)
|
||||||
for _ in range(5):
|
for _ in range(5):
|
||||||
badgelocs = [self.multiworld.get_location(loc, self.player) for loc in [
|
badgelocs = [
|
||||||
"Pewter Gym - Brock Prize", "Cerulean Gym - Misty Prize",
|
self.multiworld.get_location(loc, self.player) for loc in [
|
||||||
"Vermilion Gym - Lt. Surge Prize", "Celadon Gym - Erika Prize",
|
"Pewter Gym - Brock Prize", "Cerulean Gym - Misty Prize",
|
||||||
"Fuchsia Gym - Koga Prize", "Saffron Gym - Sabrina Prize",
|
"Vermilion Gym - Lt. Surge Prize", "Celadon Gym - Erika Prize",
|
||||||
"Cinnabar Gym - Blaine Prize", "Viridian Gym - Giovanni 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)
|
state = self.multiworld.get_all_state(False)
|
||||||
self.multiworld.random.shuffle(badges)
|
self.multiworld.random.shuffle(badges)
|
||||||
self.multiworld.random.shuffle(badgelocs)
|
self.multiworld.random.shuffle(badgelocs)
|
||||||
badgelocs_copy = badgelocs.copy()
|
badgelocs_copy = badgelocs.copy()
|
||||||
# allow_partial so that unplaced badges aren't lost, for debugging purposes
|
# 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)
|
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:
|
for location in badgelocs:
|
||||||
if location.item:
|
if location.item:
|
||||||
badges.append(location.item)
|
badges.append(location.item)
|
||||||
@@ -302,6 +304,7 @@ class PokemonRedBlueWorld(World):
|
|||||||
for location in badgelocs:
|
for location in badgelocs:
|
||||||
if location.item:
|
if location.item:
|
||||||
fill_locations.remove(location)
|
fill_locations.remove(location)
|
||||||
|
progitempool += badges
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
raise FillError(f"Failed to place badges for player {self.player}")
|
raise FillError(f"Failed to place badges for player {self.player}")
|
||||||
|
Reference in New Issue
Block a user