@@ -694,18 +694,23 @@ def random_shop_prices(self) -> None:
694694 for location in region .locations :
695695 if location .type == 'Shop' :
696696 if location .name [- 1 :] in shop_item_indexes [:shop_item_count ]:
697- if self .settings .shopsanity_prices == 'random' :
698- self .shop_prices [location .name ] = int (random .betavariate (1.5 , 2 ) * 60 ) * 5
699- elif self .settings .shopsanity_prices == 'random_starting' :
700- self .shop_prices [location .name ] = random .randrange (0 , 100 , 5 )
701- elif self .settings .shopsanity_prices == 'random_adult' :
702- self .shop_prices [location .name ] = random .randrange (0 , 201 , 5 )
703- elif self .settings .shopsanity_prices == 'random_giant' :
704- self .shop_prices [location .name ] = random .randrange (0 , 501 , 5 )
705- elif self .settings .shopsanity_prices == 'random_tycoon' :
706- self .shop_prices [location .name ] = random .randrange (0 , 1000 , 5 )
707- elif self .settings .shopsanity_prices == 'affordable' :
708- self .shop_prices [location .name ] = 10
697+ self .shop_prices [location .name ] = self .new_shop_price ()
698+
699+ def new_shop_price (self ) -> int :
700+ if self .settings .shopsanity_prices == 'random' :
701+ return int (random .betavariate (1.5 , 2 ) * 60 ) * 5
702+ elif self .settings .shopsanity_prices == 'random_starting' :
703+ return random .randrange (0 , 100 , 5 )
704+ elif self .settings .shopsanity_prices == 'random_adult' :
705+ return random .randrange (0 , 201 , 5 )
706+ elif self .settings .shopsanity_prices == 'random_giant' :
707+ return random .randrange (0 , 501 , 5 )
708+ elif self .settings .shopsanity_prices == 'random_tycoon' :
709+ return random .randrange (0 , 1000 , 5 )
710+ elif self .settings .shopsanity_prices == 'affordable' :
711+ return 10
712+ else :
713+ raise ValueError (f'Unimplemented shopsanity_prices option { self .settings .shopsanity_prices !r} ' )
709714
710715 def set_scrub_prices (self ) -> None :
711716 # Get Deku Scrub Locations
@@ -1205,19 +1210,7 @@ def push_item(self, location: str | Location, item: Item, manual: bool = False)
12051210 # Reduce the frequency of obvious scams by rerolling the price once if it's too high, and taking the lower value.
12061211 # This affects logic so it should only be applied to refills that are logically irrelevant.
12071212 # 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.
1208- if self .settings .shopsanity_prices == 'random' :
1209- new_price = int (random .betavariate (1.5 , 2 ) * 60 ) * 5
1210- elif self .settings .shopsanity_prices == 'random_starting' :
1211- new_price = random .randrange (0 , 100 , 5 )
1212- elif self .settings .shopsanity_prices == 'random_adult' :
1213- new_price = random .randrange (0 , 201 , 5 )
1214- elif self .settings .shopsanity_prices == 'random_giant' :
1215- new_price = random .randrange (0 , 501 , 5 )
1216- elif self .settings .shopsanity_prices == 'random_tycoon' :
1217- new_price = random .randrange (0 , 1000 , 5 )
1218- elif self .settings .shopsanity_prices == 'affordable' :
1219- new_price = 10
1220- price = min (location .price , new_price )
1213+ price = min (location .price , self .new_shop_price ())
12211214 else :
12221215 price = item .price
12231216
0 commit comments