From 617312fd4b49f17610d100fc2a59d924c54dc2ba Mon Sep 17 00:00:00 2001 From: caitsith2 Date: Wed, 17 Jun 2020 01:02:54 -0700 Subject: [PATCH] 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 74c0090f..a4da1657 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 42ac66ad..3381962a 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 d44363de..7e9e1bd2 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 b9549fc5..57756620 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 d367eac0..32652bfb 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 55a8517c..309322f8 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