From 6268a7e5038f78c9b554ef8c3a5aa75450b21dd8 Mon Sep 17 00:00:00 2001 From: Kris Davie Date: Wed, 8 Jan 2025 19:18:40 +0100 Subject: [PATCH] Fixed issue with 2 extra SP keys in pool for HMG (codemann) --- Fill.py | 31 +++++++++++++++++++++++++++++++ ItemList.py | 10 ---------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/Fill.py b/Fill.py index feacb10b..83f921f4 100644 --- a/Fill.py +++ b/Fill.py @@ -57,6 +57,37 @@ def fill_dungeons_restrictive(world, shuffled_locations): fill_restrictive(world, base_state, shuffled_locations, items, key_pool, True) all_state_base = world.get_all_state() + for player in range(1, world.players + 1): + if world.logic[player] == 'hybridglitches' and world.keyshuffle[i.player] in ['none', 'nearby'] \ + and world.pottery[player] not in ['none', 'cave']: + # remove 2 keys from main pool + count_to_remove = 2 + to_remove = [] + for wix, wi in enumerate(smalls): + if wi.name == 'Small Key (Swamp Palace)' and wi.player == player: + to_remove.append(wix) + if count_to_remove == len(to_remove): + break + for wix in reversed(to_remove): + del smalls[wix] + # remove 2 swamp locations from pool + hybrid_locations = [] + to_remove = [] + for i, loc in enumerate(shuffled_locations): + if loc.name in ['Swamp Palace - Trench 1 Pot Key', 'Swamp Palace - Pot Row Pot Key'] and loc.player == player: + to_remove.append(i) + hybrid_locations.append(loc) + if count_to_remove == len(to_remove): + break + for i in reversed(to_remove): + shuffled_locations.pop(i) + # place 2 HMG keys + hybrid_state_base = all_state_base.copy() + for x in bigs + smalls + prizes + others: + hybrid_state_base.collect(x, True) + hybrid_smalls = [ItemFactory('Small Key (Swamp Palace)', player)] * 2 + fill(hybrid_state_base, hybrid_smalls, hybrid_locations, unplaced_smalls) + big_state_base = all_state_base.copy() for x in smalls + others: big_state_base.collect(x, True) diff --git a/ItemList.py b/ItemList.py index 56b394b1..add69174 100644 --- a/ItemList.py +++ b/ItemList.py @@ -368,16 +368,6 @@ def generate_itempool(world, player): or (item.map and world.mapshuffle[player]) or (item.compass and world.compassshuffle[player]))]) - if world.logic[player] == 'hybridglitches' and world.pottery[player] not in ['none', 'cave']: - keys_to_remove = 2 - to_remove = [] - for wix, wi in enumerate(world.itempool): - if wi.name == 'Small Key (Swamp Palace)' and wi.player == player: - to_remove.append(wix) - if keys_to_remove == len(to_remove): - break - for wix in reversed(to_remove): - del world.itempool[wix] # logic has some branches where having 4 hearts is one possible requirement (of several alternatives) # rather than making all hearts/heart pieces progression items (which slows down generation considerably)