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):
|
def fill_dungeons_restrictive(world, shuffled_locations):
|
||||||
|
|
||||||
# with shuffled dungeon items they are distributed as part of the normal item pool
|
# with shuffled dungeon items they are distributed as part of the normal item pool
|
||||||
for item in world.get_items():
|
for item in world.get_items():
|
||||||
if ((item.prize and world.prizeshuffle[item.player] != 'none')
|
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)
|
(bigs if i.bigkey else smalls if i.smallkey else prizes if i.prize else others).append(i)
|
||||||
unplaced_smalls = list(smalls)
|
unplaced_smalls = list(smalls)
|
||||||
for i in world.itempool:
|
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)
|
unplaced_smalls.append(i)
|
||||||
|
|
||||||
def fill(base_state, items, locations, key_pool=None):
|
def fill(base_state, items, locations, key_pool=None):
|
||||||
fill_restrictive(world, base_state, locations, items, key_pool, True)
|
fill_restrictive(world, base_state, locations, items, key_pool, True)
|
||||||
|
|
||||||
all_state_base = world.get_all_state()
|
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()
|
big_state_base = all_state_base.copy()
|
||||||
for x in smalls + prizes + others:
|
for x in smalls + prizes + others:
|
||||||
big_state_base.collect(x, True)
|
big_state_base.collect(x, True)
|
||||||
|
|||||||
16
ItemList.py
16
ItemList.py
@@ -272,7 +272,8 @@ def generate_itempool(world, player):
|
|||||||
for _ in range(0, amt):
|
for _ in range(0, amt):
|
||||||
pool.append('Rupees (20)')
|
pool.append('Rupees (20)')
|
||||||
|
|
||||||
if world.logic[player] == 'hybridglitches' and world.pottery[player] not in ['none', 'cave']:
|
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
|
# In HMG force swamp smalls in pots to allow getting out of swamp palace
|
||||||
placed_items['Swamp Palace - Trench 1 Pot Key'] = 'Small Key (Swamp Palace)'
|
placed_items['Swamp Palace - Trench 1 Pot Key'] = 'Small Key (Swamp Palace)'
|
||||||
placed_items['Swamp Palace - Pot Row Pot Key'] = 'Small Key (Swamp Palace)'
|
placed_items['Swamp Palace - Pot Row Pot Key'] = 'Small Key (Swamp Palace)'
|
||||||
@@ -365,19 +366,6 @@ def generate_itempool(world, player):
|
|||||||
for wix in reversed(to_remove):
|
for wix in reversed(to_remove):
|
||||||
del world.itempool[wix]
|
del world.itempool[wix]
|
||||||
|
|
||||||
if world.logic[player] == 'hybridglitches' and world.pottery[player] not in ['none', 'cave']:
|
|
||||||
# In HMG force swamp smalls in pots to allow getting out of swamp palace
|
|
||||||
loc = world.get_location('Swamp Palace - Trench 1 Pot Key', player)
|
|
||||||
world.push_item(loc, ItemFactory('Small Key (Swamp Palace)', player), False)
|
|
||||||
loc.event = True
|
|
||||||
loc.locked = True
|
|
||||||
loc = world.get_location('Swamp Palace - Pot Row Pot Key', player)
|
|
||||||
world.push_item(loc, ItemFactory('Small Key (Swamp Palace)', player), False)
|
|
||||||
loc.event = True
|
|
||||||
loc.locked = True
|
|
||||||
world.itempool.remove(ItemFactory('Small Key (Swamp Palace)', player))
|
|
||||||
world.itempool.remove(ItemFactory('Small Key (Swamp Palace)', player))
|
|
||||||
|
|
||||||
# logic has some branches where having 4 hearts is one possible requirement (of several alternatives)
|
# 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)
|
# rather than making all hearts/heart pieces progression items (which slows down generation considerably)
|
||||||
# We mark one random heart container as an advancement item (or 4 heart pieces in expert mode)
|
# We mark one random heart container as an advancement item (or 4 heart pieces in expert mode)
|
||||||
|
|||||||
Reference in New Issue
Block a user