add separate can_exclude property, so non-progression items can be marked non-excluded
This commit is contained in:
parent
39a5921522
commit
0eee1f2d01
|
@ -1104,6 +1104,7 @@ class Item():
|
||||||
world: Optional[MultiWorld] = None
|
world: Optional[MultiWorld] = None
|
||||||
game: str = "Generic"
|
game: str = "Generic"
|
||||||
type: str = None
|
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"
|
pedestal_credit_text: str = "and the Unknown Item"
|
||||||
sickkid_credit_text: Optional[str] = None
|
sickkid_credit_text: Optional[str] = None
|
||||||
magicshop_credit_text: Optional[str] = None
|
magicshop_credit_text: Optional[str] = None
|
||||||
|
@ -1117,6 +1118,8 @@ class Item():
|
||||||
self.player = player
|
self.player = player
|
||||||
self.code = code
|
self.code = code
|
||||||
|
|
||||||
|
self.can_be_excluded = not advancement
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hint_text(self):
|
def hint_text(self):
|
||||||
return getattr(self, "_hint_text", self.name.replace("_", " ").replace("-", " "))
|
return getattr(self, "_hint_text", self.name.replace("_", " ").replace("-", " "))
|
||||||
|
@ -1136,6 +1139,10 @@ class Item():
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return hash((self.name, self.player))
|
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
|
@property
|
||||||
def crystal(self) -> bool:
|
def crystal(self) -> bool:
|
||||||
return self.type == 'Crystal'
|
return self.type == 'Crystal'
|
||||||
|
|
2
Fill.py
2
Fill.py
|
@ -82,7 +82,7 @@ def distribute_items_restrictive(world: MultiWorld, gftower_trash=False, fill_lo
|
||||||
restitempool = []
|
restitempool = []
|
||||||
|
|
||||||
for item in world.itempool:
|
for item in world.itempool:
|
||||||
if item.advancement:
|
if item.advancement or not item.can_exclude:
|
||||||
progitempool.append(item)
|
progitempool.append(item)
|
||||||
elif item.name in world.local_items[item.player]:
|
elif item.name in world.local_items[item.player]:
|
||||||
localrestitempool[item.player].append(item)
|
localrestitempool[item.player].append(item)
|
||||||
|
|
|
@ -12,7 +12,7 @@ def locality_rules(world, player):
|
||||||
def exclusion_rules(world, player: int, excluded_locations: set):
|
def exclusion_rules(world, player: int, excluded_locations: set):
|
||||||
for loc_name in excluded_locations:
|
for loc_name in excluded_locations:
|
||||||
location = world.get_location(loc_name, player)
|
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):
|
def set_rule(spot, rule):
|
||||||
|
|
|
@ -32,10 +32,10 @@ item_table = {
|
||||||
"4 Emeralds": ItemData(45017, False),
|
"4 Emeralds": ItemData(45017, False),
|
||||||
"Channeling Book": ItemData(45018, True),
|
"Channeling Book": ItemData(45018, True),
|
||||||
"Silk Touch Book": ItemData(45019, 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),
|
"Piercing IV Book": ItemData(45021, True),
|
||||||
"Looting III Book": ItemData(45022, True),
|
"Looting III Book": ItemData(45022, False),
|
||||||
"Infinity Book": ItemData(45023, True),
|
"Infinity Book": ItemData(45023, False),
|
||||||
"4 Diamond Ore": ItemData(45024, False),
|
"4 Diamond Ore": ItemData(45024, False),
|
||||||
"16 Iron Ore": ItemData(45025, False),
|
"16 Iron Ore": ItemData(45025, False),
|
||||||
"500 XP": ItemData(45026, False),
|
"500 XP": ItemData(45026, False),
|
||||||
|
|
|
@ -96,4 +96,7 @@ class MinecraftWorld(World):
|
||||||
|
|
||||||
def create_item(self, name: str) -> Item:
|
def create_item(self, name: str) -> Item:
|
||||||
item_data = item_table[name]
|
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
|
||||||
|
|
Loading…
Reference in New Issue