Change hint for shop items to be "for sale"

Lock Dungeon Prizes, as they're not supposed to be moved by any swapping mechanic
This commit is contained in:
Fabian Dill 2021-01-13 14:58:40 +01:00
parent c0cdeef67a
commit e8a57a4d24
4 changed files with 11 additions and 6 deletions

View File

@ -452,9 +452,11 @@ class World(object):
"""Check if accessibility rules are fulfilled with current or supplied state."""
if not state:
state = CollectionState(self)
players = {}
players = {"none" : set(),
"items": set(),
"locations": set()}
for player, access in self.accessibility.items():
players.setdefault(access, set()).add(player)
players[access].add(player)
beatable_fulfilled = False

View File

@ -619,7 +619,7 @@ def fill_prizes(world, attempts=15):
prize_locs = list(empty_crystal_locations)
world.random.shuffle(prizepool)
world.random.shuffle(prize_locs)
fill_restrictive(world, all_state, prize_locs, prizepool, True)
fill_restrictive(world, all_state, prize_locs, prizepool, True, lock=True)
except FillError as e:
logging.getLogger('').exception("Failed to place dungeon prizes (%s). Will retry %s more times", e,
attempts - attempt)

View File

@ -218,7 +218,7 @@ def main(args, seed=None):
if shop_slots:
# TODO: allow each game to register a blacklist to be used here?
blacklist_words = {"Rupee", "Pendant", "Crystal"}
blacklist_words = {"Rupee"}
blacklist_words = {item_name for item_name in item_table if any(
blacklist_word in item_name for blacklist_word in blacklist_words)}
blacklist_words.add("Bee")
@ -238,12 +238,14 @@ def main(args, seed=None):
if shop.can_push_inventory(slot_num):
for c in candidates: # chosen item locations
if c.item_rule(location.item) and location.item_rule(c.item): # if rule is good...
logger.debug(f'Swapping {c} into {location}:: {c.item}')
swap_location_item(c, location, check_locked=False)
candidates.remove(c)
if not world.fulfills_accessibility():
swap_location_item(c, location, check_locked=False)
continue
logger.debug(f'Swapping {c} into {location}:: {location.item}')
break
else:

View File

@ -416,7 +416,8 @@ def create_shops(world, player: int):
if my_shop_slots.pop():
additional_item = 'Rupees (50)' # world.random.choice(['Rupees (50)', 'Rupees (100)', 'Rupees (300)'])
slot_name = "{} Slot {}".format(shop.region.name, index + 1)
loc = Location(player, slot_name, address=shop_table_by_location[slot_name], parent=shop.region)
loc = Location(player, slot_name, address=shop_table_by_location[slot_name],
parent=shop.region, hint_text="for sale")
loc.shop_slot = True
loc.locked = True
loc.item = ItemFactory(additional_item, player)