Implemented District/Nearby Dungeon Item Shuffle
This commit is contained in:
@@ -147,11 +147,14 @@ class CustomSettings(object):
|
||||
args.compassshuffle[p] = get_setting(settings['compassshuffle'], args.compassshuffle[p])
|
||||
|
||||
if get_setting(settings['keysanity'], args.keysanity):
|
||||
args.bigkeyshuffle[p] = True
|
||||
if args.bigkeyshuffle[p] == 'none':
|
||||
args.bigkeyshuffle[p] = 'wild'
|
||||
if args.keyshuffle[p] == 'none':
|
||||
args.keyshuffle[p] = 'wild'
|
||||
args.mapshuffle[p] = True
|
||||
args.compassshuffle[p] = True
|
||||
if args.mapshuffle[p] == 'none':
|
||||
args.mapshuffle[p] = 'wild'
|
||||
if args.compassshuffle[p] == 'none':
|
||||
args.compassshuffle[p] = 'wild'
|
||||
|
||||
args.shufflebosses[p] = get_setting(settings['boss_shuffle'], get_setting(settings['shufflebosses'], args.shufflebosses[p]))
|
||||
args.shuffleenemies[p] = get_setting(settings['enemy_shuffle'], get_setting(settings['shuffleenemies'], args.shuffleenemies[p]))
|
||||
|
||||
@@ -233,7 +233,7 @@ def modify_proposal(proposed_map, explored_state, doors_to_connect, hash_code_se
|
||||
|
||||
def explore_proposal(name, entrance_regions, all_regions, proposed_map, valid_doors, bk_special, world, player):
|
||||
start = ExplorationState(dungeon=name)
|
||||
bk_relevant = (world.door_type_mode[player] == 'original' and not world.bigkeyshuffle[player]) or bk_special
|
||||
bk_relevant = (world.door_type_mode[player] == 'original' and world.bigkeyshuffle[player] == 'none') or bk_special
|
||||
start.big_key_special = bk_special
|
||||
original_state = extend_reachable_state_lenient(entrance_regions, start, proposed_map,
|
||||
all_regions, valid_doors, bk_relevant, world, player)
|
||||
@@ -302,7 +302,7 @@ def valid_path(name, starting_regions, target, valid_doors, proposed_map, all_re
|
||||
target_regions.add(region)
|
||||
|
||||
start = ExplorationState(dungeon=name)
|
||||
bk_relevant = (world.door_type_mode[player] == 'original' and not world.bigkeyshuffle[player]) or bk_special
|
||||
bk_relevant = (world.door_type_mode[player] == 'original' and world.bigkeyshuffle[player] == 'none') or bk_special
|
||||
start.big_key_special = bk_special
|
||||
original_state = extend_reachable_state_lenient(starting_regions, start, proposed_map, all_regions,
|
||||
valid_doors, bk_relevant, world, player)
|
||||
|
||||
@@ -14,6 +14,8 @@ def dungeon_page(parent):
|
||||
self.frames = {}
|
||||
self.frames["keysanity"] = Frame(self)
|
||||
self.frames["keysanity"].pack(anchor=W)
|
||||
self.frames["keysanity2"] = Frame(self)
|
||||
self.frames["keysanity2"].pack(anchor=W)
|
||||
|
||||
## Dungeon Item Shuffle
|
||||
mscbLabel = Label(self.frames["keysanity"], text="Dungeon Items: ")
|
||||
@@ -23,9 +25,15 @@ def dungeon_page(parent):
|
||||
# Defns include frame name, widget type, widget options, widget placement attributes
|
||||
# This first set goes in the Keysanity frame
|
||||
with open(os.path.join("resources","app","gui","randomize","dungeon","keysanity.json")) as keysanityItems:
|
||||
myDict = json.load(keysanityItems)
|
||||
myDict = myDict["keysanity"]
|
||||
dictWidgets = widgets.make_widgets_from_dict(self, myDict, self.frames["keysanity"])
|
||||
myDictFile = json.load(keysanityItems)
|
||||
myDict = myDictFile["keysanity"]
|
||||
myDict1, myDict2 = dict(), dict()
|
||||
count = 2
|
||||
for key in myDict.keys():
|
||||
(myDict1 if count > 0 else myDict2)[key] = myDict[key]
|
||||
count -= 1
|
||||
dictWidgets = {**widgets.make_widgets_from_dict(self, myDict1, self.frames["keysanity"]), \
|
||||
**widgets.make_widgets_from_dict(self, myDict2, self.frames["keysanity2"])}
|
||||
for key in dictWidgets:
|
||||
self.widgets[key] = dictWidgets[key]
|
||||
packAttrs = {"side":LEFT}
|
||||
|
||||
@@ -96,12 +96,15 @@ def resolve_districts(world):
|
||||
|
||||
for name, district in world.districts[player].items():
|
||||
if district.dungeon:
|
||||
dungeon = world.get_dungeon(district.dungeon, player)
|
||||
dungeon.districts = [district] + dungeon.districts
|
||||
layout = world.dungeon_layouts[player][district.dungeon]
|
||||
district.locations.update([l.name for r in layout.master_sector.regions
|
||||
for l in r.locations if not l.item and l.real])
|
||||
else:
|
||||
for region_name in district.regions:
|
||||
region = world.get_region(region_name, player)
|
||||
region.districts.append(district)
|
||||
for location in region.locations:
|
||||
if not location.item and location.real:
|
||||
district.locations.add(location.name)
|
||||
@@ -115,6 +118,7 @@ def resolve_districts(world):
|
||||
RuntimeError(f'No region connected to entrance: {ent.name} Likely a missing entry in OWExitTypes')
|
||||
visited.add(region)
|
||||
if region.type == RegionType.Cave:
|
||||
region.districts.append(district)
|
||||
for location in region.locations:
|
||||
if not location.item and location.real:
|
||||
district.locations.add(location.name)
|
||||
@@ -123,6 +127,8 @@ def resolve_districts(world):
|
||||
queue.appendleft(ext.connected_region)
|
||||
elif region.type == RegionType.Dungeon and region.dungeon:
|
||||
district.dungeons.add(region.dungeon.name)
|
||||
if district not in region.dungeon.districts:
|
||||
region.dungeon.districts.append(district)
|
||||
elif region.name in inaccessible:
|
||||
district.access_points.add(region)
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ def create_item_pool_config(world):
|
||||
groups = LocationGroup('Major').locs(init_set)
|
||||
if world.prizeshuffle[player] != 'none':
|
||||
groups.locations.extend(mode_grouping['Prizes'])
|
||||
if world.bigkeyshuffle[player]:
|
||||
if world.bigkeyshuffle[player] != 'none':
|
||||
groups.locations.extend(mode_grouping['Big Keys'])
|
||||
if world.dropshuffle[player] != 'none':
|
||||
groups.locations.extend(mode_grouping['Big Key Drops'])
|
||||
@@ -144,9 +144,9 @@ def create_item_pool_config(world):
|
||||
groups.locations.extend(mode_grouping['Key Drops'])
|
||||
if world.pottery[player] not in ['none', 'cave']:
|
||||
groups.locations.extend(mode_grouping['Pot Keys'])
|
||||
if world.compassshuffle[player]:
|
||||
if world.compassshuffle[player] != 'none':
|
||||
groups.locations.extend(mode_grouping['Compasses'])
|
||||
if world.mapshuffle[player]:
|
||||
if world.mapshuffle[player] != 'none':
|
||||
groups.locations.extend(mode_grouping['Maps'])
|
||||
if world.shopsanity[player]:
|
||||
groups.locations.append('Capacity Upgrade - Left')
|
||||
@@ -259,12 +259,12 @@ def location_prefilled(location, world, player):
|
||||
|
||||
def previously_reserved(location, world, player):
|
||||
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]):
|
||||
if world.restrict_boss_items[player] == 'mapcompass' and (world.compassshuffle[player] == 'none'
|
||||
or world.mapshuffle[player] == 'none'):
|
||||
return True
|
||||
if world.restrict_boss_items[player] == 'dungeon' and (not world.compassshuffle[player]
|
||||
or not world.mapshuffle[player]
|
||||
or not world.bigkeyshuffle[player]
|
||||
if world.restrict_boss_items[player] == 'dungeon' and (world.compassshuffle[player] == 'none'
|
||||
or world.mapshuffle[player] == 'none'
|
||||
or world.bigkeyshuffle[player] == 'none'
|
||||
or world.keyshuffle[player] == 'none'
|
||||
or world.prizeshuffle[player] in ['none', 'dungeon']):
|
||||
return True
|
||||
@@ -303,6 +303,7 @@ def massage_item_pool(world):
|
||||
if item.prize:
|
||||
dungeon = dungeon_pool[item.player].pop()
|
||||
dungeon.prize = item
|
||||
item.dungeon_object = dungeon
|
||||
player_pool[item.player].append(item)
|
||||
for dungeon in world.dungeons:
|
||||
for item in dungeon.all_items:
|
||||
@@ -381,13 +382,13 @@ def determine_major_items(world, player):
|
||||
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]:
|
||||
if world.bigkeyshuffle[player] != 'none':
|
||||
major_item_set.update({x for x, y in item_table.items() if y[2] == 'BigKey'})
|
||||
if world.keyshuffle[player] != 'none':
|
||||
major_item_set.update({x for x, y in item_table.items() if y[2] == 'SmallKey'})
|
||||
if world.compassshuffle[player]:
|
||||
if world.compassshuffle[player] != 'none':
|
||||
major_item_set.update({x for x, y in item_table.items() if y[2] == 'Compass'})
|
||||
if world.mapshuffle[player]:
|
||||
if world.mapshuffle[player] != 'none':
|
||||
major_item_set.update({x for x, y in item_table.items() if y[2] == 'Map'})
|
||||
if world.shopsanity[player]:
|
||||
major_item_set.add('Bomb Upgrade (+5)')
|
||||
|
||||
@@ -96,8 +96,14 @@ def roll_settings(weights):
|
||||
dungeon_items = get_choice('dungeon_items')
|
||||
dungeon_items = '' if dungeon_items == 'standard' or dungeon_items is None else dungeon_items
|
||||
dungeon_items = 'mcsb' if dungeon_items == 'full' else dungeon_items
|
||||
ret.mapshuffle = get_choice_bool('map_shuffle') if 'map_shuffle' in weights else 'm' in dungeon_items
|
||||
ret.compassshuffle = get_choice_bool('compass_shuffle') if 'compass_shuffle' in weights else 'c' in dungeon_items
|
||||
if 'map_shuffle' in weights:
|
||||
ret.mapshuffle = get_choice('map_shuffle')
|
||||
elif 'm' in dungeon_items:
|
||||
ret.mapshuffle = 'wild'
|
||||
if 'compass_shuffle' in weights:
|
||||
ret.compassshuffle = get_choice('compass_shuffle')
|
||||
elif 'c' in dungeon_items:
|
||||
ret.compassshuffle = 'wild'
|
||||
if 'smallkey_shuffle' in weights:
|
||||
ret.keyshuffle = get_choice('smallkey_shuffle')
|
||||
else:
|
||||
@@ -105,7 +111,10 @@ def roll_settings(weights):
|
||||
ret.keyshuffle = 'wild'
|
||||
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
|
||||
if 'bigkey_shuffle' in weights:
|
||||
ret.bigkeyshuffle = get_choice('bigkey_shuffle')
|
||||
elif 'b' in dungeon_items:
|
||||
ret.bigkeyshuffle = 'wild'
|
||||
ret.prizeshuffle = get_choice('prize_shuffle')
|
||||
|
||||
ret.accessibility = get_choice('accessibility')
|
||||
@@ -140,7 +149,7 @@ def roll_settings(weights):
|
||||
|
||||
ret.dungeon_counters = get_choice_non_bool('dungeon_counters') if 'dungeon_counters' in weights else 'default'
|
||||
if ret.dungeon_counters == 'default':
|
||||
ret.dungeon_counters = 'pickup' if ret.door_shuffle != 'vanilla' or ret.compassshuffle == 'on' else 'off'
|
||||
ret.dungeon_counters = 'pickup' if ret.door_shuffle != 'vanilla' or ret.compassshuffle != 'none' else 'off'
|
||||
|
||||
ret.pseudoboots = get_choice_bool('pseudoboots')
|
||||
ret.shopsanity = get_choice_bool('shopsanity')
|
||||
|
||||
Reference in New Issue
Block a user