Skip to content

Commit

Permalink
review cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alwaysintreble committed Nov 16, 2023
1 parent af46f55 commit 2958ef8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion worlds/messenger/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def fill_slot_data(self) -> Dict[str, Any]:
"figures": {FIGURINES[item].internal_name: price for item, price in self.figurine_prices.items()},
"max_price": self.total_shards,
"required_seals": self.required_seals,
**self.options.as_dict("music_box", "death_link", "logic_level")
**self.options.as_dict("music_box", "death_link", "logic_level"),
}

def get_filler_item_name(self) -> str:
Expand Down
19 changes: 9 additions & 10 deletions worlds/messenger/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ def __init__(self, world: "MessengerWorld") -> None:
self.player = world.player
self.world = world

# these locations are at the top of the shop tree, and the entire shop tree needs to be purchased
maximum_price = (world.multiworld.get_location("The Shop - Demon's Bane", self.player).cost +
world.multiworld.get_location("The Shop - Focused Power Sense", self.player).cost)
self.maximum_price = min(maximum_price, world.total_shards)

self.region_rules = {
"Ninja Village": self.has_wingsuit,
"Autumn Hills": self.has_wingsuit,
Expand All @@ -35,9 +40,8 @@ def __init__(self, world: "MessengerWorld") -> None:
"Glacial Peak": self.has_vertical,
"Elemental Skylands": lambda state: state.has("Magic Firefly", self.player) and self.has_wingsuit(state),
"Music Box": lambda state: (state.has_all(set(NOTES), self.player)
or state.has("Power Seal", self.player, max(1, self.world.required_seals)))
and self.has_dart(state),
"The Craftsman's Corner": lambda state: state.has("Money Wrench", self.player) and self.can_shop(state)
or self.has_enough_seals(state)) and self.has_dart(state),
"The Craftsman's Corner": lambda state: state.has("Money Wrench", self.player) and self.can_shop(state),
}

self.location_rules = {
Expand Down Expand Up @@ -126,11 +130,7 @@ def true(self, state: CollectionState) -> bool:
return True

def can_shop(self, state: CollectionState) -> bool:
# these locations are at the top of the shop tree, and the entire shop tree needs to be purchased
price = (self.world.multiworld.get_location("The Shop - Demon's Bane", self.player).cost +
self.world.multiworld.get_location("The Shop - Focused Power Sense", self.player).cost)
can_afford = state.has("Shards", self.player, min(price, self.world.total_shards))
return can_afford
return state.has("Shards", self.player, self.maximum_price)

def set_messenger_rules(self) -> None:
multiworld = self.world.multiworld
Expand Down Expand Up @@ -220,8 +220,7 @@ def __init__(self, world: "MessengerWorld") -> None:
self.region_rules = {
"Elemental Skylands":
lambda state: state.has_any({"Windmill Shuriken", "Wingsuit", "Rope Dart", "Magic Firefly"}, self.player),
"Music Box": lambda state: state.has_all(set(NOTES), self.player)
or state.has("Power Seal", self.player, max(1, self.world.required_seals))
"Music Box": lambda state: state.has_all(set(NOTES), self.player) or self.has_enough_seals(state),
}

self.location_rules = {
Expand Down

0 comments on commit 2958ef8

Please sign in to comment.