optimize set_shop_rules
This commit is contained in:
parent
f952ad5913
commit
4e84b20925
|
@ -92,6 +92,8 @@ def set_rules(ootworld):
|
||||||
# is_child = ootworld.parser.parse_rule('is_child')
|
# is_child = ootworld.parser.parse_rule('is_child')
|
||||||
guarantee_hint = ootworld.parser.parse_rule('guarantee_hint')
|
guarantee_hint = ootworld.parser.parse_rule('guarantee_hint')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for location in ootworld.get_locations():
|
for location in ootworld.get_locations():
|
||||||
if ootworld.shuffle_song_items == 'song':
|
if ootworld.shuffle_song_items == 'song':
|
||||||
if location.type == 'Song':
|
if location.type == 'Song':
|
||||||
|
@ -157,33 +159,32 @@ def set_shop_rules(ootworld):
|
||||||
found_bombchus = ootworld.parser.parse_rule('found_bombchus')
|
found_bombchus = ootworld.parser.parse_rule('found_bombchus')
|
||||||
wallet = ootworld.parser.parse_rule('Progressive_Wallet')
|
wallet = ootworld.parser.parse_rule('Progressive_Wallet')
|
||||||
wallet2 = ootworld.parser.parse_rule('(Progressive_Wallet, 2)')
|
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':
|
|
||||||
# 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)
|
|
||||||
elif location.item.name in ['Buy Zora Tunic', 'Buy Blue Fire']:
|
|
||||||
add_rule(location, wallet2)
|
|
||||||
|
|
||||||
# Add adult only checks
|
for location in filter(lambda location: location.item and location.item.type == 'Shop', ootworld.get_locations()):
|
||||||
if location.item.name in ['Buy Goron Tunic', 'Buy Zora Tunic']:
|
# Add wallet requirements
|
||||||
is_adult = ootworld.parser.parse_rule('is_adult', location)
|
if location.item.name in ['Buy Arrows (50)', 'Buy Fish', 'Buy Goron Tunic', 'Buy Bombchu (20)', 'Buy Bombs (30)']:
|
||||||
add_rule(location, is_adult)
|
add_rule(location, wallet)
|
||||||
|
elif location.item.name in ['Buy Zora Tunic', 'Buy Blue Fire']:
|
||||||
|
add_rule(location, wallet2)
|
||||||
|
|
||||||
# Add item prerequisite checks
|
# Add adult only checks
|
||||||
if location.item.name in ['Buy Blue Fire',
|
if location.item.name in ['Buy Goron Tunic', 'Buy Zora Tunic']:
|
||||||
'Buy Blue Potion',
|
add_rule(location, ootworld.parser.parse_rule('is_adult', location))
|
||||||
'Buy Bottle Bug',
|
|
||||||
'Buy Fish',
|
# Add item prerequisite checks
|
||||||
'Buy Green Potion',
|
if location.item.name in ['Buy Blue Fire',
|
||||||
'Buy Poe',
|
'Buy Blue Potion',
|
||||||
'Buy Red Potion [30]',
|
'Buy Bottle Bug',
|
||||||
'Buy Red Potion [40]',
|
'Buy Fish',
|
||||||
'Buy Red Potion [50]',
|
'Buy Green Potion',
|
||||||
'Buy Fairy\'s Spirit']:
|
'Buy Poe',
|
||||||
add_rule(location, lambda state: CollectionState._oot_has_bottle(state, ootworld.player))
|
'Buy Red Potion [30]',
|
||||||
if location.item.name in ['Buy Bombchu (10)', 'Buy Bombchu (20)', 'Buy Bombchu (5)']:
|
'Buy Red Potion [40]',
|
||||||
add_rule(location, found_bombchus)
|
'Buy Red Potion [50]',
|
||||||
|
'Buy Fairy\'s Spirit']:
|
||||||
|
add_rule(location, lambda state: CollectionState._oot_has_bottle(state, ootworld.player))
|
||||||
|
if location.item.name in ['Buy Bombchu (10)', 'Buy Bombchu (20)', 'Buy Bombchu (5)']:
|
||||||
|
add_rule(location, found_bombchus)
|
||||||
|
|
||||||
|
|
||||||
# This function should be ran once after setting up entrances and before placing items
|
# This function should be ran once after setting up entrances and before placing items
|
||||||
|
|
Loading…
Reference in New Issue