From 0883a212ae3c26a86efbfe06f4b2ae95869aa225 Mon Sep 17 00:00:00 2001 From: Ziktofel Date: Sun, 9 Jun 2024 23:05:43 +0200 Subject: [PATCH] Some bugfixes to the item filtering --- worlds/sc2/items.py | 3 +++ worlds/sc2/pool_filter.py | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/worlds/sc2/items.py b/worlds/sc2/items.py index 77968fa53c6c..2541f91b45e9 100644 --- a/worlds/sc2/items.py +++ b/worlds/sc2/items.py @@ -1795,6 +1795,9 @@ def get_basic_units(world: 'SC2World', race: SC2Race) -> typing.Set[str]: item_names.MICRO_FILTERING, item_names.AUTOMATED_REFINERY, item_names.COMMAND_CENTER_COMMAND_CENTER_REACTOR, + item_names.COMMAND_CENTER_SCANNER_SWEEP, + item_names.COMMAND_CENTER_MULE, + item_names.COMMAND_CENTER_EXTRA_SUPPLIES, item_names.TECH_REACTOR, item_names.CELLULAR_REACTOR, item_names.PROGRESSIVE_REGENERATIVE_BIO_STEEL, # Place only L1 diff --git a/worlds/sc2/pool_filter.py b/worlds/sc2/pool_filter.py index 7c6b5e475420..476fb3057393 100644 --- a/worlds/sc2/pool_filter.py +++ b/worlds/sc2/pool_filter.py @@ -422,11 +422,17 @@ def attempt_removal(item: Item) -> bool: if not {item_names.MEDIVAC, item_names.HERCULES} & logical_inventory_set: inventory = [item for item in inventory if item.name != item_names.SIEGE_TANK_PROGRESSIVE_TRANSPORT_HOOK] unused_items = [item_name for item_name in unused_items if item_name != item_names.SIEGE_TANK_PROGRESSIVE_TRANSPORT_HOOK] + locked_items = [item for item in locked_items if item.name != item_names.SIEGE_TANK_PROGRESSIVE_TRANSPORT_HOOK] if item_names.MEDIVAC not in logical_inventory_set: # Don't allow L2 Siege Tank Transport Hook without Medivac - inventory_transport_hooks = [item for item in inventory if item.name == item_names.SIEGE_TANK_PROGRESSIVE_TRANSPORT_HOOK] + inventory_transport_hooks = [item for item in (inventory + locked_items) if item.name == item_names.SIEGE_TANK_PROGRESSIVE_TRANSPORT_HOOK] if len(inventory_transport_hooks) > 1: - inventory.remove(inventory_transport_hooks[0]) + if inventory_transport_hooks[0] in inventory: + inventory.remove(inventory_transport_hooks[0]) + elif inventory_transport_hooks[1] in inventory: + inventory.remove(inventory_transport_hooks[0]) + else: + locked_items.remove(inventory_transport_hooks[0]) if len(inventory_transport_hooks) > 0: # Transport Hook is in inventory, remove from unused_items unused_items = [item_name for item_name in unused_items if item_name != item_names.SIEGE_TANK_PROGRESSIVE_TRANSPORT_HOOK] @@ -439,6 +445,7 @@ def attempt_removal(item: Item) -> bool: # No orbital Command Spells inventory = [item for item in inventory if item.name != item_names.PLANETARY_FORTRESS_ORBITAL_MODULE] unused_items = [item_name for item_name in unused_items if item_name !=item_names.PLANETARY_FORTRESS_ORBITAL_MODULE] + locked_items = [item for item in inventory if item.name != item_names.PLANETARY_FORTRESS_ORBITAL_MODULE] # HotS # Baneling without sources => remove Baneling and upgrades