From b0d8715d5cef60b80fbc15e1d97857d756300951 Mon Sep 17 00:00:00 2001 From: EnvyDragon <138727357+EnvyDragon@users.noreply.github.com> Date: Mon, 1 Jul 2024 17:37:56 -0400 Subject: [PATCH] SC2: race-swap logic fixes --- worlds/sc2/__init__.py | 9 ++++----- worlds/sc2/client.py | 4 +--- worlds/sc2/regions.py | 14 +++++++------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/worlds/sc2/__init__.py b/worlds/sc2/__init__.py index dd709de8c1f1..dc8ed80e8e3e 100644 --- a/worlds/sc2/__init__.py +++ b/worlds/sc2/__init__.py @@ -21,7 +21,7 @@ get_option_value, LocationInclusion, KerriganLevelItemDistribution, KerriganPresence, KerriganPrimalStatus, kerrigan_unit_available, StarterUnit, SpearOfAdunPresence, get_enabled_campaigns, SpearOfAdunAutonomouslyCastAbilityPresence, Starcraft2Options, - GrantStoryTech, GenericUpgradeResearch, GenericUpgradeItems, get_enabled_races + GrantStoryTech, GenericUpgradeResearch, GenericUpgradeItems, ) from .pool_filter import filter_items from .mission_tables import ( @@ -257,7 +257,6 @@ def resolve_count(count: Optional[int], max_count: int) -> int: def flag_excludes_by_faction_presence(world: SC2World, item_list: List[FilterItem]) -> None: """Excludes items based on if their faction has a mission present where they can be used""" missions = get_all_missions(world.mission_req_table) - races = get_enabled_races(world) if world.options.take_over_ai_allies.value: terran_missions = [mission for mission in missions if (MissionFlag.Terran|MissionFlag.AiTerranAlly) & mission.flags] zerg_missions = [mission for mission in missions if (MissionFlag.Zerg|MissionFlag.AiZergAlly) & mission.flags] @@ -276,13 +275,13 @@ def flag_excludes_by_faction_presence(world: SC2World, item_list: List[FilterIte for item in item_list: # Catch-all for all of a faction's items - if (not terran_missions or SC2Race.TERRAN not in races) and item.data.race == SC2Race.TERRAN: + if (not terran_missions and item.data.race == SC2Race.TERRAN): item.flags |= ItemFilterFlags.Excluded continue - if (not zerg_missions or SC2Race.ZERG not in races) and item.data.race == SC2Race.ZERG: + if (not zerg_missions and item.data.race == SC2Race.ZERG): item.flags |= ItemFilterFlags.Excluded continue - if (not protoss_missions or SC2Race.PROTOSS not in races) and item.data.race == SC2Race.PROTOSS: + if (not protoss_missions and item.data.race == SC2Race.PROTOSS): if item.name not in item_groups.soa_items: item.flags |= ItemFilterFlags.Excluded continue diff --git a/worlds/sc2/client.py b/worlds/sc2/client.py index 4f5e26cd44b8..0804df1eec4b 100644 --- a/worlds/sc2/client.py +++ b/worlds/sc2/client.py @@ -1108,10 +1108,8 @@ async def on_step(self, iteration: int): kerrigan_level = get_kerrigan_level(self.ctx, start_items, missions_beaten) kerrigan_options = calculate_kerrigan_options(self.ctx) soa_options = caclulate_soa_options(self.ctx) - mission_variant = get_mission_variant(self.mission_id) + mission_variant = get_mission_variant(self.mission_id) # 0/1/2/3 for unchanged/Terran/Zerg/Protoss uncollected_objectives: typing.List[int] = self.get_uncollected_objectives() - # TODO: Add logic to determine which variant, based on selected map ID - mission_variant = 0 # 0/1/2/3 for unchanged/Terran/Zerg/Protoss if self.ctx.difficulty_override >= 0: difficulty = calc_difficulty(self.ctx.difficulty_override) else: diff --git a/worlds/sc2/regions.py b/worlds/sc2/regions.py index e33c6232dd52..52169db25fcb 100644 --- a/worlds/sc2/regions.py +++ b/worlds/sc2/regions.py @@ -66,11 +66,11 @@ def wol_cleared_missions(state: CollectionState, mission_count: int) -> bool: player: int = world.player if SC2Campaign.WOL in enabled_campaigns: connect(world, names, 'Menu', 'Liberation Day') - connect(world, names, 'Liberation Day', 'The Outlaws', + connect(world, names, 'Liberation Day', 'The Outlaws (T)', lambda state: state.has("Beat Liberation Day", player)) - connect(world, names, 'The Outlaws', 'Zero Hour', + connect(world, names, 'The Outlaws (T)', 'Zero Hour (T)', lambda state: state.has("Beat The Outlaws", player)) - connect(world, names, 'Zero Hour', 'Evacuation', + connect(world, names, 'Zero Hour (T)', 'Evacuation', lambda state: state.has("Beat Zero Hour", player)) connect(world, names, 'Evacuation', 'Outbreak', lambda state: state.has("Beat Evacuation", player)) @@ -78,9 +78,9 @@ def wol_cleared_missions(state: CollectionState, mission_count: int) -> bool: lambda state: wol_cleared_missions(state, 7) and state.has("Beat Outbreak", player)) connect(world, names, "Outbreak", "Haven's Fall", lambda state: wol_cleared_missions(state, 7) and state.has("Beat Outbreak", player)) - connect(world, names, 'Zero Hour', 'Smash and Grab', + connect(world, names, 'Zero Hour (T)', 'Smash and Grab (T)', lambda state: state.has("Beat Zero Hour", player)) - connect(world, names, 'Smash and Grab', 'The Dig', + connect(world, names, 'Smash and Grab (T)', 'The Dig', lambda state: wol_cleared_missions(state, 8) and state.has("Beat Smash and Grab", player)) connect(world, names, 'The Dig', 'The Moebius Factor', lambda state: wol_cleared_missions(state, 11) and state.has("Beat The Dig", player)) @@ -88,7 +88,7 @@ def wol_cleared_missions(state: CollectionState, mission_count: int) -> bool: lambda state: wol_cleared_missions(state, 14) and state.has("Beat The Moebius Factor", player)) connect(world, names, 'Supernova', 'Maw of the Void', lambda state: state.has("Beat Supernova", player)) - connect(world, names, 'Zero Hour', "Devil's Playground", + connect(world, names, 'Zero Hour (T)', "Devil's Playground", lambda state: wol_cleared_missions(state, 4) and state.has("Beat Zero Hour", player)) connect(world, names, "Devil's Playground", 'Welcome to the Jungle', lambda state: state.has("Beat Devil's Playground", player)) @@ -96,7 +96,7 @@ def wol_cleared_missions(state: CollectionState, mission_count: int) -> bool: lambda state: wol_cleared_missions(state, 8) and state.has("Beat Welcome to the Jungle", player)) connect(world, names, "Welcome to the Jungle", 'Ghost of a Chance', lambda state: wol_cleared_missions(state, 8) and state.has("Beat Welcome to the Jungle", player)) - connect(world, names, "Zero Hour", 'The Great Train Robbery', + connect(world, names, "Zero Hour (T)", 'The Great Train Robbery', lambda state: wol_cleared_missions(state, 6) and state.has("Beat Zero Hour", player)) connect(world, names, 'The Great Train Robbery', 'Cutthroat', lambda state: state.has("Beat The Great Train Robbery", player))