optimize set_shop_rules

This commit is contained in:
espeon65536 2021-09-09 11:45:30 -05:00 committed by Fabian Dill
parent f952ad5913
commit 4e84b20925
1 changed files with 26 additions and 25 deletions

View File

@ -92,6 +92,8 @@ def set_rules(ootworld):
# is_child = ootworld.parser.parse_rule('is_child')
guarantee_hint = ootworld.parser.parse_rule('guarantee_hint')
for location in ootworld.get_locations():
if ootworld.shuffle_song_items == 'song':
if location.type == 'Song':
@ -157,8 +159,8 @@ def set_shop_rules(ootworld):
found_bombchus = ootworld.parser.parse_rule('found_bombchus')
wallet = ootworld.parser.parse_rule('Progressive_Wallet')
wallet2 = ootworld.parser.parse_rule('(Progressive_Wallet, 2)')
for location in ootworld.world.get_filled_locations():
if location.player == ootworld.player and location.item.type == 'Shop':
for location in filter(lambda location: location.item and location.item.type == 'Shop', ootworld.get_locations()):
# Add wallet requirements
if location.item.name in ['Buy Arrows (50)', 'Buy Fish', 'Buy Goron Tunic', 'Buy Bombchu (20)', 'Buy Bombs (30)']:
add_rule(location, wallet)
@ -167,8 +169,7 @@ def set_shop_rules(ootworld):
# Add adult only checks
if location.item.name in ['Buy Goron Tunic', 'Buy Zora Tunic']:
is_adult = ootworld.parser.parse_rule('is_adult', location)
add_rule(location, is_adult)
add_rule(location, ootworld.parser.parse_rule('is_adult', location))
# Add item prerequisite checks
if location.item.name in ['Buy Blue Fire',