Initial Prize Shuffle Implementation

commit c89c5d3798e2a777011e90d565d74af792330d9f
commit 4159f2e7097fca648828a60d8f6878211d0ded9e
commit a80e3a4301d69146ccfffe0f2f375adac381e165
commit d8ac588cb904152831f514d8276be4e39a43dcd0
commit 68eb75e3391631355b4f56f1dcb7e9dadadf1fdf
commit ba241b47964eadfb40ad323f87b1117598dd91a6
commit aed2821c7165822f5fd5cc1ff3f58f2af095d915
commit bd1c5d8d35ae3cae5f27f236346fff057b7b8cd7
commit f034e31cc585a1648657fc2c4850ebc0c1d8bf78

Author: codemann8 <codemann8@gmail.com>
This commit is contained in:
codemann8
2024-05-23 18:39:02 -05:00
parent 8b295a74ad
commit 103e098a2e
25 changed files with 573 additions and 331 deletions

View File

@@ -138,6 +138,7 @@ class CustomSettings(object):
args.experimental[p] = get_setting(settings['experimental'], args.experimental[p])
args.collection_rate[p] = get_setting(settings['collection_rate'], args.collection_rate[p])
args.openpyramid[p] = get_setting(settings['openpyramid'], args.openpyramid[p])
args.prizeshuffle[p] = get_setting(settings['prizeshuffle'], args.prizeshuffle[p])
args.bigkeyshuffle[p] = get_setting(settings['bigkeyshuffle'], args.bigkeyshuffle[p])
args.keyshuffle[p] = get_setting(settings['keyshuffle'], args.keyshuffle[p])
args.mapshuffle[p] = get_setting(settings['mapshuffle'], args.mapshuffle[p])
@@ -320,6 +321,7 @@ class CustomSettings(object):
settings_dict[p]['experimental'] = world.experimental[p]
settings_dict[p]['collection_rate'] = world.collection_rate[p]
settings_dict[p]['openpyramid'] = world.open_pyramid[p]
settings_dict[p]['prizeshuffle'] = world.prizeshuffle[p]
settings_dict[p]['bigkeyshuffle'] = world.bigkeyshuffle[p]
settings_dict[p]['keyshuffle'] = world.keyshuffle[p]
settings_dict[p]['mapshuffle'] = world.mapshuffle[p]

View File

