From 233d12be3027da01baf13769854b6e265728d40b Mon Sep 17 00:00:00 2001 From: caitsith2 Date: Thu, 11 Jun 2020 11:53:10 -0700 Subject: [PATCH 1/3] Change max triforce_pieces_required from 30 to 112. --- EntranceRandomizer.py | 2 +- ItemList.py | 10 +++++++++- Mystery.py | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/EntranceRandomizer.py b/EntranceRandomizer.py index a33ce70213..42ac66ad1b 100755 --- a/EntranceRandomizer.py +++ b/EntranceRandomizer.py @@ -82,7 +82,7 @@ def parse_arguments(argv, no_defaults=False): 20 of them to beat the game. ''') parser.add_argument('--triforce_pieces_required', default=defval(20), - type=lambda value: min(max(int(value), 1), 30), + type=lambda value: min(max(int(value), 1), 112), help='''Set Triforce Pieces required to win a Triforce Hunt''') parser.add_argument('--difficulty', default=defval('normal'), const='normal', nargs='?', choices=['normal', 'hard', 'expert'], diff --git a/ItemList.py b/ItemList.py index 33c6578203..d44363de9e 100644 --- a/ItemList.py +++ b/ItemList.py @@ -256,7 +256,15 @@ def generate_itempool(world, player): return item if not choice else ItemFactory("Bee Trap", player) if choice == 'trap' else ItemFactory("Bee", player) return item - world.itempool += [beemizer(item) for item in items] + progressionitems = [item for item in items if item.advancement or item.priority or item.type] + nonprogressionitems = [beemizer(item) for item in items if not item.advancement and not item.priority and not item.type] + random.shuffle(nonprogressionitems) + + if treasure_hunt_count and treasure_hunt_count > 30: + progressionitems += [ItemFactory("Triforce Piece", player)] * (treasure_hunt_count - 30) + nonprogressionitems = nonprogressionitems[(treasure_hunt_count-30):] + + world.itempool += progressionitems + nonprogressionitems # shuffle medallions mm_medallion = ['Ether', 'Quake', 'Bombos'][random.randint(0, 2)] diff --git a/Mystery.py b/Mystery.py index 85643537e2..d367eac07d 100644 --- a/Mystery.py +++ b/Mystery.py @@ -297,7 +297,7 @@ def roll_settings(weights): ret.triforce_pieces_required = get_choice('triforce_pieces_required', weights) if "triforce_pieces_required" in weights else 20 - ret.triforce_pieces_required = min(max(1, int(ret.triforce_pieces_required)), 30) + ret.triforce_pieces_required = min(max(1, int(ret.triforce_pieces_required)), 112) ret.mode = get_choice('world_state', weights) if ret.mode == 'retro': From 617312fd4b49f17610d100fc2a59d924c54dc2ba Mon Sep 17 00:00:00 2001 From: caitsith2 Date: Wed, 17 Jun 2020 01:02:54 -0700 Subject: [PATCH 2/3] add available_triforce_pieces --- BaseClasses.py | 4 ++++ EntranceRandomizer.py | 5 ++++- ItemList.py | 11 ++++++++--- Main.py | 1 + Mystery.py | 7 ++++++- easy.yaml | 11 ++++++++++- 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index 74c0090f5d..a4da16571c 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -113,6 +113,7 @@ class World(object): set_player_attr('glitch_boots', True) set_player_attr('progression_balancing', True) set_player_attr('local_items', set()) + set_player_attr('triforce_pieces_available', 30) set_player_attr('triforce_pieces_required', 20) def get_name_string_for_object(self, obj) -> str: @@ -1194,6 +1195,7 @@ class Spoiler(object): 'players': self.world.players, 'teams': self.world.teams, 'progression_balancing': self.world.progression_balancing, + 'triforce_pieces_available': self.world.triforce_pieces_available, 'triforce_pieces_required': self.world.triforce_pieces_required, } @@ -1240,6 +1242,8 @@ class Spoiler(object): outfile.write('Swords: %s\n' % self.metadata['weapons'][player]) outfile.write('Goal: %s\n' % self.metadata['goal'][player]) if "triforce" in self.metadata["goal"][player]: # triforce hunt + outfile.write( + "Pieces available for Triforce: %s\n" % self.metadata['triforce_pieces_available'][player]) outfile.write( "Pieces required for Triforce: %s\n" % self.metadata["triforce_pieces_required"][player]) outfile.write('Difficulty: %s\n' % self.metadata['item_pool'][player]) diff --git a/EntranceRandomizer.py b/EntranceRandomizer.py index 42ac66ad1b..3381962a0c 100755 --- a/EntranceRandomizer.py +++ b/EntranceRandomizer.py @@ -81,6 +81,9 @@ def parse_arguments(argv, no_defaults=False): Local Triforce Hunt: Places 30 Triforce Pieces in your world, collect 20 of them to beat the game. ''') + parser.add_argument('--triforce_pieces_available', default=defval(30), + type=lambda value: min(max(int(value), 1), 112), + help='''Set Triforce Pieces available in item pool.''') parser.add_argument('--triforce_pieces_required', default=defval(20), type=lambda value: min(max(int(value), 1), 112), help='''Set Triforce Pieces required to win a Triforce Hunt''') @@ -333,7 +336,7 @@ def parse_arguments(argv, no_defaults=False): 'local_items', 'retro', 'accessibility', 'hints', 'beemizer', 'shufflebosses', 'shuffleenemies', 'enemy_health', 'enemy_damage', 'shufflepots', 'ow_palettes', 'uw_palettes', 'sprite', 'disablemusic', 'quickswap', 'fastmenu', 'heartcolor', - 'heartbeep', "skip_progression_balancing", "triforce_pieces_required", + 'heartbeep', "skip_progression_balancing", "triforce_pieces_available", "triforce_pieces_required", 'remote_items', 'progressive', 'dungeon_counters', 'glitch_boots']: value = getattr(defaults, name) if getattr(playerargs, name) is None else getattr(playerargs, name) if player == 1: diff --git a/ItemList.py b/ItemList.py index d44363de9e..7e9e1bd24f 100644 --- a/ItemList.py +++ b/ItemList.py @@ -260,9 +260,10 @@ def generate_itempool(world, player): nonprogressionitems = [beemizer(item) for item in items if not item.advancement and not item.priority and not item.type] random.shuffle(nonprogressionitems) - if treasure_hunt_count and treasure_hunt_count > 30: - progressionitems += [ItemFactory("Triforce Piece", player)] * (treasure_hunt_count - 30) - nonprogressionitems = nonprogressionitems[(treasure_hunt_count-30):] + triforce_pieces = world.triforce_pieces_available[player] + if world.goal[player] in {'triforcehunt', 'localtriforcehunt'} and triforce_pieces > 30: + progressionitems += [ItemFactory("Triforce Piece", player)] * (triforce_pieces - 30) + nonprogressionitems = nonprogressionitems[(triforce_pieces-30):] world.itempool += progressionitems + nonprogressionitems @@ -510,6 +511,10 @@ def get_pool_core(world, player: int): extraitems -= len(diff.timedohko) clock_mode = 'countdown-ohko' if goal in {'triforcehunt', 'localtriforcehunt'}: + if world.triforce_pieces_required[player] > world.triforce_pieces_available[player]: + world.triforce_pieces_required[player] = world.triforce_pieces_available[player] + while len(diff.triforcehunt) > world.triforce_pieces_available[player]: + diff.triforcehunt.pop() pool.extend(diff.triforcehunt) extraitems -= len(diff.triforcehunt) treasure_hunt_count = world.triforce_pieces_required[player] diff --git a/Main.py b/Main.py index b9549fc55a..57756620eb 100644 --- a/Main.py +++ b/Main.py @@ -58,6 +58,7 @@ def main(args, seed=None): world.progressive = args.progressive.copy() world.dungeon_counters = args.dungeon_counters.copy() world.glitch_boots = args.glitch_boots.copy() + world.triforce_pieces_available = args.triforce_pieces_available.copy() world.triforce_pieces_required = args.triforce_pieces_required.copy() world.progression_balancing = {player: not balance for player, balance in args.skip_progression_balancing.items()} diff --git a/Mystery.py b/Mystery.py index d367eac07d..32652bfbec 100644 --- a/Mystery.py +++ b/Mystery.py @@ -295,9 +295,14 @@ def roll_settings(weights): ret.crystals_ganon = get_choice('ganon_open', weights) + ret.triforce_pieces_available = get_choice('triforce_pieces_available', + weights) if "triforce_pieces_available" in weights else 30 + + ret.triforce_pieces_available = min(max(1, int(ret.triforce_pieces_available)), 112) + ret.triforce_pieces_required = get_choice('triforce_pieces_required', weights) if "triforce_pieces_required" in weights else 20 - ret.triforce_pieces_required = min(max(1, int(ret.triforce_pieces_required)), 112) + ret.triforce_pieces_required = min(max(1, int(ret.triforce_pieces_required)), ret.triforce_pieces_available) ret.mode = get_choice('world_state', weights) if ret.mode == 'retro': diff --git a/easy.yaml b/easy.yaml index 55a8517ccf..309322f8b9 100644 --- a/easy.yaml +++ b/easy.yaml @@ -76,7 +76,16 @@ goals: pedestal: 0 # Pull the Triforce from the Master Sword pedestal triforce_hunt: 0 # Collect 20 of 30 Triforce pieces spread throughout the worlds, then turn them in to Murahadala in front of Hyrule Castle local_triforce_hunt: 0 # Collect 20 of 30 Triforce pieces spread throughout your world, then turn them in to Murahadala in front of Hyrule Castle -triforce_pieces_required: # set to how many out of 30 triforce pieces you need to win the game in a triforce hunt. 20 is the default. Max is 30, Min is 1. +triforce_pieces_available: # set to how many triforces pieces are available to collect in the world. 30 is the default. Max is 112, Min is 1. + # format "pieces: chance" + 25: 0 + 30: 1 + 31: 0 + 32: 0 + 33: 0 + 34: 0 + 35: 0 +triforce_pieces_required: # set to how many out of X triforce pieces you need to win the game in a triforce hunt. 20 is the default. Max is 112, Min is 1. # format "pieces: chance" 15: 0 20: 1 From d8bc5ca2a8f82d77cbdffb4beb2504534663e851 Mon Sep 17 00:00:00 2001 From: caitsith2 Date: Wed, 17 Jun 2020 01:33:34 -0700 Subject: [PATCH 3/3] Set triforce pieces available to max of available and required. --- ItemList.py | 2 -- Main.py | 2 ++ Mystery.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ItemList.py b/ItemList.py index 7e9e1bd24f..facb9b2f23 100644 --- a/ItemList.py +++ b/ItemList.py @@ -511,8 +511,6 @@ def get_pool_core(world, player: int): extraitems -= len(diff.timedohko) clock_mode = 'countdown-ohko' if goal in {'triforcehunt', 'localtriforcehunt'}: - if world.triforce_pieces_required[player] > world.triforce_pieces_available[player]: - world.triforce_pieces_required[player] = world.triforce_pieces_available[player] while len(diff.triforcehunt) > world.triforce_pieces_available[player]: diff.triforcehunt.pop() pool.extend(diff.triforcehunt) diff --git a/Main.py b/Main.py index 57756620eb..c548a5f93d 100644 --- a/Main.py +++ b/Main.py @@ -88,6 +88,8 @@ def main(args, seed=None): world.push_precollected(item) world.local_items[player] = {item.strip() for item in args.local_items[player].split(',')} + world.triforce_pieces_available[player] = max(world.triforce_pieces_available[player], world.triforce_pieces_required[player]) + if world.mode[player] != 'inverted': create_regions(world, player) else: diff --git a/Mystery.py b/Mystery.py index 32652bfbec..9234ab2942 100644 --- a/Mystery.py +++ b/Mystery.py @@ -302,7 +302,7 @@ def roll_settings(weights): ret.triforce_pieces_required = get_choice('triforce_pieces_required', weights) if "triforce_pieces_required" in weights else 20 - ret.triforce_pieces_required = min(max(1, int(ret.triforce_pieces_required)), ret.triforce_pieces_available) + ret.triforce_pieces_required = min(max(1, int(ret.triforce_pieces_required)), 112) ret.mode = get_choice('world_state', weights) if ret.mode == 'retro':