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

This commit is contained in:
Alchav 2024-03-03 19:52:03 -05:00 committed by GitHub
parent 37a871eab1
commit a70b94fd62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 8 deletions

View File

@ -153,9 +153,9 @@ class OpenPyramid(Choice):
def to_bool(self, world: MultiWorld, player: int) -> bool: def to_bool(self, world: MultiWorld, player: int) -> bool:
if self.value == self.option_goal: 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: 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 and (world.entrance_shuffle[player] in {'vanilla', 'dungeons_simple', 'dungeons_full', 'dungeons_crossed'} or not
world.shuffle_ganon) world.shuffle_ganon)
elif self.value == self.option_open: elif self.value == self.option_open:

View File

@ -176,6 +176,9 @@ def push_shop_inventories(multiworld):
get_price(multiworld, location.shop.inventory[location.shop_slot], location.player, get_price(multiworld, location.shop.inventory[location.shop_slot], location.player,
location.shop_price_type)[1]) 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): def create_shops(multiworld, player: int):
@ -451,15 +454,15 @@ def get_price(multiworld, item, player: int, price_type=None):
if multiworld.randomize_shop_prices[player]: if multiworld.randomize_shop_prices[player]:
adjust = 2 if price < 100 else 5 adjust = 2 if price < 100 else 5
price = int((price / adjust) * (0.5 + multiworld.random.random() * 1.5)) * adjust 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: for p_type in price_types:
if any(x in item['item'] for x in price_blacklist[p_type]): if any(x in item['item'] for x in price_blacklist[p_type]):
continue continue
return p_type, price_chart[p_type](price, diff) return p_type, price_chart[p_type](price, diff)
else: else:
# This is an AP location and the price will be adjusted after an item is shuffled into it # 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) p_type = multiworld.per_slot_randoms[player].choice(price_types)
return p_type, price_chart[p_type](min(int(multiworld.random.randint(8, 56) 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) * multiworld.shop_price_modifier[player] / 100) * 5, 9999), diff)

View File

@ -256,6 +256,7 @@ class ALTTPWorld(World):
self.dungeon_local_item_names = set() self.dungeon_local_item_names = set()
self.dungeon_specific_item_names = set() self.dungeon_specific_item_names = set()
self.rom_name_available_event = threading.Event() self.rom_name_available_event = threading.Event()
self.pushed_shop_inventories = threading.Event()
self.has_progressive_bows = False self.has_progressive_bows = False
self.dungeons = {} self.dungeons = {}
self.waterfall_fairy_bottle_fill = "Bottle" self.waterfall_fairy_bottle_fill = "Bottle"
@ -508,8 +509,8 @@ class ALTTPWorld(World):
fill_dungeons_restrictive(world) fill_dungeons_restrictive(world)
@classmethod @classmethod
def stage_post_fill(cls, world): def stage_generate_output(cls, multiworld, output_directory):
push_shop_inventories(world) push_shop_inventories(multiworld)
@property @property
def use_enemizer(self) -> bool: def use_enemizer(self) -> bool:
@ -523,6 +524,9 @@ class ALTTPWorld(World):
def generate_output(self, output_directory: str): def generate_output(self, output_directory: str):
multiworld = self.multiworld multiworld = self.multiworld
player = self.player player = self.player
self.pushed_shop_inventories.wait()
try: try:
use_enemizer = self.use_enemizer use_enemizer = self.use_enemizer

View File

@ -23,7 +23,7 @@ class GoalPyramidTest(PyramidTestBase):
} }
def testCrystalsGoalAccess(self): def testCrystalsGoalAccess(self):
self.multiworld.goal[1] = "crystals" self.multiworld.goal[1].value = 1 # crystals
self.assertFalse(self.can_reach_entrance("Pyramid Hole")) self.assertFalse(self.can_reach_entrance("Pyramid Hole"))
self.collect_by_name(["Hammer", "Progressive Glove", "Moon Pearl"]) self.collect_by_name(["Hammer", "Progressive Glove", "Moon Pearl"])
self.assertTrue(self.can_reach_entrance("Pyramid Hole")) self.assertTrue(self.can_reach_entrance("Pyramid Hole"))