@@ -111,6 +111,7 @@ SETTINGSTOPROCESS = {
"mapshuffle": "mapshuffle",
"compassshuffle": "compassshuffle",
"bigkeyshuffle": "bigkeyshuffle",
"prizeshuffle": "prizeshuffle",
"key_logic_algorithm": "key_logic_algorithm",
"dungeondoorshuffle": "door_shuffle",
"dungeonintensity": "intensity",

View File

@@ -5,7 +5,7 @@ import time
from BaseClasses import CrystalBarrier, DoorType, Hook, RegionType, Sector
from BaseClasses import hook_from_door, flooded_keys
from Regions import dungeon_events, flooded_keys_reverse
from Regions import location_events, flooded_keys_reverse
def pre_validate(builder, entrance_region_names, split_dungeon, world, player):
@@ -556,7 +556,7 @@ class ExplorationState(object):
if key_checks and location not in self.found_locations:
if location.forced_item and 'Small Key' in location.item.name:
self.key_locations += 1
if location.name not in dungeon_events and '- Prize' not in location.name and location.name not in ['Agahnim 1', 'Agahnim 2']:
if location.name not in location_events and not ('- Prize' in location.name and location.prize) and location.name not in ['Agahnim 1', 'Agahnim 2']:
self.ttl_locations += 1
if location not in self.found_locations:
self.found_locations.append(location)
@@ -568,13 +568,13 @@ class ExplorationState(object):
else:
self.bk_found.add(location)
self.re_add_big_key_doors()
if location.name in dungeon_events and location.name not in self.events:
if location.name in location_events and location.name not in self.events:
if self.flooded_key_check(location):
self.perform_event(location.name, key_region)
if location.name in flooded_keys_reverse.keys() and self.location_found(
flooded_keys_reverse[location.name]):
self.perform_event(flooded_keys_reverse[location.name], key_region)
if '- Prize' in location.name:
if location.prize:
self.prize_received = True
def flooded_key_check(self, location):
@@ -837,7 +837,7 @@ def count_locations_exclude_big_chest(locations, world, player):
def prize_or_event(loc):
return loc.name in dungeon_events or '- Prize' in loc.name or loc.name in ['Agahnim 1', 'Agahnim 2']
return loc.name in location_events or loc.prize
def reserved_location(loc, world, player):

View File

@@ -59,6 +59,8 @@ def create_item_pool_config(world):
if info.prize:
d_name = "Thieves' Town" if dungeon.startswith('Thieves') else dungeon
config.reserved_locations[player].add(f'{d_name} - Boss')
if world.prizeshuffle[player] != 'none':
config.reserved_locations[player].add(f'{d_name} - Prize')
for dungeon in world.dungeons:
if world.restrict_boss_items[dungeon.player] != 'none':
for item in dungeon.all_items:
@@ -118,6 +120,9 @@ def create_item_pool_config(world):
LocationGroup('bkgt').locs(mode_grouping['GT Trash'])]
for loc_name in mode_grouping['Big Chests'] + mode_grouping['Heart Containers']:
config.reserved_locations[player].add(loc_name)
if world.prizeshuffle[player] != 'none':
for loc_name in mode_grouping['Prizes']:
config.reserved_locations[player].add(loc_name)
elif world.algorithm == 'major_only':
config.location_groups = [
LocationGroup('MajorItems'),
@@ -127,6 +132,8 @@ def create_item_pool_config(world):
init_set = mode_grouping['Overworld Major'] + mode_grouping['Big Chests'] + mode_grouping['Heart Containers']
for player in range(1, world.players + 1):
groups = LocationGroup('Major').locs(init_set)
if world.prizeshuffle[player] != 'none':
groups.locations.extend(mode_grouping['Prizes'])
if world.bigkeyshuffle[player]:
groups.locations.extend(mode_grouping['Big Keys'])
if world.dropshuffle[player] != 'none':
@@ -251,21 +258,33 @@ def location_prefilled(location, world, player):
def previously_reserved(location, world, player):
if '- Boss' in location.name:
if '- Boss' in location.name or '- Prize' in location.name:
if world.restrict_boss_items[player] == 'mapcompass' and (not world.compassshuffle[player]
or not world.mapshuffle[player]):
return True
if world.restrict_boss_items[player] == 'dungeon' and (not world.compassshuffle[player]
or not world.mapshuffle[player]
or not world.bigkeyshuffle[player]
or world.keyshuffle[player] == 'none'):
or world.keyshuffle[player] == 'none'
or world.prizeshuffle[player] in ['none', 'dungeon']):
return True
return False
def massage_item_pool(world):
player_pool = defaultdict(list)
dungeon_pool = defaultdict(list)
for dungeon in world.dungeons:
if dungeon_table[dungeon.name].prize:
dungeon_pool[dungeon.player].append(dungeon)
for player in dungeon_pool:
dungeons = list(dungeon_pool[player])
random.shuffle(dungeons)
dungeon_pool[player] = dungeons
for item in world.itempool:
if item.prize:
dungeon = dungeon_pool[item.player].pop()
dungeon.prize = item
player_pool[item.player].append(item)
for dungeon in world.dungeons:
for item in dungeon.all_items:
@@ -273,7 +292,7 @@ def massage_item_pool(world):
player_pool[item.player].append(item)
player_locations = defaultdict(list)
for player in player_pool:
player_locations[player] = [x for x in world.get_unfilled_locations(player) if '- Prize' not in x.name]
player_locations[player] = [x for x in world.get_unfilled_locations(player) if not x.prize]
discrepancy = len(player_pool[player]) - len(player_locations[player])
if discrepancy:
trash_options = [x for x in player_pool[player] if x.name in trash_items]
@@ -342,6 +361,8 @@ def determine_major_items(world, player):
major_item_set = set(major_items)
if world.progressive == 'off':
pass # now what?
if world.prizeshuffle[player] not in ['none', 'dungeon']:
major_item_set.update({x for x, y in item_table.items() if y[2] == 'Prize'})
if world.bigkeyshuffle[player]:
major_item_set.update({x for x, y in item_table.items() if y[2] == 'BigKey'})
if world.keyshuffle[player] != 'none':
@@ -687,6 +708,11 @@ mode_grouping = {
'Graveyard Cave', 'Kakariko Well - Top', "Blind's Hideout - Top", 'Bonk Rock Cave', "Aginah's Cave",
'Chest Game', 'Digging Game', 'Mire Shed - Left', 'Mimic Cave'
],
'Prizes': [
'Eastern Palace - Prize', 'Desert Palace - Prize', 'Tower of Hera - Prize',
'Palace of Darkness - Prize', 'Swamp Palace - Prize', 'Skull Woods - Prize',
"Thieves' Town - Prize", 'Ice Palace - Prize', 'Misery Mire - Prize', 'Turtle Rock - Prize',
],
'Big Keys': [
'Eastern Palace - Big Key Chest', 'Ganons Tower - Big Key Chest',
'Desert Palace - Big Key Chest', 'Tower of Hera - Big Key Chest', 'Palace of Darkness - Big Key Chest',

View File

@@ -106,6 +106,7 @@ def roll_settings(weights):
if 'u' in dungeon_items:
ret.keyshuffle = 'universal'
ret.bigkeyshuffle = get_choice_bool('bigkey_shuffle') if 'bigkey_shuffle' in weights else 'b' in dungeon_items
ret.prizeshuffle = get_choice('prize_shuffle')
ret.accessibility = get_choice('accessibility')
ret.restrict_boss_items = get_choice('restrict_boss_items')