last ditch swap fixes
This commit is contained in:
11
Fill.py
11
Fill.py
@@ -273,8 +273,11 @@ def last_ditch_placement(item_to_place, locations, world, state, base_state, ite
|
|||||||
return 3
|
return 3
|
||||||
return 4
|
return 4
|
||||||
|
|
||||||
possible_swaps = [x for x in state.locations_checked
|
if item_to_place.type == 'Crystal':
|
||||||
if x.item.type not in ['Event', 'Crystal']]
|
possible_swaps = [x for x in state.locations_checked if x.item.type == 'Crystal']
|
||||||
|
else:
|
||||||
|
possible_swaps = [x for x in state.locations_checked
|
||||||
|
if x.item.type not in ['Event', 'Crystal'] and not x.forced_item]
|
||||||
swap_locations = sorted(possible_swaps, key=location_preference)
|
swap_locations = sorted(possible_swaps, key=location_preference)
|
||||||
|
|
||||||
for location in swap_locations:
|
for location in swap_locations:
|
||||||
@@ -283,6 +286,7 @@ def last_ditch_placement(item_to_place, locations, world, state, base_state, ite
|
|||||||
new_spot = find_spot_for_item(item_to_place, [location], world, base_state, new_pool,
|
new_spot = find_spot_for_item(item_to_place, [location], world, base_state, new_pool,
|
||||||
keys_in_itempool, single_player_placement)
|
keys_in_itempool, single_player_placement)
|
||||||
if new_spot:
|
if new_spot:
|
||||||
|
restore_item = new_spot.item
|
||||||
new_spot.item = item_to_place
|
new_spot.item = item_to_place
|
||||||
swap_spot = find_spot_for_item(old_item, locations, world, base_state, itempool,
|
swap_spot = find_spot_for_item(old_item, locations, world, base_state, itempool,
|
||||||
keys_in_itempool, single_player_placement)
|
keys_in_itempool, single_player_placement)
|
||||||
@@ -292,6 +296,9 @@ def last_ditch_placement(item_to_place, locations, world, state, base_state, ite
|
|||||||
locations.remove(swap_spot)
|
locations.remove(swap_spot)
|
||||||
locations.append(new_spot)
|
locations.append(new_spot)
|
||||||
return new_spot
|
return new_spot
|
||||||
|
else:
|
||||||
|
new_spot.item = restore_item
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user