Skip to content

Commit

Permalink
Fix Triforce Hunts
Browse files Browse the repository at this point in the history
  • Loading branch information
Alchav committed Feb 13, 2024
1 parent be7b0be commit a519f51
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
19 changes: 15 additions & 4 deletions worlds/alttp/ItemPool.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .Dungeons import get_dungeon_item_pool_player
from .EntranceShuffle import connect_entrance
from .Items import ItemFactory, GetBeemizerItem, trap_replaceable, item_name_groups
from .Options import small_key_shuffle, compass_shuffle, big_key_shuffle, map_shuffle, LTTPBosses
from .Options import small_key_shuffle, compass_shuffle, big_key_shuffle, map_shuffle, TriforcePiecesMode
from .StateHelpers import has_triforce_pieces, has_melee_weapon
from .Regions import key_drop_data

Expand Down Expand Up @@ -682,11 +682,22 @@ def place_item(loc, item):
clock_mode = 'countdown-ohko'
additional_pieces_to_place = 0
if 'triforce_hunt' in goal:
pieces_in_core = min(extraitems, world.triforce_pieces_available[player])
additional_pieces_to_place = world.triforce_pieces_available[player] - pieces_in_core

if world.triforce_pieces_mode[player].value == TriforcePiecesMode.option_extra:
triforce_pieces = world.triforce_pieces_available[player].value + world.triforce_pieces_extra[player].value
elif world.triforce_pieces_mode[player].value == TriforcePiecesMode.option_percentage:
percentage = float(max(100, world.triforce_pieces_percentage[player].value)) / 100
triforce_pieces = int(round(world.triforce_pieces_required[player].value * percentage, 0))
else: # available
triforce_pieces = world.triforce_pieces_available[player].value

triforce_pieces = max(triforce_pieces, world.triforce_pieces_required[player].value)

pieces_in_core = min(extraitems, triforce_pieces)
additional_pieces_to_place = triforce_pieces - pieces_in_core
pool.extend(["Triforce Piece"] * pieces_in_core)
extraitems -= pieces_in_core
treasure_hunt_count = world.triforce_pieces_required[player]
treasure_hunt_count = world.triforce_pieces_required[player].value
treasure_hunt_icon = 'Triforce Piece'

for extra in diff.extras:
Expand Down
2 changes: 1 addition & 1 deletion worlds/alttp/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class TriforcePiecesRequired(Range):

class TriforcePiecesExtra(Range):
"""Set to how many extra triforces pieces are available to collect in the world."""
display_name = "Triforce Pieces Required"
display_name = "Triforce Pieces Extra"
range_start = 0
range_end = 89
default = 10
Expand Down
3 changes: 0 additions & 3 deletions worlds/alttp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,6 @@ def create_regions(self):
player = self.player
world = self.multiworld

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:
Expand Down

0 comments on commit a519f51

Please sign in to comment.