Core: cleanup BaseClasses.Location
This is just cleanup and has virtually no performance impact.
This commit is contained in:
parent
04eef669f9
commit
181cc47079
|
@ -1064,26 +1064,25 @@ class LocationProgressType(IntEnum):
|
|||
|
||||
|
||||
class Location:
|
||||
# If given as integer, then this is the shop's inventory index
|
||||
shop_slot: Optional[int] = None
|
||||
shop_slot_disabled: bool = False
|
||||
game: str = "Generic"
|
||||
player: int
|
||||
name: str
|
||||
address: Optional[int]
|
||||
parent_region: Optional[Region]
|
||||
event: bool = False
|
||||
locked: bool = False
|
||||
game: str = "Generic"
|
||||
show_in_spoiler: bool = True
|
||||
crystal: bool = False
|
||||
progress_type: LocationProgressType = LocationProgressType.DEFAULT
|
||||
always_allow = staticmethod(lambda item, state: False)
|
||||
access_rule = staticmethod(lambda state: True)
|
||||
item_rule = staticmethod(lambda item: True)
|
||||
item: Optional[Item] = None
|
||||
parent_region: Optional[Region]
|
||||
|
||||
def __init__(self, player: int, name: str = '', address: int = None, parent=None):
|
||||
self.name: str = name
|
||||
self.address: Optional[int] = address
|
||||
def __init__(self, player: int, name: str = '', address: Optional[int] = None, parent: Optional[Region] = None):
|
||||
self.player = player
|
||||
self.name = name
|
||||
self.address = address
|
||||
self.parent_region = parent
|
||||
self.player: int = player
|
||||
|
||||
def can_fill(self, state: CollectionState, item: Item, check_access=True) -> bool:
|
||||
return self.always_allow(state, item) or (self.item_rule(item) and (not check_access or self.can_reach(state)))
|
||||
|
|
|
@ -207,10 +207,10 @@ def ShopSlotFill(world):
|
|||
shops_per_sphere.append(current_shops_slots)
|
||||
candidates_per_sphere.append(current_candidates)
|
||||
for location in sphere:
|
||||
if location.shop_slot is not None:
|
||||
if isinstance(location, ALttPLocation) and location.shop_slot is not None:
|
||||
if not location.shop_slot_disabled:
|
||||
current_shops_slots.append(location)
|
||||
elif not location.locked and not location.item.name in blacklist_words:
|
||||
elif not location.locked and location.item.name not in blacklist_words:
|
||||
current_candidates.append(location)
|
||||
if cumu_weights:
|
||||
x = cumu_weights[-1]
|
||||
|
|
|
@ -6,14 +6,19 @@ from BaseClasses import Location, Item, ItemClassification
|
|||
|
||||
class ALttPLocation(Location):
|
||||
game: str = "A Link to the Past"
|
||||
crystal: bool
|
||||
player_address: Optional[int]
|
||||
_hint_text: Optional[str]
|
||||
shop_slot: Optional[int] = None
|
||||
"""If given as integer, shop_slot is the shop's inventory index."""
|
||||
shop_slot_disabled: bool = False
|
||||
|
||||
def __init__(self, player: int, name: str = '', address=None, crystal: bool = False,
|
||||
hint_text: Optional[str] = None, parent=None,
|
||||
player_address=None):
|
||||
def __init__(self, player: int, name: str, address: Optional[int] = None, crystal: bool = False,
|
||||
hint_text: Optional[str] = None, parent=None, player_address: Optional[int] = None):
|
||||
super(ALttPLocation, self).__init__(player, name, address, parent)
|
||||
self.crystal = crystal
|
||||
self.player_address = player_address
|
||||
self._hint_text: str = hint_text
|
||||
self._hint_text = hint_text
|
||||
|
||||
|
||||
class ALttPItem(Item):
|
||||
|
|
Loading…
Reference in New Issue