update exclusion procedure for clarity

This commit is contained in:
espeon65536 2021-07-23 08:55:44 -05:00 committed by Fabian Dill
parent 12eba33dbf
commit 64c80c32f0
4 changed files with 5 additions and 11 deletions

View File

@ -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'

View File

@ -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}

View File

@ -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):

View File

@ -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