Shop Generation options

(reduced from previous PR)
This commit is contained in:
pepperpow
2020-11-23 19:37:02 -06:00
parent 4370447adc
commit 4f58459742
10 changed files with 70 additions and 14 deletions

View File

@@ -379,7 +379,8 @@ def shuffle_shops(world, items, player: int):
if 'p' in option:
def price_adjust(price: int) -> int:
# it is important that a base price of 0 always returns 0 as new price!
return int(price * (0.5 + world.random.random() * 1.5))
adjust = 2 if price < 100 else 5
return int((price / adjust) * (0.5 + world.random.random() * 1.5)) * adjust
def adjust_item(item):
if item:
@@ -394,6 +395,7 @@ def shuffle_shops(world, items, player: int):
if 'i' in option:
world.random.shuffle(total_inventory)
i = 0
for shop in shops:
slots = shop.slots
@@ -464,13 +466,14 @@ def create_dynamic_shop_locations(world, player):
if item is None:
continue
if item['create_location']:
loc = Location(player, "{} Item {}".format(shop.region.name, i+1), parent=shop.region)
loc = Location(player, "{} Slot Item {}".format(shop.region.name, i+1), parent=shop.region)
shop.region.locations.append(loc)
world.dynamic_locations.append(loc)
world.clear_location_cache()
world.push_item(loc, ItemFactory(item['item'], player), False)
world.push_item(loc, ItemFactory(item['item'], player), False)
loc.event = True
loc.locked = True