Fixed issue with 2 extra SP keys in pool for HMG
This commit is contained in:
36
Fill.py
36
Fill.py
@@ -44,7 +44,6 @@ def dungeon_tracking(world):
|
||||
|
||||
|
||||
def fill_dungeons_restrictive(world, shuffled_locations):
|
||||
|
||||
# with shuffled dungeon items they are distributed as part of the normal item pool
|
||||
for item in world.get_items():
|
||||
if ((item.prize and world.prizeshuffle[item.player] != 'none')
|
||||
@@ -60,13 +59,46 @@ def fill_dungeons_restrictive(world, shuffled_locations):
|
||||
(bigs if i.bigkey else smalls if i.smallkey else prizes if i.prize else others).append(i)
|
||||
unplaced_smalls = list(smalls)
|
||||
for i in world.itempool:
|
||||
if i.smallkey and world.keyshuffle[i.player] != 'none':
|
||||
if i.smallkey and world.keyshuffle[i.player] not in ['none', 'nearby']:
|
||||
unplaced_smalls.append(i)
|
||||
|
||||
def fill(base_state, items, locations, key_pool=None):
|
||||
fill_restrictive(world, base_state, 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 + prizes + others:
|
||||
big_state_base.collect(x, True)
|
||||
|
||||
Reference in New Issue
Block a user