Skip to content

LTTP: Open Pyramid and Shop Prog Balancing Bug Fixes #2890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions worlds/alttp/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ class OpenPyramid(Choice):

def to_bool(self, world: MultiWorld, player: int) -> bool:
if self.value == self.option_goal:
return world.goal[player] in {'crystals', 'ganon_triforce_hunt', 'local_ganon_triforce_hunt', 'ganon_pedestal'}
return world.goal[player].current_key in {'crystals', 'ganon_triforce_hunt', 'local_ganon_triforce_hunt', 'ganon_pedestal'}
elif self.value == self.option_auto:
return world.goal[player] in {'crystals', 'ganon_triforce_hunt', 'local_ganon_triforce_hunt', 'ganon_pedestal'} \
return world.goal[player].current_key in {'crystals', 'ganon_triforce_hunt', 'local_ganon_triforce_hunt', 'ganon_pedestal'} \
and (world.entrance_shuffle[player] in {'vanilla', 'dungeons_simple', 'dungeons_full', 'dungeons_crossed'} or not
world.shuffle_ganon)
elif self.value == self.option_open:
Expand Down
9 changes: 6 additions & 3 deletions worlds/alttp/Shops.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ def push_shop_inventories(multiworld):
get_price(multiworld, location.shop.inventory[location.shop_slot], location.player,
location.shop_price_type)[1])

for world in multiworld.get_game_worlds("A Link to the Past"):
world.pushed_shop_inventories.set()


def create_shops(multiworld, player: int):

Expand Down Expand Up @@ -451,15 +454,15 @@ def get_price(multiworld, item, player: int, price_type=None):
if multiworld.randomize_shop_prices[player]:
adjust = 2 if price < 100 else 5
price = int((price / adjust) * (0.5 + multiworld.random.random() * 1.5)) * adjust
multiworld.random.shuffle(price_types)
multiworld.per_slot_randoms[player].shuffle(price_types)
for p_type in price_types:
if any(x in item['item'] for x in price_blacklist[p_type]):
continue
return p_type, price_chart[p_type](price, diff)
else:
# This is an AP location and the price will be adjusted after an item is shuffled into it
p_type = multiworld.random.choice(price_types)
return p_type, price_chart[p_type](min(int(multiworld.random.randint(8, 56)
p_type = multiworld.per_slot_randoms[player].choice(price_types)
return p_type, price_chart[p_type](min(int(multiworld.per_slot_randoms[player].randint(8, 56)
* multiworld.shop_price_modifier[player] / 100) * 5, 9999), diff)


Expand Down
8 changes: 6 additions & 2 deletions worlds/alttp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ def __init__(self, *args, **kwargs):
self.dungeon_local_item_names = set()
self.dungeon_specific_item_names = set()
self.rom_name_available_event = threading.Event()
self.pushed_shop_inventories = threading.Event()
self.has_progressive_bows = False
self.dungeons = {}
self.waterfall_fairy_bottle_fill = "Bottle"
Expand Down Expand Up @@ -508,8 +509,8 @@ def stage_pre_fill(cls, world):
fill_dungeons_restrictive(world)

@classmethod
def stage_post_fill(cls, world):
push_shop_inventories(world)
def stage_generate_output(cls, multiworld, output_directory):
push_shop_inventories(multiworld)

@property
def use_enemizer(self) -> bool:
Expand All @@ -523,6 +524,9 @@ def use_enemizer(self) -> bool:
def generate_output(self, output_directory: str):
multiworld = self.multiworld
player = self.player

self.pushed_shop_inventories.wait()

try:
use_enemizer = self.use_enemizer

Expand Down
2 changes: 1 addition & 1 deletion worlds/alttp/test/options/TestOpenPyramid.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class GoalPyramidTest(PyramidTestBase):
}

def testCrystalsGoalAccess(self):
self.multiworld.goal[1] = "crystals"
self.multiworld.goal[1].value = 1 # crystals
self.assertFalse(self.can_reach_entrance("Pyramid Hole"))
self.collect_by_name(["Hammer", "Progressive Glove", "Moon Pearl"])
self.assertTrue(self.can_reach_entrance("Pyramid Hole"))
Expand Down