Skip to content

Commit

Permalink
Merge branch 'sc2-next' of github.com:Ziktofel/Archipelago into sc2-next
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziktofel committed Feb 3, 2024
2 parents 8892937 + 0fcae6d commit e1d4fe1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
22 changes: 11 additions & 11 deletions worlds/sc2/MissionTables.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ def vanilla_shuffle_order() -> Dict[SC2Campaign, List[FillMission]]:
FillMission(MissionPools.FINAL, [MissionConnection(18, SC2Campaign.HOTS)], "Korhal", completion_critical=True),
],
SC2Campaign.PROLOGUE: [
FillMission(MissionPools.STARTER, [MissionConnection(-1, SC2Campaign.PROLOGUE)], "_1", completion_critical=True),
FillMission(MissionPools.MEDIUM, [MissionConnection(0, SC2Campaign.PROLOGUE)], "_2", completion_critical=True, removal_priority=1),
FillMission(MissionPools.FINAL, [MissionConnection(1, SC2Campaign.PROLOGUE)], "_3", completion_critical=True)
FillMission(MissionPools.STARTER, [MissionConnection(-1, SC2Campaign.PROLOGUE)], "_1"),
FillMission(MissionPools.MEDIUM, [MissionConnection(0, SC2Campaign.PROLOGUE)], "_2", removal_priority=1),
FillMission(MissionPools.FINAL, [MissionConnection(1, SC2Campaign.PROLOGUE)], "_3")
],
SC2Campaign.LOTV: [
FillMission(MissionPools.STARTER, [MissionConnection(2, SC2Campaign.PROLOGUE)], "Aiur", completion_critical=True),
FillMission(MissionPools.STARTER, [MissionConnection(-1, SC2Campaign.LOTV)], "Aiur", completion_critical=True),
FillMission(MissionPools.EASY, [MissionConnection(0, SC2Campaign.LOTV)], "Aiur", completion_critical=True, removal_priority=3),
FillMission(MissionPools.EASY, [MissionConnection(1, SC2Campaign.LOTV)], "Aiur", completion_critical=True),
FillMission(MissionPools.MEDIUM, [MissionConnection(2, SC2Campaign.LOTV)], "Korhal", completion_critical=True),
Expand Down Expand Up @@ -344,11 +344,11 @@ def mini_campaign_order() -> Dict[SC2Campaign, List[FillMission]]:
FillMission(MissionPools.FINAL, [MissionConnection(11, SC2Campaign.HOTS)], "Korhal", completion_critical=True),
],
SC2Campaign.PROLOGUE: [
FillMission(MissionPools.EASY, [MissionConnection(-1, SC2Campaign.PROLOGUE)], "_1", completion_critical=True),
FillMission(MissionPools.FINAL, [MissionConnection(0, SC2Campaign.PROLOGUE)], "_2", completion_critical=True)
FillMission(MissionPools.EASY, [MissionConnection(-1, SC2Campaign.PROLOGUE)], "_1"),
FillMission(MissionPools.FINAL, [MissionConnection(0, SC2Campaign.PROLOGUE)], "_2")
],
SC2Campaign.LOTV: [
FillMission(MissionPools.STARTER, [MissionConnection(1, SC2Campaign.PROLOGUE)], "Aiur", completion_critical=True),
FillMission(MissionPools.STARTER, [MissionConnection(-1, SC2Campaign.LOTV)], "Aiur",completion_critical=True),
FillMission(MissionPools.EASY, [MissionConnection(0, SC2Campaign.LOTV)], "Aiur", completion_critical=True),
FillMission(MissionPools.EASY, [MissionConnection(1, SC2Campaign.LOTV)], "Korhal", completion_critical=True),
FillMission(MissionPools.MEDIUM, [MissionConnection(1, SC2Campaign.LOTV)], "Shakuras", completion_critical=True),
Expand Down Expand Up @@ -534,12 +534,12 @@ def blitz_order() -> Dict[SC2Campaign, List[FillMission]]:
SC2Mission.THE_RECKONING.mission_name: MissionInfo(SC2Mission.THE_RECKONING, [MissionConnection(19, SC2Campaign.HOTS)], SC2Mission.THE_RECKONING.area, completion_critical=True),
},
SC2Campaign.PROLOGUE: {
SC2Mission.DARK_WHISPERS.mission_name: MissionInfo(SC2Mission.DARK_WHISPERS, [], SC2Mission.DARK_WHISPERS.area, completion_critical=True),
SC2Mission.GHOSTS_IN_THE_FOG.mission_name: MissionInfo(SC2Mission.GHOSTS_IN_THE_FOG, [MissionConnection(1, SC2Campaign.PROLOGUE)], SC2Mission.GHOSTS_IN_THE_FOG.area, completion_critical=True),
SC2Mission.EVIL_AWOKEN.mission_name: MissionInfo(SC2Mission.EVIL_AWOKEN, [MissionConnection(2, SC2Campaign.PROLOGUE)], SC2Mission.EVIL_AWOKEN.area, completion_critical=True)
SC2Mission.DARK_WHISPERS.mission_name: MissionInfo(SC2Mission.DARK_WHISPERS, [], SC2Mission.DARK_WHISPERS.area),
SC2Mission.GHOSTS_IN_THE_FOG.mission_name: MissionInfo(SC2Mission.GHOSTS_IN_THE_FOG, [MissionConnection(1, SC2Campaign.PROLOGUE)], SC2Mission.GHOSTS_IN_THE_FOG.area),
SC2Mission.EVIL_AWOKEN.mission_name: MissionInfo(SC2Mission.EVIL_AWOKEN, [MissionConnection(2, SC2Campaign.PROLOGUE)], SC2Mission.EVIL_AWOKEN.area)
},
SC2Campaign.LOTV: {
SC2Mission.FOR_AIUR.mission_name: MissionInfo(SC2Mission.FOR_AIUR, [MissionConnection(3, SC2Campaign.PROLOGUE)], SC2Mission.FOR_AIUR.area, completion_critical=True),
SC2Mission.FOR_AIUR.mission_name: MissionInfo(SC2Mission.FOR_AIUR, [], SC2Mission.FOR_AIUR.area, completion_critical=True),
SC2Mission.THE_GROWING_SHADOW.mission_name: MissionInfo(SC2Mission.THE_GROWING_SHADOW, [MissionConnection(1, SC2Campaign.LOTV)], SC2Mission.THE_GROWING_SHADOW.area, completion_critical=True),
SC2Mission.THE_SPEAR_OF_ADUN.mission_name: MissionInfo(SC2Mission.THE_SPEAR_OF_ADUN, [MissionConnection(2, SC2Campaign.LOTV)], SC2Mission.THE_SPEAR_OF_ADUN.area, completion_critical=True),
SC2Mission.SKY_SHIELD.mission_name: MissionInfo(SC2Mission.SKY_SHIELD, [MissionConnection(3, SC2Campaign.LOTV)], SC2Mission.SKY_SHIELD.area, completion_critical=True),
Expand Down
13 changes: 9 additions & 4 deletions worlds/sc2/PoolFilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def attempt_removal(item: Item) -> bool:
unit_nb_upgrades = {}
for item in inventory:
cItem = item_list[item.name]
if cItem.type in UPGRADABLE_ITEMS and item.name not in unit_avail_upgrades:
if cItem.parent_item in UPGRADABLE_ITEMS and item.name not in unit_avail_upgrades:
unit_avail_upgrades[item.name] = []
unit_nb_upgrades[item.name] = 0
elif cItem.parent_item is not None:
Expand All @@ -288,7 +288,7 @@ def attempt_removal(item: Item) -> bool:
# For those two categories, we count them but dont include them in removal
for item in locked_items + self.existing_items:
cItem = item_list[item.name]
if cItem.type in UPGRADABLE_ITEMS and item.name not in unit_avail_upgrades:
if cItem.parent_item in UPGRADABLE_ITEMS and item.name not in unit_avail_upgrades:
unit_avail_upgrades[item.name] = []
unit_nb_upgrades[item.name] = 0
elif cItem.parent_item is not None:
Expand Down Expand Up @@ -347,6 +347,7 @@ def attempt_removal(item: Item) -> bool:
removable_generic_items.append(item)

# Main cull process
unused_items = [] # Reusable items for the second pass
while len(inventory) + len(locked_items) > inventory_size:
if len(inventory) == 0:
# There are more items than locations and all of them are already locked due to YAML or logic.
Expand Down Expand Up @@ -390,7 +391,9 @@ def attempt_removal(item: Item) -> bool:
continue
attempt_removal(item_to_remove)
else:
attempt_removal(item)
# Unimportant upgrades may be added again in the second pass
if attempt_removal(item):
unused_items.append(item.name)

# Removing extra dependencies
# WoL
Expand Down Expand Up @@ -476,7 +479,9 @@ def attempt_removal(item: Item) -> bool:
replacement_items = [item for item in self.item_pool
if (item not in inventory
and item not in self.locked_items
and item.name in second_pass_placeable_items)]
and (
item.name in second_pass_placeable_items
or item.name in unused_items))]
self.multiworld.random.shuffle(replacement_items)
while len(inventory) < inventory_size and len(replacement_items) > 0:
item = replacement_items.pop()
Expand Down
9 changes: 1 addition & 8 deletions worlds/sc2/Regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,7 @@ def wol_cleared_missions(state: CollectionState, mission_count: int) -> bool:
lambda state: state.has("Beat Ghosts in the Fog", player))

if SC2Campaign.LOTV in enabled_campaigns:
if SC2Campaign.PROLOGUE in enabled_campaigns:
connect(multiworld, player, names, "Evil Awoken", "For Aiur!",
lambda state: state.has("Beat Evil Awoken", player))
else:
vanilla_mission_reqs[SC2Campaign.LOTV] = vanilla_mission_reqs[SC2Campaign.LOTV].copy()
vanilla_mission_reqs[SC2Campaign.LOTV][SC2Mission.FOR_AIUR.mission_name] = MissionInfo(
SC2Mission.FOR_AIUR, [], SC2Mission.FOR_AIUR.area)
connect(multiworld, player, names, "Menu", "For Aiur!")
connect(multiworld, player, names, "Menu", "For Aiur!")
connect(multiworld, player, names, "For Aiur!", "The Growing Shadow",
lambda state: state.has("Beat For Aiur!", player)),
connect(multiworld, player, names, "The Growing Shadow", "The Spear of Adun",
Expand Down

0 comments on commit e1d4fe1

Please sign in to comment.