Implemented Customizer OWR Edge Groups

This commit is contained in:
codemann8
2023-09-06 13:58:19 -05:00
parent 99753c0039
commit 72e41e20dc
4 changed files with 104 additions and 64 deletions

View File

@@ -332,8 +332,8 @@ def create_owedge(player, name, owIndex, direction, terrain, edge_id, owSlotInde
OWEdgeGroups = {
#(IsStandard, World, EdgeAxis, Terrain, HasParallel, NumberInGroup)
(St, LW, Vt, Ld, PL, 1): (
#(IsStandard, World, EdgeAxis, Terrain, HasParallel, NumberInGroup, CustomizerGroup)
(St, LW, Vt, Ld, PL, 1, None): (
[
['Hyrule Castle SW'],
['Hyrule Castle SE']
@@ -343,7 +343,7 @@ OWEdgeGroups = {
['Links House NE']
]
),
(St, LW, Hz, Ld, PL, 3): (
(St, LW, Hz, Ld, PL, 3, None): (
[
['Central Bonk Rocks EN', 'Central Bonk Rocks EC', 'Central Bonk Rocks ES']
],
@@ -351,7 +351,7 @@ OWEdgeGroups = {
['Links House WN', 'Links House WC', 'Links House WS']
]
),
(Op, LW, Hz, Ld, PL, 1): (
(Op, LW, Hz, Ld, PL, 1, None): (
[
['Lost Woods EN'],
['East Death Mountain EN'],
@@ -391,7 +391,7 @@ OWEdgeGroups = {
['East Death Mountain WS']
]
),
(Op, LW, Hz, Ld, NP, 1): (
(Op, LW, Hz, Ld, NP, 1, None): (
[
['Forgotten Forest ES']
],
@@ -399,7 +399,7 @@ OWEdgeGroups = {
['Hyrule Castle WN']
]
),
(Op, LW, Vt, Ld, PL, 1): (
(Op, LW, Vt, Ld, PL, 1, None): (
[
['Lumberjack SW'],
['Mountain Pass SE'],
@@ -439,7 +439,7 @@ OWEdgeGroups = {
['Octoballoon NE']
]
),
(Op, LW, Vt, Ld, NP, 1): (
(Op, LW, Vt, Ld, NP, 1, None): (
[
['Master Sword Meadow SC'],
['Zoras Domain SW']
@@ -449,7 +449,7 @@ OWEdgeGroups = {
['Zora Waterfall NE']
]
),
(Op, LW, Hz, Ld, PL, 2): (
(Op, LW, Hz, Ld, PL, 2, None): (
[
['Kakariko Fortune EN', 'Kakariko Fortune ES'],
['Kakariko Pond EN', 'Kakariko Pond ES'],
@@ -465,7 +465,7 @@ OWEdgeGroups = {
['Statues WN', 'Statues WS']
]
),
(Op, LW, Hz, Ld, NP, 2): (
(Op, LW, Hz, Ld, NP, 2, None): (
[
['Desert EC', 'Desert ES']
],
@@ -473,7 +473,7 @@ OWEdgeGroups = {
['Desert Pass WC', 'Desert Pass WS']
]
),
(Op, LW, Vt, Ld, PL, 2): (
(Op, LW, Vt, Ld, PL, 2, None): (
[
['Lost Woods SW', 'Lost Woods SC'],
['Lost Woods Pass SW', 'Lost Woods Pass SE'],
@@ -489,7 +489,7 @@ OWEdgeGroups = {
['Wooden Bridge NW', 'Wooden Bridge NE']
]
),
(Op, LW, Hz, Wr, PL, 1): (
(Op, LW, Hz, Wr, PL, 1, None): (
[
['Potion Shop EN'],
['Lake Hylia EC'],
@@ -505,7 +505,7 @@ OWEdgeGroups = {
['Statues WC']
]
),
(Op, LW, Hz, Wr, NP, 1): (
(Op, LW, Hz, Wr, NP, 1, None): (
[
['Hobo EC']
],
@@ -513,7 +513,7 @@ OWEdgeGroups = {
['Stone Bridge WC']
]
),
(Op, LW, Vt, Wr, PL, 1): (
(Op, LW, Vt, Wr, PL, 1, None): (
[
['Tree Line SC'],
['Ice Cave SW'],
@@ -525,7 +525,7 @@ OWEdgeGroups = {
['Wooden Bridge NC']
]
),
(Op, DW, Hz, Ld, PL, 1): (
(Op, DW, Hz, Ld, PL, 1, None): (
[
['Skull Woods EN'],
['East Dark Death Mountain EN'],
@@ -563,7 +563,7 @@ OWEdgeGroups = {
['East Dark Death Mountain WS']
]
),
(Op, DW, Vt, Ld, PL, 1): (
(Op, DW, Vt, Ld, PL, 1, None): (
[
['Dark Lumberjack SW'],
['Bumper Cave SE'],
@@ -607,11 +607,11 @@ OWEdgeGroups = {
['Bomber Corner NE']
]
),
(Op, DW, Hz, Ld, NP, 1): (
(Op, DW, Hz, Ld, NP, 1, None): (
[ ],
[ ]
),
(Op, DW, Hz, Ld, PL, 2): (
(Op, DW, Hz, Ld, PL, 2, None): (
[
['Dark Fortune EN', 'Dark Fortune ES'],
['Outcast Pond EN', 'Outcast Pond ES'],
@@ -627,11 +627,11 @@ OWEdgeGroups = {
['Hype Cave WN', 'Hype Cave WS']
]
),
(Op, DW, Vt, Ld, NP, 1): (
(Op, DW, Vt, Ld, NP, 1, None): (
[ ],
[ ]
),
(Op, DW, Hz, Ld, NP, 2): (
(Op, DW, Hz, Ld, NP, 2, None): (
[
['Dig Game EC', 'Dig Game ES']
],
@@ -639,7 +639,7 @@ OWEdgeGroups = {
['Frog WC', 'Frog WS']
]
),
(Op, DW, Vt, Ld, PL, 2): (
(Op, DW, Vt, Ld, PL, 2, None): (
[
['Skull Woods SW', 'Skull Woods SC'],
['Skull Woods Pass SW', 'Skull Woods Pass SE'],
@@ -655,7 +655,7 @@ OWEdgeGroups = {
['Broken Bridge NW', 'Broken Bridge NE']
]
),
(Op, DW, Hz, Ld, PL, 3): (
(Op, DW, Hz, Ld, PL, 3, None): (
[
['Dark Bonk Rocks EN', 'Dark Bonk Rocks EC', 'Dark Bonk Rocks ES']
],
@@ -663,7 +663,7 @@ OWEdgeGroups = {
['Big Bomb Shop WN', 'Big Bomb Shop WC', 'Big Bomb Shop WS']
]
),
(Op, DW, Hz, Wr, PL, 1): (
(Op, DW, Hz, Wr, PL, 1, None): (
[
['Dark Witch EN'],
['Ice Lake EC'],
@@ -679,11 +679,11 @@ OWEdgeGroups = {
['Hype Cave WC']
]
),
(Op, DW, Hz, Wr, NP, 1): (
(Op, DW, Hz, Wr, NP, 1, None): (
[ ],
[ ]
),
(Op, DW, Vt, Wr, PL, 1): (
(Op, DW, Vt, Wr, PL, 1, None): (
[
['Dark Tree Line SC'],
['Shopping Mall SW'],
@@ -699,7 +699,7 @@ OWEdgeGroups = {
OWEdgeGroupsTerrain = {
#(IsStandard, World, EdgeAxis, Terrain, HasParallel, NumberInGroup)
(St, LW, Vt, None, PL, 1): (
(St, LW, Vt, None, PL, 1, None): (
[
['Hyrule Castle SW'],
['Hyrule Castle SE']
@@ -709,7 +709,7 @@ OWEdgeGroupsTerrain = {
['Links House NE']
]
),
(St, LW, Hz, None, PL, 3): (
(St, LW, Hz, None, PL, 3, None): (
[
['Central Bonk Rocks EN', 'Central Bonk Rocks EC', 'Central Bonk Rocks ES']
],
@@ -717,7 +717,7 @@ OWEdgeGroupsTerrain = {
['Links House WN', 'Links House WC', 'Links House WS']
]
),
(Op, LW, Hz, None, PL, 1): (
(Op, LW, Hz, None, PL, 1, None): (
[
['Lost Woods EN'],
['East Death Mountain EN'],
@@ -751,7 +751,7 @@ OWEdgeGroupsTerrain = {
['East Death Mountain WS']
]
),
(Op, LW, Hz, None, NP, 1): (
(Op, LW, Hz, None, NP, 1, None): (
[
['Forgotten Forest ES'],
['Hobo EC']
@@ -761,7 +761,7 @@ OWEdgeGroupsTerrain = {
['Stone Bridge WC']
]
),
(Op, LW, Vt, None, PL, 1): (
(Op, LW, Vt, None, PL, 1, None): (
[
['Lumberjack SW'],
['Mountain Pass SE'],
@@ -797,7 +797,7 @@ OWEdgeGroupsTerrain = {
['South Pass NC']
]
),
(Op, LW, Vt, None, NP, 1): (
(Op, LW, Vt, None, NP, 1, None): (
[
['Master Sword Meadow SC'],
['Zoras Domain SW']
@@ -807,7 +807,7 @@ OWEdgeGroupsTerrain = {
['Zora Waterfall NE']
]
),
(Op, LW, Hz, None, PL, 2): (
(Op, LW, Hz, None, PL, 2, None): (
[
['Kakariko Fortune EN', 'Kakariko Fortune ES'],
['Kakariko Pond EN', 'Kakariko Pond ES'],
@@ -825,7 +825,7 @@ OWEdgeGroupsTerrain = {
['Tree Line WN', 'Tree Line WC']
]
),
(Op, LW, Hz, None, NP, 2): (
(Op, LW, Hz, None, NP, 2, None): (
[
['Desert EC', 'Desert ES']
],
@@ -833,7 +833,7 @@ OWEdgeGroupsTerrain = {
['Desert Pass WC', 'Desert Pass WS']
]
),
(Op, LW, Vt, None, PL, 2): (
(Op, LW, Vt, None, PL, 2, None): (
[
['Lost Woods SW', 'Lost Woods SC'],
['Lost Woods Pass SW', 'Lost Woods Pass SE'],
@@ -851,7 +851,7 @@ OWEdgeGroupsTerrain = {
['Octoballoon NW', 'Octoballoon NE']
]
),
(Op, LW, Hz, None, PL, 3): (
(Op, LW, Hz, None, PL, 3, None): (
[
['River Bend EN', 'River Bend EC', 'River Bend ES'],
['C Whirlpool EN', 'C Whirlpool EC', 'C Whirlpool ES']
@@ -861,7 +861,7 @@ OWEdgeGroupsTerrain = {
['Statues WN', 'Statues WC', 'Statues WS']
]
),
(Op, LW, Vt, None, PL, 3): (
(Op, LW, Vt, None, PL, 3, None): (
[
['River Bend SW', 'River Bend SC', 'River Bend SE']
],
@@ -869,7 +869,7 @@ OWEdgeGroupsTerrain = {
['Wooden Bridge NW', 'Wooden Bridge NC', 'Wooden Bridge NE']
]
),
(Op, DW, Hz, None, PL, 1): (
(Op, DW, Hz, None, PL, 1, None): (
[
['Skull Woods EN'],
['East Dark Death Mountain EN'],
@@ -901,7 +901,7 @@ OWEdgeGroupsTerrain = {
['East Dark Death Mountain WS']
]
),
(Op, DW, Vt, None, PL, 1): (
(Op, DW, Vt, None, PL, 1, None): (
[
['Dark Lumberjack SW'],
['Bumper Cave SE'],
@@ -941,11 +941,11 @@ OWEdgeGroupsTerrain = {
['Dark South Pass NC']
]
),
(Op, DW, Hz, None, NP, 1): (
(Op, DW, Hz, None, NP, 1, None): (
[ ],
[ ]
),
(Op, DW, Hz, None, PL, 2): (
(Op, DW, Hz, None, PL, 2, None): (
[
['Dark Fortune EN', 'Dark Fortune ES'],
['Outcast Pond EN', 'Outcast Pond ES'],
@@ -963,11 +963,11 @@ OWEdgeGroupsTerrain = {
['Dark Tree Line WN', 'Dark Tree Line WC']
]
),
(Op, DW, Vt, None, NP, 1): (
(Op, DW, Vt, None, NP, 1, None): (
[ ],
[ ]
),
(Op, DW, Hz, None, NP, 2): (
(Op, DW, Hz, None, NP, 2, None): (
[
['Dig Game EC', 'Dig Game ES']
],
@@ -975,7 +975,7 @@ OWEdgeGroupsTerrain = {
['Frog WC', 'Frog WS']
]
),
(Op, DW, Vt, None, PL, 2): (
(Op, DW, Vt, None, PL, 2, None): (
[
['Skull Woods SW', 'Skull Woods SC'],
['Skull Woods Pass SW', 'Skull Woods Pass SE'],
@@ -993,7 +993,7 @@ OWEdgeGroupsTerrain = {
['Bomber Corner NW', 'Bomber Corner NE']
]
),
(Op, DW, Hz, None, PL, 3): (
(Op, DW, Hz, None, PL, 3, None): (
[
['Dark Bonk Rocks EN', 'Dark Bonk Rocks EC', 'Dark Bonk Rocks ES'],
['Qirn Jump EN', 'Qirn Jump EC', 'Qirn Jump ES'],
@@ -1005,7 +1005,7 @@ OWEdgeGroupsTerrain = {
['Hype Cave WN', 'Hype Cave WC', 'Hype Cave WS']
]
),
(Op, DW, Vt, None, PL, 3): (
(Op, DW, Vt, None, PL, 3, None): (
[
['Qirn Jump SW', 'Qirn Jump SC', 'Qirn Jump SE']
],

View File

@@ -60,7 +60,7 @@ def link_overworld(world, player):
new_groups[group] = ([],[])
for group in groups.keys():
(mode, wrld, dir, terrain, parallel, count) = group
(mode, wrld, dir, terrain, parallel, count, custom) = group
for (forward_set, back_set) in zip(groups[group][0], groups[group][1]):
anyF = any(edge in orig_swaps for edge in forward_set)
anyB = any(edge in orig_swaps for edge in back_set)
@@ -75,11 +75,11 @@ def link_overworld(world, player):
if parallel == IsParallel.Yes and not (all(edge in orig_swaps for edge in map(getParallel, forward_set)) and all(edge in orig_swaps for edge in map(getParallel, back_set))):
raise Exception('Cannot move a parallel edge without the other')
new_mode = OpenStd.Open
if tuple((OpenStd.Open, WorldType((int(wrld) + 1) % 2), dir, terrain, parallel, count)) not in new_groups.keys():
if tuple((OpenStd.Open, WorldType((int(wrld) + 1) % 2), dir, terrain, parallel, count, custom)) not in new_groups.keys():
# when Links House tile is flipped, the DW edges need to get put into existing Standard group
new_mode = OpenStd.Standard
new_groups[(new_mode, WorldType((int(wrld) + 1) % 2), dir, terrain, parallel, count)][0].append(forward_set)
new_groups[(new_mode, WorldType((int(wrld) + 1) % 2), dir, terrain, parallel, count)][1].append(back_set)
new_groups[(new_mode, WorldType((int(wrld) + 1) % 2), dir, terrain, parallel, count, custom)][0].append(forward_set)
new_groups[(new_mode, WorldType((int(wrld) + 1) % 2), dir, terrain, parallel, count, custom)][1].append(back_set)
for edge in forward_set:
swaps.remove(edge)
for edge in back_set:
@@ -119,28 +119,28 @@ def link_overworld(world, player):
del parallel_links_new['Maze Race ES']
del parallel_links_new['Kakariko Suburb WS']
for group in trimmed_groups.keys():
(std, region, axis, terrain, parallel, _) = group
(std, region, axis, terrain, parallel, _, custom) = group
if parallel == IsParallel.Yes:
(forward_edges, back_edges) = trimmed_groups[group]
if ['Maze Race ES'] in forward_edges:
forward_edges.remove(['Maze Race ES'])
trimmed_groups[(std, region, axis, terrain, IsParallel.No, 1)][0].append(['Maze Race ES'])
trimmed_groups[(std, region, axis, terrain, IsParallel.No, 1, custom)][0].append(['Maze Race ES'])
if ['Kakariko Suburb WS'] in back_edges:
back_edges.remove(['Kakariko Suburb WS'])
trimmed_groups[(std, region, axis, terrain, IsParallel.No, 1)][1].append(['Kakariko Suburb WS'])
trimmed_groups[(std, region, axis, terrain, IsParallel.No, 1, custom)][1].append(['Kakariko Suburb WS'])
trimmed_groups[group] = (forward_edges, back_edges)
else:
for group in trimmed_groups.keys():
(std, region, axis, terrain, _, _) = group
(std, region, axis, terrain, _, _, custom) = group
(forward_edges, back_edges) = trimmed_groups[group]
if ['Dig Game EC', 'Dig Game ES'] in forward_edges:
forward_edges.remove(['Dig Game EC', 'Dig Game ES'])
trimmed_groups[(std, region, axis, terrain, IsParallel.Yes, 1)][0].append(['Dig Game ES'])
trimmed_groups[(std, region, axis, terrain, IsParallel.No, 1)][0].append(['Dig Game EC'])
trimmed_groups[(std, region, axis, terrain, IsParallel.Yes, 1, custom)][0].append(['Dig Game ES'])
trimmed_groups[(std, region, axis, terrain, IsParallel.No, 1, custom)][0].append(['Dig Game EC'])
if ['Frog WC', 'Frog WS'] in back_edges:
back_edges.remove(['Frog WC', 'Frog WS'])
trimmed_groups[(std, region, axis, terrain, IsParallel.Yes, 1)][1].append(['Frog WS'])
trimmed_groups[(std, region, axis, terrain, IsParallel.No, 1)][1].append(['Frog WC'])
trimmed_groups[(std, region, axis, terrain, IsParallel.Yes, 1, custom)][1].append(['Frog WS'])
trimmed_groups[(std, region, axis, terrain, IsParallel.No, 1, custom)][1].append(['Frog WC'])
trimmed_groups[group] = (forward_edges, back_edges)
parallel_links_new = {**dict(parallel_links_new), **dict({e:p[0] for e, p in parallel_links_new.inverse.items()})}
@@ -260,7 +260,7 @@ def link_overworld(world, player):
elif limited_crossed > -1 or (world.owShuffle[player] == 'vanilla' and world.owCrossed[player] == 'unrestricted'):
crossed_candidates = list()
for group in trimmed_groups.keys():
(mode, wrld, dir, terrain, parallel, count) = group
(mode, wrld, dir, terrain, parallel, count, _) = group
if wrld == WorldType.Light and mode != OpenStd.Standard:
for (forward_set, back_set) in zip(trimmed_groups[group][0], trimmed_groups[group][1]):
if forward_set[0] in parallel_links_new:
@@ -459,7 +459,7 @@ def link_overworld(world, player):
random.shuffle(groupKeys)
for key in groupKeys:
(mode, wrld, dir, terrain, parallel, count) = key
(mode, wrld, dir, terrain, parallel, count, _) = key
(forward_edge_sets, back_edge_sets) = groups[key]
def remove_connected():
s = 0
@@ -1227,24 +1227,42 @@ def reorganize_groups(world, groups, player):
def adjust_edge_groups(world, trimmed_groups, edges_to_swap, player):
groups = defaultdict(lambda: ([],[]))
limited_crossed = False
custom_groups = dict()
if world.customizer:
custom_crossed = world.customizer.get_owcrossed()
limited_crossed = custom_crossed and (player in custom_crossed) and ('limit_crossed' in custom_crossed[player])
custom_edge_groups = world.customizer.get_owedges()
if custom_edge_groups and player in custom_edge_groups:
custom_edge_groups = custom_edge_groups[player]
if 'groups' in custom_edge_groups:
custom_groups = dict(custom_edge_groups['groups'])
for name, edges in custom_groups.items():
custom_groups[name] = [world.get_owedge(e, player).name if e[-1] == '*' else e for e in edges]
for (key, group) in trimmed_groups.items():
(mode, wrld, dir, terrain, parallel, count) = key
(mode, wrld, dir, terrain, parallel, count, custom) = key
if mode == OpenStd.Standard:
groups[key] = group
else:
if world.owCrossed[player] == 'unrestricted' and not limited_crossed:
groups[(mode, None, dir, terrain, parallel, count)][0].extend(group[0])
groups[(mode, None, dir, terrain, parallel, count)][1].extend(group[1])
groups[(mode, None, dir, terrain, parallel, count, custom)][0].extend(group[0])
groups[(mode, None, dir, terrain, parallel, count, custom)][1].extend(group[1])
else:
for i in range(2):
for edge_set in group[i]:
new_world = int(wrld)
if edge_set[0] in edges_to_swap:
new_world += 1
groups[(mode, WorldType(new_world % 2), dir, terrain, parallel, count)][i].append(edge_set)
groups[(mode, WorldType(new_world % 2), dir, terrain, parallel, count, custom)][i].append(edge_set)
for (key, group) in groups.copy().items():
(mode, wrld, dir, terrain, parallel, count, custom) = key
if mode != OpenStd.Standard:
for group_name, edges in custom_groups.items():
for i in range(0, 2):
matches = [s for s in groups[key][i] if any(e in s for e in edges)]
if len(matches) > 0:
for m in matches:
groups[key][i].remove(m)
groups[(mode, wrld, dir, terrain, parallel, count, group_name)][i].extend(matches)
return groups
def create_flute_exits(world, player):

View File

@@ -89,7 +89,7 @@ You may define an item and a list of locations that an item should not be placed
### ow-edges
This must be defined by player. Each player number should be listed with the appropriate sections and each of these players MUST have either `ow_shuffle` or `ow_crossed` enabled in the `settings` section in order for any values here to take effect. This section has one primary subsection: `two-way`.
This must be defined by player. Each player number should be listed with the appropriate sections and each of these players MUST have either `ow_shuffle` or `ow_crossed` enabled in the `settings` section in order for any values here to take effect. This section has two primary subsections: `two-way` and `groups`.
#### two-way
@@ -97,13 +97,24 @@ This must be defined by player. Each player number should be listed with the app
`Links House ES*: Stone Bridge WS*` The edge east of Links House will be vanilla, but if Links House screen gets flipped by Tile Flip, then Big Bomb Shop ES will connect to Stone Bridge.
#### groups
`groups` should be used for defining new pool divisions of overworld edge transitions. Each group must have some unique name with all the edges listed that are desired to exist in the pool. The name of a group can be anything as long as it is valid yaml syntax. These defined groups cannot break up edges that conflict with mode settings, like `Keep Similar Edges Together`. The asterisk `*` notation, described in the `ow-edges/two-way` section, can be used here.
This example puts these 2 edges in their own pool, while the rest of the edges remain in their existing pools:
```
someDescription:
- Links House ES*
- Stone Bridge WS*
```
### ow-crossed
This must be defined by player. Each player number should be listed with the appropriate sections and each of these players MUST have `ow_crossed` enabled in the `settings` section in order for any values here to take effect. This section has three primary subsections: `force_crossed`, `force_noncrossed`, and `limit_crossed`.
#### force_crossed / force_noncrossed
`force_crossed` and `force_noncrossed` should be used to define specific overworld edge transitions you wish to be cross-world connected without needing to specify an exact destination. These sections are optional but must contain a list of edge names. An asterisk `*` at the end of an edge name can be used on any parallel edge (an edge that exists in the same place in the opposite world), this will swap the defined edge with its parallel edge if the tile is flipped by Tile Flip.
`force_crossed` and `force_noncrossed` should be used to define specific overworld edge transitions you wish to be cross-world connected without needing to specify an exact destination. These sections are optional but must contain a list of edge names. The asterisk `*` notation, described in the `ow-edges/two-way` section, can be used here.
#### limit_crossed

View File

@@ -75,6 +75,17 @@ ow-edges:
Kakariko Fortune ES*: Sanctuary WN*
Central Bonk Rocks EC: Potion Shop WN
Central Bonk Rocks ES: Potion Shop WC
groups:
someDescription:
- Tree Line SC*
- Lake Hylia NC*
- Dark Tree Line SC*
- Ice Lake NC*
1234:
- Lake Hylia EC*
- Octoballoon WC*
- Ice Lake EC*
- Bomber Corner WC*
ow-crossed:
1:
force_crossed: