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 9291261f..80b2906c 100755 --- a/EntranceRandomizer.py +++ b/EntranceRandomizer.py @@ -81,8 +81,11 @@ 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), 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'], @@ -328,7 +331,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 33c65782..facb9b2f 100644 --- a/ItemList.py +++ b/ItemList.py @@ -256,7 +256,16 @@ 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) + + 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 # shuffle medallions mm_medallion = ['Ether', 'Quake', 'Bombos'][random.randint(0, 2)] @@ -502,6 +511,8 @@ def get_pool_core(world, player: int): extraitems -= len(diff.timedohko) clock_mode = 'countdown-ohko' if goal in {'triforcehunt', 'localtriforcehunt'}: + 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 72600f88..86a3e617 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()} @@ -87,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 85643537..9234ab29 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)), 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': diff --git a/easy.yaml b/easy.yaml index a8a306fc..acb89a1f 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