From 2958ef8f12a7f9ecf36e1dd9c65ea89608293717 Mon Sep 17 00:00:00 2001 From: alwaysintreble Date: Wed, 15 Nov 2023 21:36:31 -0600 Subject: [PATCH] review cleanup --- worlds/messenger/__init__.py | 2 +- worlds/messenger/rules.py | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/worlds/messenger/__init__.py b/worlds/messenger/__init__.py index 6fdf6efe4f57..f12687361b70 100644 --- a/worlds/messenger/__init__.py +++ b/worlds/messenger/__init__.py @@ -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: diff --git a/worlds/messenger/rules.py b/worlds/messenger/rules.py index 1ec432b4872f..744c9a8f9a59 100644 --- a/worlds/messenger/rules.py +++ b/worlds/messenger/rules.py @@ -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, @@ -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 = { @@ -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 @@ -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 = {