From ae1af5e0389166a88b00b58c62182dbeab15d71b Mon Sep 17 00:00:00 2001 From: codemann8 Date: Mon, 26 Apr 2021 15:20:42 -0500 Subject: [PATCH] Adding new GUI/CLI option for Keep Similar Together --- BaseClasses.py | 3 +++ CLI.py | 3 ++- Mystery.py | 1 + README.md | 8 +++++++- resources/app/cli/args.json | 4 ++++ resources/app/cli/lang/en.json | 1 + resources/app/gui/lang/en.json | 2 ++ resources/app/gui/randomize/overworld/widgets.json | 4 ++++ source/classes/constants.py | 3 ++- 9 files changed, 26 insertions(+), 3 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index d4ef007f..261c5c33 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -24,6 +24,7 @@ class World(object): self.players = players self.teams = 1 self.owShuffle = owShuffle.copy() + self.owKeepSimilar = True self.shuffle = shuffle.copy() self.doorShuffle = doorShuffle.copy() self.intensity = {} @@ -2109,6 +2110,7 @@ class Spoiler(object): 'weapons': self.world.swords, 'goal': self.world.goal, 'ow_shuffle': self.world.owShuffle, + 'ow_keepsimilar': self.world.owKeepSimilar, 'shuffle': self.world.shuffle, 'door_shuffle': self.world.doorShuffle, 'intensity': self.world.intensity, @@ -2187,6 +2189,7 @@ class Spoiler(object): outfile.write('Difficulty:'.ljust(line_width) + '%s\n' % self.metadata['item_pool'][player]) outfile.write('Item Functionality:'.ljust(line_width) + '%s\n' % self.metadata['item_functionality'][player]) outfile.write('Overworld Shuffle:'.ljust(line_width) + '%s\n' % self.metadata['ow_shuffle'][player]) + outfile.write('Keep OW Edges Together:'.ljust(line_width) + '%s\n' % ('Yes' if self.metadata['ow_keepsimilar'][player] else 'No')) outfile.write('Entrance Shuffle:'.ljust(line_width) + '%s\n' % self.metadata['shuffle'][player]) outfile.write('Door Shuffle:'.ljust(line_width) + '%s\n' % self.metadata['door_shuffle'][player]) outfile.write('Intensity:'.ljust(line_width) + '%s\n' % self.metadata['intensity'][player]) diff --git a/CLI.py b/CLI.py index cc78b7b3..8084d57a 100644 --- a/CLI.py +++ b/CLI.py @@ -94,7 +94,7 @@ def parse_cli(argv, no_defaults=False): for player in range(1, multiargs.multi + 1): playerargs = parse_cli(shlex.split(getattr(ret, f"p{player}")), True) - for name in ['logic', 'mode', 'swords', 'goal', 'difficulty', 'item_functionality', 'ow_shuffle', + for name in ['logic', 'mode', 'swords', 'goal', 'difficulty', 'item_functionality', 'ow_shuffle', 'ow_keepsimilar', 'shuffle', 'door_shuffle', 'intensity', 'crystals_ganon', 'crystals_gt', 'openpyramid', 'mapshuffle', 'compassshuffle', 'keyshuffle', 'bigkeyshuffle', 'startinventory', 'triforce_pool_min', 'triforce_pool_max', 'triforce_goal_min', 'triforce_goal_max', @@ -143,6 +143,7 @@ def parse_settings(): "openpyramid": False, "shuffleganon": True, "ow_shuffle": "vanilla", + "ow_keepsimilar": True, "shuffle": "vanilla", "shufflepots": False, diff --git a/Mystery.py b/Mystery.py index d14deb07..b26e6ff9 100644 --- a/Mystery.py +++ b/Mystery.py @@ -153,6 +153,7 @@ def roll_settings(weights): overworld_shuffle = get_choice('overworld_shuffle') ret.ow_shuffle = overworld_shuffle if overworld_shuffle != 'none' else 'vanilla' + ret.ow_keepsimilar = get_choice('ow_keepsimilar') entrance_shuffle = get_choice('entrance_shuffle') ret.shuffle = entrance_shuffle if entrance_shuffle != 'none' else 'vanilla' door_shuffle = get_choice('door_shuffle') diff --git a/README.md b/README.md index 95ccca33..a1f82b8d 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Alternatively, run ```Gui.py``` for a simple graphical user interface. (WIP) Only extra settings are found here. All door and entrance randomizer settings are supported. See their [readme](https://github.com/Aerinon/ALttPDoorRandomizer/blob/master/README.md) -## Overworld Shuffle (--owShuffle) +## Overworld Shuffle (--ow_shuffle) ### Full @@ -66,3 +66,9 @@ Show the help message and exit. ``` For specifying the overworld shuffle you want as above. (default: vanilla) + +``` +--ow_keepsimilar +``` + +This keeps similar edge transitions paired together with other pairs of transitions diff --git a/resources/app/cli/args.json b/resources/app/cli/args.json index 33850438..cfdba1cb 100644 --- a/resources/app/cli/args.json +++ b/resources/app/cli/args.json @@ -116,6 +116,10 @@ "crossed" ] }, + "ow_keepsimilar": { + "action": "store_true", + "type": "bool" + }, "shuffle": { "choices": [ "vanilla", diff --git a/resources/app/cli/lang/en.json b/resources/app/cli/lang/en.json index d9340c92..ee0d50bc 100644 --- a/resources/app/cli/lang/en.json +++ b/resources/app/cli/lang/en.json @@ -203,6 +203,7 @@ " overworld screens from the same world.", "Crossed: Overworld screen transitions can lead to any other overworld screen." ], + "ow_keepsimilar": [ "This keeps similar edge transitions together. ie. the two west edges on Potion Shop will be paired with another similar pair." ], "door_shuffle": [ "Select Door Shuffling Algorithm. (default: %(default)s)", "Basic: Doors are mixed within a single dungeon.", diff --git a/resources/app/gui/lang/en.json b/resources/app/gui/lang/en.json index 9be11b70..eadfe436 100644 --- a/resources/app/gui/lang/en.json +++ b/resources/app/gui/lang/en.json @@ -114,6 +114,8 @@ "randomizer.overworld.overworldshuffle.simple": "Simple", "randomizer.overworld.overworldshuffle.full": "Full", "randomizer.overworld.overworldshuffle.crossed": "Crossed", + + "randomizer.overworld.keepsimilar": "Keep Similar Edges Together", "randomizer.entrance.openpyramid": "Pre-open Pyramid Hole", "randomizer.entrance.shuffleganon": "Include Ganon's Tower and Pyramid Hole in shuffle pool", diff --git a/resources/app/gui/randomize/overworld/widgets.json b/resources/app/gui/randomize/overworld/widgets.json index a40b65cd..5aa2d7cc 100644 --- a/resources/app/gui/randomize/overworld/widgets.json +++ b/resources/app/gui/randomize/overworld/widgets.json @@ -7,6 +7,10 @@ "vanilla", "full" ] + }, + "keepsimilar": { + "type": "checkbox", + "default": true } } } \ No newline at end of file diff --git a/source/classes/constants.py b/source/classes/constants.py index 5e614db0..68df9519 100644 --- a/source/classes/constants.py +++ b/source/classes/constants.py @@ -71,7 +71,8 @@ SETTINGSTOPROCESS = { "sortingalgo": "algorithm" }, "overworld": { - "overworldshuffle": "ow_shuffle" + "overworldshuffle": "ow_shuffle", + "keepsimilar": "ow_keepsimilar" }, "entrance": { "openpyramid": "openpyramid",