Some fixups to restrictive algo
This commit is contained in:
parent
2308a96884
commit
197b341940
|
@ -23,8 +23,10 @@ def fill_dungeons(world):
|
|||
all_state_base = world.get_all_state()
|
||||
|
||||
# this key is in a fixed location (for now)
|
||||
world.push_item(world.get_location('[dungeon-D3-B1] Skull Woods - South of Big Chest'), ItemFactory('Small Key (Skull Woods)'), False)
|
||||
world.get_location('[dungeon-D3-B1] Skull Woods - South of Big Chest').event = True
|
||||
mandatory_sw_key_location = random.choice(['[dungeon-D3-B1] Skull Woods - South of Big Chest'] if world.shuffle != 'vanilla' else ['[dungeon-D3-B1] Skull Woods - South of Big Chest', '[dungeon-D3-B1] Skull Woods - Push Statue Room', '[dungeon-D3-B1] Skull Woods - Compass Room'])
|
||||
|
||||
world.push_item(world.get_location(mandatory_sw_key_location), ItemFactory('Small Key (Skull Woods)'), False)
|
||||
world.get_location(mandatory_sw_key_location).event = True
|
||||
|
||||
for dungeon_regions, big_key, small_keys, dungeon_items in [TR, ES, EP, DP, ToH, AT, PoD, TT, SW, SP, IP, MM, GT]:
|
||||
# this is what we need to fill
|
||||
|
|
23
Main.py
23
Main.py
|
@ -249,10 +249,9 @@ def distribute_items_staleness(world):
|
|||
logging.getLogger('').debug('Unplaced items: %s - Unfilled Locations: %s' % ([item.name for item in itempool], [location.name for location in fill_locations]))
|
||||
|
||||
|
||||
def distribute_items_restrictive(world):
|
||||
def distribute_items_restrictive(world, gftower_trash_count=10):
|
||||
# get list of locations to fill in
|
||||
fill_locations = world.get_unfilled_locations()
|
||||
random.shuffle(fill_locations)
|
||||
|
||||
# get items to distribute
|
||||
random.shuffle(world.itempool)
|
||||
|
@ -260,17 +259,29 @@ def distribute_items_restrictive(world):
|
|||
prioitempool = [item for item in world.itempool if not item.advancement and item.priority]
|
||||
restitempool = [item for item in world.itempool if not item.advancement and not item.priority]
|
||||
|
||||
def sweep_from_pool(excluded_item):
|
||||
# fill in gtower locations with trash first
|
||||
gtower_locations = [location for location in fill_locations if 'Ganons Tower' in location.name]
|
||||
random.shuffle(gtower_locations)
|
||||
trashcnt = 0
|
||||
while gtower_locations and restitempool and trashcnt < gftower_trash_count:
|
||||
spot_to_fill = gtower_locations.pop()
|
||||
item_to_place = restitempool.pop()
|
||||
world.push_item(spot_to_fill, item_to_place, False)
|
||||
fill_locations.remove(spot_to_fill)
|
||||
trashcnt += 1
|
||||
|
||||
random.shuffle(fill_locations)
|
||||
|
||||
def sweep_from_pool():
|
||||
new_state = world.state.copy()
|
||||
for item in progitempool:
|
||||
new_state.collect(item, True)
|
||||
new_state.remove(excluded_item)
|
||||
new_state.sweep_for_events()
|
||||
return new_state
|
||||
|
||||
while progitempool and fill_locations:
|
||||
item_to_place = progitempool.pop()
|
||||
maximum_exploration_state = sweep_from_pool(item_to_place)
|
||||
maximum_exploration_state = sweep_from_pool()
|
||||
|
||||
spot_to_fill = None
|
||||
for location in fill_locations:
|
||||
|
@ -289,6 +300,8 @@ def distribute_items_restrictive(world):
|
|||
fill_locations.remove(spot_to_fill)
|
||||
spot_to_fill.event = True
|
||||
|
||||
random.shuffle(fill_locations)
|
||||
|
||||
while prioitempool and fill_locations:
|
||||
spot_to_fill = fill_locations.pop()
|
||||
item_to_place = prioitempool.pop()
|
||||
|
|
3
Rules.py
3
Rules.py
|
@ -248,7 +248,8 @@ def global_rules(world):
|
|||
set_rule(world.get_location('[dungeon-D6-B1] Misery Mire - Hub Room'), lambda state: state.has('Small Key (Misery Mire)', 1) or state.has('Big Key (Misery Mire)'))
|
||||
set_rule(world.get_location('[dungeon-D6-B1] Misery Mire - Map Room'), lambda state: state.has('Small Key (Misery Mire)', 1) or state.has('Big Key (Misery Mire)'))
|
||||
# we can place a small key in the West wing iff it also contains/blocks the Big Key, as we cannot reach and softlock with the basement key door yet
|
||||
set_rule(world.get_entrance('Misery Mire (West)'), lambda state: state.has('Small Key (Misery Mire)', 3) if state.can_reach('Misery Mire (Final Area)') else state.has('Small Key (Misery Mire)', 2))
|
||||
set_rule(world.get_entrance('Misery Mire (West)'), lambda state: state.has('Small Key (Misery Mire)', 2) if ((state.world.get_location('[dungeon-D6-B1] Misery Mire - Compass Room').item is not None and state.world.get_location('[dungeon-D6-B1] Misery Mire - Compass Room').item.name in ['Big Key (Misery Mire)']) or
|
||||
(state.world.get_location('[dungeon-D6-B1] Misery Mire - Big Key Room').item is not None and state.world.get_location('[dungeon-D6-B1] Misery Mire - Big Key Room').item.name in ['Big Key (Misery Mire)'])) else state.has('Small Key (Misery Mire)', 3))
|
||||
set_rule(world.get_location('[dungeon-D6-B1] Misery Mire - Compass Room'), lambda state: state.has_fire_source())
|
||||
set_rule(world.get_location('[dungeon-D6-B1] Misery Mire - Big Key Room'), lambda state: state.has_fire_source())
|
||||
set_rule(world.get_entrance('Misery Mire (Vitreous)'), lambda state: state.has('Cane of Somaria') and (state.has('Bow') or state.has_blunt_weapon()))
|
||||
|
|
Loading…
Reference in New Issue