Merged in DR v1.2.0.1

This commit is contained in:
codemann8
2022-12-16 18:14:27 -06:00
21 changed files with 160 additions and 74 deletions

View File

@@ -218,7 +218,6 @@ def modify_proposal(proposed_map, explored_state, doors_to_connect, hash_code_se
else:
logger.debug(f' Re-Linking {attempt.name} -> {new_door.name}')
logger.debug(f' Re-Linking {old_attempt.name} -> {old_target.name}')
hash_code_set.add(hash_code)
return proposed_map, hash_code

View File

@@ -189,26 +189,27 @@ def district_item_pool_config(world):
if district.dungeon:
adjustment = len([i for i in world.get_dungeon(name, p).all_items
if i.is_inside_dungeon_item(world)])
dist_len = len(district.locations) - adjustment
dist_adj = adjustment
if name not in district_choices:
district_choices[name] = (district.sphere_one, dist_len)
district_choices[name] = (district.sphere_one, dist_adj)
else:
so, amt = district_choices[name]
district_choices[name] = (so or district.sphere_one, amt + dist_len)
district_choices[name] = (so or district.sphere_one, amt + dist_adj)
chosen_locations = defaultdict(set)
location_cnt = 0
adjustment_cnt = 0
# choose a sphere one district
sphere_one_choices = [d for d, info in district_choices.items() if info[0]]
sphere_one = random.choice(sphere_one_choices)
so, amt = district_choices[sphere_one]
location_cnt += amt
so, adj = district_choices[sphere_one]
for player in range(1, world.players + 1):
for location in world.districts[player][sphere_one].locations:
chosen_locations[location].add(player)
del district_choices[sphere_one]
config.recorded_choices.append(sphere_one)
adjustment_cnt += adj
location_cnt = len(chosen_locations) - adjustment_cnt
scale_factors = defaultdict(int)
scale_total = 0
@@ -217,8 +218,9 @@ def district_item_pool_config(world):
dungeon = world.get_entrance(ent, p).connected_region.dungeon
if dungeon:
scale = world.crystals_needed_for_gt[p]
scale_total += scale
scale_factors[dungeon.name] += scale
if scale > 0:
scale_total += scale
scale_factors[dungeon.name] += scale
scale_total = max(1, scale_total)
scale_divisors = defaultdict(lambda: 1)
scale_divisors.update(scale_factors)
@@ -226,13 +228,15 @@ def district_item_pool_config(world):
while location_cnt < item_cnt:
weights = [scale_total / scale_divisors[d] for d in district_choices.keys()]
choice = random.choices(list(district_choices.keys()), weights=weights, k=1)[0]
so, amt = district_choices[choice]
location_cnt += amt
so, adj = district_choices[choice]
for player in range(1, world.players + 1):
for location in world.districts[player][choice].locations:
chosen_locations[location].add(player)
del district_choices[choice]
config.recorded_choices.append(choice)
adjustment_cnt += adj
location_cnt = len(chosen_locations) - adjustment_cnt
config.placeholders = location_cnt - item_cnt
config.location_groups[0].locations = chosen_locations
@@ -383,7 +387,10 @@ def vanilla_fallback(item_to_place, locations, world):
def filter_locations(item_to_place, locations, world, vanilla_skip=False, potion=False):
config = world.item_pool_config
item_name = 'Bottle' if item_to_place.name.startswith('Bottle') else item_to_place.name
if not isinstance(item_to_place, str):
item_name = 'Bottle' if item_to_place.name.startswith('Bottle') else item_to_place.name
else:
item_name = item_to_place
if world.algorithm == 'vanilla_fill':
filtered = []
item_name = 'Bottle' if item_to_place.name.startswith('Bottle') else item_to_place.name
@@ -443,7 +450,6 @@ def filter_pot_locations(locations, world):
return locations
vanilla_mapping = {
'Green Pendant': ['Eastern Palace - Prize'],
'Red Pendant': ['Desert Palace - Prize', 'Tower of Hera - Prize'],

View File

@@ -774,12 +774,19 @@ def do_vanilla_connect(pool_def, avail):
if avail.world.pottery[avail.player] not in ['none', 'keys', 'dungeon']:
return
defaults = inverted_default_connections if avail.inverted else default_connections
if avail.inverted:
if 'Dark Death Mountain Fairy' in pool_def['entrances']:
pool_def['entrances'].remove('Dark Death Mountain Fairy')
pool_def['entrances'].append('Bumper Cave (top)')
for entrance in pool_def['entrances']:
if entrance in avail.entrances:
target = defaults[entrance]
connect_simple(avail.world, entrance, target, avail.player)
avail.entrances.remove(entrance)
avail.exits.remove(target)
if entrance in avail.default_map:
connect_vanilla_two_way(entrance, avail.default_map[entrance], avail)
else:
connect_simple(avail.world, entrance, target, avail.player)
avail.entrances.remove(entrance)
avail.exits.remove(target)
def do_mandatory_connections(avail, entrances, cave_options, must_exit):
@@ -1228,7 +1235,7 @@ modes = {
'Light World Bomb Hut', '20 Rupee Cave', '50 Rupee Cave', 'Hookshot Fairy',
'Palace of Darkness Hint', 'Dark Lake Hylia Ledge Spike Cave',
'Dark Desert Hint',
'Links House', 'Inverted Links House', 'Tavern North']
'Links House', 'Tavern North']
},
'old_man_cave': { # have to do old man cave first so lw dungeon don't use up everything
'special': 'old_man_cave_east',
@@ -1304,7 +1311,7 @@ modes = {
'Light World Bomb Hut', '20 Rupee Cave', '50 Rupee Cave', 'Hookshot Fairy',
'Palace of Darkness Hint', 'Dark Lake Hylia Ledge Spike Cave',
'Dark Desert Hint',
'Links House', 'Inverted Links House', 'Tavern North']
'Links House', 'Tavern North'] # inverted links house gets substituted
}
}
},
@@ -1572,6 +1579,7 @@ entrance_map = {
'Paradox Cave (Bottom)': 'Paradox Cave Exit (Bottom)',
'Paradox Cave (Middle)': 'Paradox Cave Exit (Middle)',
'Paradox Cave (Top)': 'Paradox Cave Exit (Top)',
'Inverted Dark Sanctuary': 'Inverted Dark Sanctuary Exit',
}
@@ -1607,7 +1615,7 @@ single_entrance_map = {
'Lake Hylia Fortune Teller': 'Lake Hylia Fortune Teller', 'Lake Hylia Fairy': 'Lake Hylia Healer Fairy',
'Bonk Fairy (Light)': 'Bonk Fairy (Light)', 'Lumberjack House': 'Lumberjack House', 'Dam': 'Dam',
'Blinds Hideout': 'Blinds Hideout', 'Waterfall of Wishing': 'Waterfall of Wishing',
'Inverted Bomb Shop': 'Inverted Bomb Shop', 'Inverted Dark Sanctuary': 'Inverted Dark Sanctuary',
'Inverted Bomb Shop': 'Inverted Bomb Shop'
}
default_dw = {

View File

@@ -122,7 +122,9 @@ def roll_settings(weights):
'dungeons': 'dungeons',
'pedestal': 'pedestal',
'triforce-hunt': 'triforcehunt',
'trinity': 'trinity'
'trinity': 'trinity',
'ganonhunt': 'ganonhunt',
'completionist': 'completionist'
}[goal]
ret.openpyramid = get_choice('open_pyramid') if 'open_pyramid' in weights else 'auto'
@@ -215,5 +217,6 @@ def roll_settings(weights):
ret.ow_palettes = get_choice('ow_palettes', romweights)
ret.uw_palettes = get_choice('uw_palettes', romweights)
ret.shuffle_sfx = get_choice('shuffle_sfx', romweights) == 'on'
ret.msu_resume = get_choice('msu_resume', romweights) == 'on'
return ret