From 0aea1e780f48c400f6299ee3d89db8f42aa9e7f9 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Fri, 14 Oct 2022 03:56:03 +0200 Subject: [PATCH] Fill: create minimal excluded location rule only once --- Fill.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Fill.py b/Fill.py index 4b095eb1..0bbbf014 100644 --- a/Fill.py +++ b/Fill.py @@ -233,9 +233,12 @@ def accessibility_corrections(world: MultiWorld, state: CollectionState, locatio def inaccessible_location_rules(world: MultiWorld, state: CollectionState, locations): maximum_exploration_state = sweep_from_pool(state, []) unreachable_locations = [location for location in locations if not location.can_reach(maximum_exploration_state)] - for location in unreachable_locations: - add_item_rule(location, lambda item: not ((item.classification & 0b0011) and - world.accessibility[item.player] != 'minimal')) + if unreachable_locations: + def forbid_important_item_rule(item: Item): + return not (item.classification & 0b0011) and world.accessibility[item.player] != 'minimal' + + for location in unreachable_locations: + add_item_rule(location, forbid_important_item_rule) def distribute_items_restrictive(world: MultiWorld) -> None: