Cherry pick fix for district+shopsanity
This commit is contained in:
2
Fill.py
2
Fill.py
@@ -496,7 +496,7 @@ def sell_potions(world, player):
|
||||
loc_choices += [world.get_location(loc, player) for loc in shop_to_location_table[shop.region.name]]
|
||||
locations = [loc for loc in loc_choices if not loc.item]
|
||||
for potion in ['Green Potion', 'Blue Potion', 'Red Potion']:
|
||||
location = random.choice(filter_locations(ItemFactory(potion, player), locations, world))
|
||||
location = random.choice(filter_locations(ItemFactory(potion, player), locations, world, potion=True))
|
||||
locations.remove(location)
|
||||
p_item = next(item for item in world.itempool if item.name == potion and item.player == player)
|
||||
world.push_item(location, p_item, collect=False)
|
||||
|
||||
10
Mystery.py
10
Mystery.py
@@ -30,6 +30,7 @@ def main():
|
||||
parser.add_argument('--create_spoiler', action='store_true')
|
||||
parser.add_argument('--no_race', action='store_true')
|
||||
parser.add_argument('--suppress_rom', action='store_true')
|
||||
parser.add_argument('--bps', action='store_true')
|
||||
parser.add_argument('--rom')
|
||||
parser.add_argument('--enemizercli')
|
||||
parser.add_argument('--outputpath')
|
||||
@@ -64,6 +65,7 @@ def main():
|
||||
erargs.names = args.names
|
||||
erargs.create_spoiler = args.create_spoiler
|
||||
erargs.suppress_rom = args.suppress_rom
|
||||
erargs.bps = args.bps
|
||||
erargs.race = not args.no_race
|
||||
erargs.outputname = seedname
|
||||
if args.outputpath:
|
||||
@@ -140,12 +142,14 @@ def roll_settings(weights):
|
||||
|
||||
ret.algorithm = get_choice('algorithm')
|
||||
|
||||
glitch_map = {'none': 'noglitches', 'no_logic': 'nologic', 'owg': 'owglitches',
|
||||
'minorglitches': 'minorglitches'}
|
||||
glitches_required = get_choice('glitches_required')
|
||||
if glitches_required is not None:
|
||||
if glitches_required not in ['none', 'owg', 'no_logic']:
|
||||
print("Only NMG, OWG, and No Logic supported")
|
||||
if glitches_required not in glitch_map.keys():
|
||||
print(f'Logic did not match one of: {", ".join(glitch_map.keys())}')
|
||||
glitches_required = 'none'
|
||||
ret.logic = {'none': 'noglitches', 'owg': 'owglitches', 'no_logic': 'nologic'}[glitches_required]
|
||||
ret.logic = glitch_map[glitches_required]
|
||||
|
||||
item_placement = get_choice('item_placement')
|
||||
# not supported in ER
|
||||
|
||||
@@ -412,7 +412,7 @@ def vanilla_fallback(item_to_place, locations, world):
|
||||
return []
|
||||
|
||||
|
||||
def filter_locations(item_to_place, locations, world, vanilla_skip=False):
|
||||
def filter_locations(item_to_place, locations, world, vanilla_skip=False, potion=False):
|
||||
if world.algorithm == 'vanilla_fill':
|
||||
config, filtered = world.item_pool_config, []
|
||||
item_name = 'Bottle' if item_to_place.name.startswith('Bottle') else item_to_place.name
|
||||
@@ -445,6 +445,12 @@ def filter_locations(item_to_place, locations, world, vanilla_skip=False):
|
||||
restricted = config.location_groups[0].locations
|
||||
filtered = [l for l in locations if l.name in restricted and l.player in restricted[l.name]]
|
||||
return filtered if len(filtered) > 0 else locations
|
||||
elif potion:
|
||||
restricted = config.location_groups[0].locations
|
||||
filtered = [l for l in locations if l.name not in restricted or l.player not in restricted[l.name]]
|
||||
if len(filtered) == 0:
|
||||
raise RuntimeError('Can\'t sell potion of a certain type due to district restriction')
|
||||
return filtered
|
||||
return locations
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user