-
Notifications
You must be signed in to change notification settings - Fork 729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Messenger: more optimizations #2451
Changes from 5 commits
6094198
a9c0c48
5680f6c
81eac4c
b60093f
2994a50
a559af9
af46f55
2958ef8
c66529f
a272333
2c54a1e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
|
||
from BaseClasses import CollectionState, Item, ItemClassification, Location, Region | ||
from .constants import NOTES, PHOBEKINS, PROG_ITEMS, USEFUL_ITEMS | ||
from .options import Goal | ||
from .regions import MEGA_SHARDS, REGIONS, SEALS | ||
from .shop import FIGURINES, PROG_SHOP_ITEMS, SHOP_ITEMS, USEFUL_SHOP_ITEMS | ||
|
||
|
@@ -19,8 +18,10 @@ def __init__(self, name: str, world: "MessengerWorld") -> None: | |
if self.name == "The Shop": | ||
shop_locations = {f"The Shop - {shop_loc}": world.location_name_to_id[f"The Shop - {shop_loc}"] | ||
for shop_loc in SHOP_ITEMS} | ||
shop_locations.update(**{figurine: world.location_name_to_id[figurine] for figurine in FIGURINES}) | ||
self.add_locations(shop_locations, MessengerShopLocation) | ||
elif self.name == "The Craftsman's Corner": | ||
self.add_locations({figurine: world.location_name_to_id[figurine] for figurine in FIGURINES}, | ||
MessengerLocation) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't the figurine locations need some access rules that take their price into account? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, because 90% of the time the maximum price to get to the craftsman's corner will be |
||
elif self.name == "Tower HQ": | ||
locations.append("Money Wrench") | ||
if world.options.shuffle_seals and self.name in SEALS: | ||
|
@@ -46,10 +47,6 @@ class MessengerShopLocation(MessengerLocation): | |
def cost(self) -> int: | ||
name = self.name.replace("The Shop - ", "") # TODO use `remove_prefix` when 3.8 finally gets dropped | ||
world = cast("MessengerWorld", self.parent_region.multiworld.worlds[self.player]) | ||
# short circuit figurines which all require demon's bane be purchased, but nothing else | ||
if "Figurine" in name: | ||
return world.figurine_prices[name] +\ | ||
cast(MessengerShopLocation, world.multiworld.get_location("The Shop - Demon's Bane", self.player)).cost | ||
shop_data = SHOP_ITEMS[name] | ||
if shop_data.prerequisite: | ||
prereq_cost = 0 | ||
|
@@ -65,12 +62,9 @@ def cost(self) -> int: | |
return world.shop_prices[name] + prereq_cost | ||
return world.shop_prices[name] | ||
|
||
def can_afford(self, state: CollectionState) -> bool: | ||
def access_rule(self, state: CollectionState) -> bool: | ||
world = cast("MessengerWorld", state.multiworld.worlds[self.player]) | ||
can_afford = state.has("Shards", self.player, min(self.cost, world.total_shards)) | ||
if "Figurine" in self.name: | ||
can_afford = state.has("Money Wrench", self.player) and can_afford\ | ||
and state.can_reach("Money Wrench", "Location", self.player) | ||
return can_afford | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intentional that the key "logic" is being removed and replaced by "logic_level"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. this is just for the tracker, and the newer way both reduces the slot data by a tad bit and looks cleaner imo.