From 64c80c32f012aeb036330cfaace2760866397ed9 Mon Sep 17 00:00:00 2001 From: espeon65536 Date: Fri, 23 Jul 2021 08:55:44 -0500 Subject: [PATCH] update exclusion procedure for clarity --- BaseClasses.py | 8 +------- Fill.py | 4 ++-- worlds/generic/Rules.py | 2 +- worlds/minecraft/__init__.py | 2 +- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index 329f6637..c96df3f4 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -1104,7 +1104,7 @@ class Item(): world: Optional[MultiWorld] = None game: str = "Generic" type: str = None - can_be_excluded: bool = True # change manually if you want some non-advancement item to not be excluded + never_exclude = False # change manually to ensure that a specific nonprogression item never goes on an excluded location pedestal_credit_text: str = "and the Unknown Item" sickkid_credit_text: Optional[str] = None magicshop_credit_text: Optional[str] = None @@ -1118,8 +1118,6 @@ class Item(): self.player = player self.code = code - self.can_be_excluded = not advancement - @property def hint_text(self): return getattr(self, "_hint_text", self.name.replace("_", " ").replace("-", " ")) @@ -1139,10 +1137,6 @@ class Item(): def __hash__(self): return hash((self.name, self.player)) - @property - def can_exclude(self) -> bool: - return not (self.advancement or self.smallkey or self.bigkey) and self.can_be_excluded - @property def crystal(self) -> bool: return self.type == 'Crystal' diff --git a/Fill.py b/Fill.py index 9044733d..c78d319f 100644 --- a/Fill.py +++ b/Fill.py @@ -85,7 +85,7 @@ def distribute_items_restrictive(world: MultiWorld, gftower_trash=False, fill_lo for item in world.itempool: if item.advancement: progitempool.append(item) - elif not item.can_exclude: # must place items that can't go into excluded locations with some logic + elif item.never_exclude: # this only gets nonprogression items which should not appear in excluded locations nonexcludeditempool.append(item) elif item.name in world.local_items[item.player]: localrestitempool[item.player].append(item) @@ -142,7 +142,7 @@ def distribute_items_restrictive(world: MultiWorld, gftower_trash=False, fill_lo if nonexcludeditempool: world.random.shuffle(fill_locations) - fill_restrictive(world, world.state, fill_locations, nonexcludeditempool) + fill_restrictive(world, world.state, fill_locations, nonexcludeditempool) # needs logical fill to not conflict with local items if any(localrestitempool.values()): # we need to make sure some fills are limited to certain worlds local_locations = {player: [] for player in world.player_ids} diff --git a/worlds/generic/Rules.py b/worlds/generic/Rules.py index 71a3b428..bce1eeab 100644 --- a/worlds/generic/Rules.py +++ b/worlds/generic/Rules.py @@ -12,7 +12,7 @@ def locality_rules(world, player): def exclusion_rules(world, player: int, excluded_locations: set): for loc_name in excluded_locations: location = world.get_location(loc_name, player) - add_item_rule(location, lambda i: i.can_exclude) + add_item_rule(location, lambda i: not (i.advancement or i.smallkey or i.bigkey or i.never_exclude)) def set_rule(spot, rule): diff --git a/worlds/minecraft/__init__.py b/worlds/minecraft/__init__.py index 5e065391..30804b77 100644 --- a/worlds/minecraft/__init__.py +++ b/worlds/minecraft/__init__.py @@ -98,5 +98,5 @@ class MinecraftWorld(World): item_data = item_table[name] item = MinecraftItem(name, item_data.progression, item_data.code, self.player) if "Book" in name: # prevent enchanted books from being excluded - item.can_be_excluded = False + item.never_exclude = True return item