Merge branch 'beta' into pikit
This commit is contained in:
73
ItemList.py
73
ItemList.py
@@ -325,6 +325,42 @@ def generate_itempool(world, player):
|
||||
for _ in range(0, amt):
|
||||
pool.append('Rupees (20)')
|
||||
|
||||
if world.shopsanity[player] and not skip_pool_adjustments:
|
||||
for shop in world.shops[player]:
|
||||
if shop.region.name in shop_to_location_table:
|
||||
for index, slot in enumerate(shop.inventory):
|
||||
if slot:
|
||||
item = slot['item']
|
||||
if shop.region.name == 'Capacity Upgrade' and world.difficulty[player] != 'normal':
|
||||
pool.append('Rupees (20)')
|
||||
else:
|
||||
pool.append(item)
|
||||
|
||||
if (world.customizer and world.customizer.get_item_pool_adjust()
|
||||
and player in world.customizer.get_item_pool_adjust()):
|
||||
diff = difficulties[world.difficulty[player]]
|
||||
for item_name, delta in world.customizer.get_item_pool_adjust()[player].items():
|
||||
if not isinstance(delta, int):
|
||||
continue
|
||||
if delta > 0:
|
||||
if item_name == 'Bottle (Random)':
|
||||
for _ in range(delta):
|
||||
pool.append(random.choice(diff.bottles))
|
||||
else:
|
||||
pool.extend([item_name] * delta)
|
||||
elif delta < 0:
|
||||
remove_count = abs(delta)
|
||||
if item_name == 'Bottle (Random)':
|
||||
bottle_names = set(diff.bottles)
|
||||
for _ in range(remove_count):
|
||||
bottle = next((x for x in pool if x in bottle_names), None)
|
||||
if bottle:
|
||||
pool.remove(bottle)
|
||||
else:
|
||||
for _ in range(remove_count):
|
||||
if item_name in pool:
|
||||
pool.remove(item_name)
|
||||
|
||||
if world.logic[player] == 'hybridglitches' and world.pottery[player] not in ['none', 'cave'] \
|
||||
and world.keyshuffle[player] not in ['none', 'nearby']:
|
||||
# In HMG force swamp smalls in pots to allow getting out of swamp palace
|
||||
@@ -336,6 +372,13 @@ def generate_itempool(world, player):
|
||||
world.push_precollected(ItemFactory(item, player))
|
||||
|
||||
if world.mode[player] == 'standard' and not world.state.has_blunt_weapon(player):
|
||||
if world.customizer:
|
||||
placements = world.customizer.get_placements()
|
||||
if placements:
|
||||
custom_uncle = placements.get(player, {}).get("Link's Uncle")
|
||||
if custom_uncle:
|
||||
placed_items["Link's Uncle"] = custom_uncle
|
||||
|
||||
if "Link's Uncle" not in placed_items:
|
||||
found_sword = False
|
||||
found_bow = False
|
||||
@@ -369,17 +412,6 @@ def generate_itempool(world, player):
|
||||
loc.event = True
|
||||
loc.locked = True
|
||||
|
||||
if world.shopsanity[player] and not skip_pool_adjustments:
|
||||
for shop in world.shops[player]:
|
||||
if shop.region.name in shop_to_location_table:
|
||||
for index, slot in enumerate(shop.inventory):
|
||||
if slot:
|
||||
item = slot['item']
|
||||
if shop.region.name == 'Capacity Upgrade' and world.difficulty[player] != 'normal':
|
||||
pool.append('Rupees (20)')
|
||||
else:
|
||||
pool.append(item)
|
||||
|
||||
items = ItemFactory(pool, player)
|
||||
if world.shopsanity[player]:
|
||||
for potion in ['Green Potion', 'Blue Potion', 'Red Potion', 'Bee']:
|
||||
@@ -1508,7 +1540,7 @@ def make_customizer_pool(world, player):
|
||||
elif timer == 'ohko':
|
||||
clock_mode = 'ohko'
|
||||
|
||||
if goal in ['sanctuary']:
|
||||
if world.goal[player] in ['sanctuary']:
|
||||
place_item('Sanctuary', 'Triforce')
|
||||
if world.custom_goals[player]['pedgoal'] and 'requirements' in world.custom_goals[player]['pedgoal'] and world.custom_goals[player]['pedgoal']['requirements'][0]['condition'] == 0x00:
|
||||
place_item('Master Sword Pedestal', 'Nothing')
|
||||
@@ -1644,12 +1676,15 @@ def fill_specific_items(world):
|
||||
item_to_place, event_flag = get_item_and_event_flag(item, world, player,
|
||||
dungeon_pool, prize_set, prize_pool)
|
||||
if item_to_place:
|
||||
world.push_item(loc, item_to_place, False)
|
||||
loc.locked = True
|
||||
track_outside_keys(item_to_place, loc, world)
|
||||
track_dungeon_items(item_to_place, loc, world)
|
||||
loc.event = (event_flag or item_to_place.advancement
|
||||
or item_to_place.bigkey or item_to_place.smallkey)
|
||||
if not loc.item:
|
||||
world.push_item(loc, item_to_place, False)
|
||||
loc.locked = True
|
||||
track_outside_keys(item_to_place, loc, world)
|
||||
track_dungeon_items(item_to_place, loc, world)
|
||||
loc.event = (event_flag or item_to_place.advancement
|
||||
or item_to_place.bigkey or item_to_place.smallkey)
|
||||
elif loc.item != item_to_place:
|
||||
logging.getLogger('').warning("Failed to place item %s at location %s because it already contained %s", item_to_place, loc.name, loc.item)
|
||||
else:
|
||||
raise Exception(f'Did not find "{item}" in item pool to place at "{location}"')
|
||||
advanced_placements = world.customizer.get_advanced_placements()
|
||||
@@ -1777,7 +1812,7 @@ def shuffle_event_items(world, player):
|
||||
continue
|
||||
break
|
||||
else:
|
||||
raise FillError(f'Unable to place followers: {", ".join(list(map(lambda d: d.hint_text, follower_locations)))}')
|
||||
raise FillError(f'Unable to place followers: {", ".join(list(map(lambda f: f.name, pickup_items)))}')
|
||||
|
||||
|
||||
def get_item_and_event_flag(item, world, player, dungeon_pool, prize_set, prize_pool):
|
||||
|
||||
Reference in New Issue
Block a user