diff --git a/BaseClasses.py b/BaseClasses.py index 2203245f..329f6637 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -1104,6 +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 pedestal_credit_text: str = "and the Unknown Item" sickkid_credit_text: Optional[str] = None magicshop_credit_text: Optional[str] = None @@ -1117,6 +1118,8 @@ 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("-", " ")) @@ -1136,6 +1139,10 @@ 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 95953695..3def9f91 100644 --- a/Fill.py +++ b/Fill.py @@ -82,7 +82,7 @@ def distribute_items_restrictive(world: MultiWorld, gftower_trash=False, fill_lo restitempool = [] for item in world.itempool: - if item.advancement: + if item.advancement or not item.can_exclude: progitempool.append(item) elif item.name in world.local_items[item.player]: localrestitempool[item.player].append(item) diff --git a/worlds/generic/Rules.py b/worlds/generic/Rules.py index 6167d86b..71a3b428 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: not (i.advancement or i.smallkey or i.bigkey)) + add_item_rule(location, lambda i: i.can_exclude) def set_rule(spot, rule): diff --git a/worlds/minecraft/Items.py b/worlds/minecraft/Items.py index d9ac85a2..881b8050 100644 --- a/worlds/minecraft/Items.py +++ b/worlds/minecraft/Items.py @@ -32,10 +32,10 @@ item_table = { "4 Emeralds": ItemData(45017, False), "Channeling Book": ItemData(45018, True), "Silk Touch Book": ItemData(45019, True), - "Sharpness III Book": ItemData(45020, True), + "Sharpness III Book": ItemData(45020, False), "Piercing IV Book": ItemData(45021, True), - "Looting III Book": ItemData(45022, True), - "Infinity Book": ItemData(45023, True), + "Looting III Book": ItemData(45022, False), + "Infinity Book": ItemData(45023, False), "4 Diamond Ore": ItemData(45024, False), "16 Iron Ore": ItemData(45025, False), "500 XP": ItemData(45026, False), diff --git a/worlds/minecraft/__init__.py b/worlds/minecraft/__init__.py index 9fd3052f..5e065391 100644 --- a/worlds/minecraft/__init__.py +++ b/worlds/minecraft/__init__.py @@ -96,4 +96,7 @@ class MinecraftWorld(World): def create_item(self, name: str) -> Item: item_data = item_table[name] - return MinecraftItem(name, item_data.progression, item_data.code, self.player) + 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 + return item