Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions World.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,11 +704,14 @@ def random_shop_prices(self) -> None:
for location in region.locations:
if location.type == 'Shop':
if location.name[-1:] in shop_item_indexes[:shop_item_count]:
self.shop_prices[location.name] = self.new_shop_price()
self.shop_prices[location.name] = self.new_shop_price(location)

def new_shop_price(self) -> int:
def new_shop_price(self, location: Location) -> int:
if self.settings.special_deal_price_distribution == 'vanilla':
return ItemInfo.items[location.vanilla_item].price
price = location.price
if price is None:
price = ItemInfo.items[location.vanilla_item].price
Comment on lines +711 to +713
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what cases would there not be a price in vanilla, but there would be a price on location?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plandomizing a price onto a shop location puts the price on location, no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Business scrubs, apparently. Caught that when testing the PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it correct that it should be done this way rather than the other way around, i.e., price = temInfo.items[location.vanilla_item].price, if price is None: price = location.price

return price
elif self.settings.special_deal_price_max < self.settings.special_deal_price_min:
raise ValueError('Maximum special deal price is lower than minimum, perhaps you meant to swap them?')
elif self.settings.special_deal_price_max == self.settings.special_deal_price_min:
Expand Down Expand Up @@ -1226,7 +1229,7 @@ def push_item(self, location: str | Location, item: Item, manual: bool = False)
# Reduce the frequency of obvious scams by rerolling the price once if it's too high, and taking the lower value.
# This affects logic so it should only be applied to refills that are logically irrelevant.
# Otherwise there could be seeds with e.g. a wallet that's hinted as logically required for a purchase even though the price was rerolled to no longer require the wallet.
price = min(location.price, self.new_shop_price())
price = min(location.price, self.new_shop_price(location))
else:
price = item.price

Expand Down
Loading