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..9d553c07f647 100644 --- a/worlds/sc2/client.py +++ b/worlds/sc2/client.py @@ -1046,18 +1046,17 @@ def kerrigan_primal(ctx: SC2Context, kerrigan_level: int) -> bool: return False -def get_mission_variant(mission_id): +def get_mission_variant(mission_id: int) -> int: mission_flags = lookup_id_to_mission[mission_id].flags - faction_variant = 0 if MissionFlag.RaceSwap not in mission_flags: - return faction_variant + return 0 if MissionFlag.Terran in mission_flags: - faction_variant = 1 + return 1 elif MissionFlag.Zerg in mission_flags: - faction_variant = 2 + return 2 elif MissionFlag.Protoss in mission_flags: - faction_variant = 3 - return faction_variant + return 3 + return 0 async def starcraft_launch(ctx: SC2Context, mission_id: int): @@ -1108,10 +1107,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/locations.py b/worlds/sc2/locations.py index 57c5bb95af9d..fc4680a5ff2a 100644 --- a/worlds/sc2/locations.py +++ b/worlds/sc2/locations.py @@ -105,39 +105,39 @@ def get_locations(world: Optional['SC2World']) -> Tuple[LocationData, ...]: LocationData("Liberation Day", "Liberation Day: Sixth Statue", SC2WOL_LOC_ID_OFFSET + 106, LocationType.VANILLA), LocationData("Liberation Day", "Liberation Day: Special Delivery", SC2WOL_LOC_ID_OFFSET + 107, LocationType.EXTRA), LocationData("Liberation Day", "Liberation Day: Transport", SC2WOL_LOC_ID_OFFSET + 108, LocationType.EXTRA), - LocationData("The Outlaws", "The Outlaws: Victory", SC2WOL_LOC_ID_OFFSET + 200, LocationType.VICTORY, + LocationData("The Outlaws (Terran)", "The Outlaws (Terran): Victory", SC2WOL_LOC_ID_OFFSET + 200, LocationType.VICTORY, lambda state: logic.terran_early_tech(state)), - LocationData("The Outlaws", "The Outlaws: Rebel Base", SC2WOL_LOC_ID_OFFSET + 201, LocationType.VANILLA, + LocationData("The Outlaws (Terran)", "The Outlaws (Terran): Rebel Base", SC2WOL_LOC_ID_OFFSET + 201, LocationType.VANILLA, lambda state: logic.terran_early_tech(state)), - LocationData("The Outlaws", "The Outlaws: North Resource Pickups", SC2WOL_LOC_ID_OFFSET + 202, LocationType.EXTRA, + LocationData("The Outlaws (Terran)", "The Outlaws (Terran): North Resource Pickups", SC2WOL_LOC_ID_OFFSET + 202, LocationType.EXTRA, lambda state: logic.terran_early_tech(state)), - LocationData("The Outlaws", "The Outlaws: Bunker", SC2WOL_LOC_ID_OFFSET + 203, LocationType.VANILLA, + LocationData("The Outlaws (Terran)", "The Outlaws (Terran): Bunker", SC2WOL_LOC_ID_OFFSET + 203, LocationType.VANILLA, lambda state: logic.terran_early_tech(state)), - LocationData("The Outlaws", "The Outlaws: Close Resource Pickups", SC2WOL_LOC_ID_OFFSET + 204, LocationType.EXTRA), - LocationData("Zero Hour", "Zero Hour: Victory", SC2WOL_LOC_ID_OFFSET + 300, LocationType.VICTORY, + LocationData("The Outlaws (Terran)", "The Outlaws (Terran): Close Resource Pickups", SC2WOL_LOC_ID_OFFSET + 204, LocationType.EXTRA), + LocationData("Zero Hour (Terran)", "Zero Hour (Terran): Victory", SC2WOL_LOC_ID_OFFSET + 300, LocationType.VICTORY, lambda state: logic.terran_common_unit(state) and logic.terran_defense_rating(state, True) >= 2 and (adv_tactics or logic.terran_basic_anti_air(state))), - LocationData("Zero Hour", "Zero Hour: First Group Rescued", SC2WOL_LOC_ID_OFFSET + 301, LocationType.VANILLA), - LocationData("Zero Hour", "Zero Hour: Second Group Rescued", SC2WOL_LOC_ID_OFFSET + 302, LocationType.VANILLA, + LocationData("Zero Hour (Terran)", "Zero Hour (Terran): First Group Rescued", SC2WOL_LOC_ID_OFFSET + 301, LocationType.VANILLA), + LocationData("Zero Hour (Terran)", "Zero Hour (Terran): Second Group Rescued", SC2WOL_LOC_ID_OFFSET + 302, LocationType.VANILLA, lambda state: logic.terran_common_unit(state)), - LocationData("Zero Hour", "Zero Hour: Third Group Rescued", SC2WOL_LOC_ID_OFFSET + 303, LocationType.VANILLA, + LocationData("Zero Hour (Terran)", "Zero Hour (Terran): Third Group Rescued", SC2WOL_LOC_ID_OFFSET + 303, LocationType.VANILLA, lambda state: logic.terran_common_unit(state) and logic.terran_defense_rating(state, True) >= 2), - LocationData("Zero Hour", "Zero Hour: First Hatchery", SC2WOL_LOC_ID_OFFSET + 304, LocationType.CHALLENGE, + LocationData("Zero Hour (Terran)", "Zero Hour (Terran): First Hatchery", SC2WOL_LOC_ID_OFFSET + 304, LocationType.CHALLENGE, lambda state: logic.terran_competent_comp(state)), - LocationData("Zero Hour", "Zero Hour: Second Hatchery", SC2WOL_LOC_ID_OFFSET + 305, LocationType.CHALLENGE, + LocationData("Zero Hour (Terran)", "Zero Hour (Terran): Second Hatchery", SC2WOL_LOC_ID_OFFSET + 305, LocationType.CHALLENGE, lambda state: logic.terran_competent_comp(state)), - LocationData("Zero Hour", "Zero Hour: Third Hatchery", SC2WOL_LOC_ID_OFFSET + 306, LocationType.CHALLENGE, + LocationData("Zero Hour (Terran)", "Zero Hour (Terran): Third Hatchery", SC2WOL_LOC_ID_OFFSET + 306, LocationType.CHALLENGE, lambda state: logic.terran_competent_comp(state)), - LocationData("Zero Hour", "Zero Hour: Fourth Hatchery", SC2WOL_LOC_ID_OFFSET + 307, LocationType.CHALLENGE, + LocationData("Zero Hour (Terran)", "Zero Hour (Terran): Fourth Hatchery", SC2WOL_LOC_ID_OFFSET + 307, LocationType.CHALLENGE, lambda state: logic.terran_competent_comp(state)), - LocationData("Zero Hour", "Zero Hour: Ride's on its Way", SC2WOL_LOC_ID_OFFSET + 308, LocationType.EXTRA, + LocationData("Zero Hour (Terran)", "Zero Hour (Terran): Ride's on its Way", SC2WOL_LOC_ID_OFFSET + 308, LocationType.EXTRA, lambda state: logic.terran_common_unit(state)), - LocationData("Zero Hour", "Zero Hour: Hold Just a Little Longer", SC2WOL_LOC_ID_OFFSET + 309, LocationType.EXTRA, + LocationData("Zero Hour (Terran)", "Zero Hour (Terran): Hold Just a Little Longer", SC2WOL_LOC_ID_OFFSET + 309, LocationType.EXTRA, lambda state: logic.terran_common_unit(state) and logic.terran_defense_rating(state, True) >= 2), - LocationData("Zero Hour", "Zero Hour: Cavalry's on the Way", SC2WOL_LOC_ID_OFFSET + 310, LocationType.EXTRA, + LocationData("Zero Hour (Terran)", "Zero Hour (Terran): Cavalry's on the Way", SC2WOL_LOC_ID_OFFSET + 310, LocationType.EXTRA, lambda state: logic.terran_common_unit(state) and logic.terran_defense_rating(state, True) >= 2), LocationData("Evacuation", "Evacuation: Victory", SC2WOL_LOC_ID_OFFSET + 400, LocationType.VICTORY, @@ -239,25 +239,25 @@ def get_locations(world: Optional['SC2World']) -> Tuple[LocationData, ...]: lambda state: logic.terran_common_unit(state) and logic.terran_competent_anti_air(state) and logic.terran_defense_rating(state, True) >= 3), - LocationData("Smash and Grab", "Smash and Grab: Victory", SC2WOL_LOC_ID_OFFSET + 800, LocationType.VICTORY, + LocationData("Smash and Grab (Terran)", "Smash and Grab (Terran): Victory", SC2WOL_LOC_ID_OFFSET + 800, LocationType.VICTORY, lambda state: logic.terran_common_unit(state) and (adv_tactics and logic.terran_basic_anti_air(state) or logic.terran_competent_anti_air(state))), - LocationData("Smash and Grab", "Smash and Grab: First Relic", SC2WOL_LOC_ID_OFFSET + 801, LocationType.VANILLA), - LocationData("Smash and Grab", "Smash and Grab: Second Relic", SC2WOL_LOC_ID_OFFSET + 802, LocationType.VANILLA), - LocationData("Smash and Grab", "Smash and Grab: Third Relic", SC2WOL_LOC_ID_OFFSET + 803, LocationType.VANILLA, + LocationData("Smash and Grab (Terran)", "Smash and Grab (Terran): First Relic", SC2WOL_LOC_ID_OFFSET + 801, LocationType.VANILLA), + LocationData("Smash and Grab (Terran)", "Smash and Grab (Terran): Second Relic", SC2WOL_LOC_ID_OFFSET + 802, LocationType.VANILLA), + LocationData("Smash and Grab (Terran)", "Smash and Grab (Terran): Third Relic", SC2WOL_LOC_ID_OFFSET + 803, LocationType.VANILLA, lambda state: logic.terran_common_unit(state) and (adv_tactics and logic.terran_basic_anti_air(state) or logic.terran_competent_anti_air(state))), - LocationData("Smash and Grab", "Smash and Grab: Fourth Relic", SC2WOL_LOC_ID_OFFSET + 804, LocationType.VANILLA, + LocationData("Smash and Grab (Terran)", "Smash and Grab (Terran): Fourth Relic", SC2WOL_LOC_ID_OFFSET + 804, LocationType.VANILLA, lambda state: logic.terran_common_unit(state) and (adv_tactics and logic.terran_basic_anti_air(state) or logic.terran_competent_anti_air(state))), - LocationData("Smash and Grab", "Smash and Grab: First Forcefield Area Busted", SC2WOL_LOC_ID_OFFSET + 805, LocationType.EXTRA, + LocationData("Smash and Grab (Terran)", "Smash and Grab (Terran): First Forcefield Area Busted", SC2WOL_LOC_ID_OFFSET + 805, LocationType.EXTRA, lambda state: logic.terran_common_unit(state) and (adv_tactics and logic.terran_basic_anti_air(state) or logic.terran_competent_anti_air(state))), - LocationData("Smash and Grab", "Smash and Grab: Second Forcefield Area Busted", SC2WOL_LOC_ID_OFFSET + 806, LocationType.EXTRA, + LocationData("Smash and Grab (Terran)", "Smash and Grab (Terran): Second Forcefield Area Busted", SC2WOL_LOC_ID_OFFSET + 806, LocationType.EXTRA, lambda state: logic.terran_common_unit(state) and (adv_tactics and logic.terran_basic_anti_air(state) or logic.terran_competent_anti_air(state))), @@ -1622,47 +1622,116 @@ def get_locations(world: Optional['SC2World']) -> Tuple[LocationData, ...]: lambda state: logic.end_game_requirement(state)), # Mission Variants - LocationData("Smash and Grab (Z)", "Smash and Grab (Zerg): Victory", SC2_RACESWAP_LOC_ID_OFFSET + 1500, LocationType.VICTORY, + # 10X/20X - Liberation Day + LocationData("The Outlaws (Zerg)", "The Outlaws (Zerg): Victory", SC2_RACESWAP_LOC_ID_OFFSET + 300, LocationType.VICTORY, + lambda state: logic.zerg_common_unit(state)), + LocationData("The Outlaws (Zerg)", "The Outlaws (Zerg): Rebel Base", SC2_RACESWAP_LOC_ID_OFFSET + 301, LocationType.VANILLA, + lambda state: logic.zerg_common_unit(state)), + LocationData("The Outlaws (Zerg)", "The Outlaws (Zerg): North Resource Pickups", SC2_RACESWAP_LOC_ID_OFFSET + 302, LocationType.EXTRA, + lambda state: logic.zerg_common_unit(state)), + LocationData("The Outlaws (Zerg)", "The Outlaws (Zerg): Bunker", SC2_RACESWAP_LOC_ID_OFFSET + 303, LocationType.VANILLA, + lambda state: logic.zerg_common_unit(state)), + LocationData("The Outlaws (Zerg)", "The Outlaws (Zerg): Close Resource Pickups", SC2_RACESWAP_LOC_ID_OFFSET + 304, LocationType.EXTRA), + LocationData("The Outlaws (Protoss)", "The Outlaws (Protoss): Victory", SC2_RACESWAP_LOC_ID_OFFSET + 400, LocationType.VICTORY, + lambda state: logic.protoss_common_unit(state)), + LocationData("The Outlaws (Protoss)", "The Outlaws (Protoss): Rebel Base", SC2_RACESWAP_LOC_ID_OFFSET + 401, LocationType.VANILLA, + lambda state: logic.protoss_common_unit(state)), + LocationData("The Outlaws (Protoss)", "The Outlaws (Protoss): North Resource Pickups", SC2_RACESWAP_LOC_ID_OFFSET + 402, LocationType.EXTRA, + lambda state: logic.protoss_common_unit(state)), + LocationData("The Outlaws (Protoss)", "The Outlaws (Protoss): Bunker", SC2_RACESWAP_LOC_ID_OFFSET + 403, LocationType.VANILLA, + lambda state: logic.protoss_common_unit(state)), + LocationData("The Outlaws (Protoss)", "The Outlaws (Protoss): Close Resource Pickups", SC2_RACESWAP_LOC_ID_OFFSET + 404, LocationType.EXTRA), + LocationData("Zero Hour (Zerg)", "Zero Hour (Zerg): Victory", SC2_RACESWAP_LOC_ID_OFFSET + 500, LocationType.VICTORY, + lambda state: logic.zerg_competent_defense(state) and + logic.zerg_basic_kerriganless_anti_air(state)), + LocationData("Zero Hour (Zerg)", "Zero Hour (Zerg): First Group Rescued", SC2_RACESWAP_LOC_ID_OFFSET + 501, LocationType.VANILLA), + LocationData("Zero Hour (Zerg)", "Zero Hour (Zerg): Second Group Rescued", SC2_RACESWAP_LOC_ID_OFFSET + 502, LocationType.VANILLA, + lambda state: logic.zerg_common_unit(state)), + LocationData("Zero Hour (Zerg)", "Zero Hour (Zerg): Third Group Rescued", SC2_RACESWAP_LOC_ID_OFFSET + 503, LocationType.VANILLA, + lambda state: logic.zerg_competent_defense(state)), + LocationData("Zero Hour (Zerg)", "Zero Hour (Zerg): First Hatchery", SC2_RACESWAP_LOC_ID_OFFSET + 504, LocationType.CHALLENGE, + lambda state: logic.zerg_competent_comp(state)), + LocationData("Zero Hour (Zerg)", "Zero Hour (Zerg): Second Hatchery", SC2_RACESWAP_LOC_ID_OFFSET + 505, LocationType.CHALLENGE, + lambda state: logic.zerg_competent_comp(state)), + LocationData("Zero Hour (Zerg)", "Zero Hour (Zerg): Third Hatchery", SC2_RACESWAP_LOC_ID_OFFSET + 506, LocationType.CHALLENGE, + lambda state: logic.zerg_competent_comp(state)), + LocationData("Zero Hour (Zerg)", "Zero Hour (Zerg): Fourth Hatchery", SC2_RACESWAP_LOC_ID_OFFSET + 507, LocationType.CHALLENGE, + lambda state: logic.zerg_competent_comp(state)), + LocationData("Zero Hour (Zerg)", "Zero Hour (Zerg): Ride's on its Way", SC2_RACESWAP_LOC_ID_OFFSET + 508, LocationType.EXTRA, + lambda state: logic.zerg_common_unit(state)), + LocationData("Zero Hour (Zerg)", "Zero Hour (Zerg): Hold Just a Little Longer", SC2_RACESWAP_LOC_ID_OFFSET + 509, + LocationType.EXTRA, + lambda state: logic.zerg_competent_defense(state)), + LocationData("Zero Hour (Zerg)", "Zero Hour (Zerg): Cavalry's on the Way", SC2_RACESWAP_LOC_ID_OFFSET + 510, LocationType.EXTRA, + lambda state: logic.zerg_competent_defense(state)), + LocationData("Zero Hour (Protoss)", "Zero Hour (Protoss): Victory", SC2_RACESWAP_LOC_ID_OFFSET + 600, LocationType.VICTORY, + lambda state: logic.protoss_common_unit(state) and + (adv_tactics or logic.protoss_basic_anti_air(state))), + LocationData("Zero Hour (Protoss)", "Zero Hour (Protoss): First Group Rescued", SC2_RACESWAP_LOC_ID_OFFSET + 601, LocationType.VANILLA), + LocationData("Zero Hour (Protoss)", "Zero Hour (Protoss): Second Group Rescued", SC2_RACESWAP_LOC_ID_OFFSET + 602, LocationType.VANILLA, + lambda state: logic.protoss_common_unit(state)), + LocationData("Zero Hour (Protoss)", "Zero Hour (Protoss): Third Group Rescued", SC2_RACESWAP_LOC_ID_OFFSET + 603, LocationType.VANILLA, + lambda state: logic.protoss_common_unit(state)), + LocationData("Zero Hour (Protoss)", "Zero Hour (Protoss): First Hatchery", SC2_RACESWAP_LOC_ID_OFFSET + 604, LocationType.CHALLENGE, + lambda state: logic.protoss_competent_comp(state)), + LocationData("Zero Hour (Protoss)", "Zero Hour (Protoss): Second Hatchery", SC2_RACESWAP_LOC_ID_OFFSET + 605, LocationType.CHALLENGE, + lambda state: logic.protoss_competent_comp(state)), + LocationData("Zero Hour (Protoss)", "Zero Hour (Protoss): Third Hatchery", SC2_RACESWAP_LOC_ID_OFFSET + 606, LocationType.CHALLENGE, + lambda state: logic.protoss_competent_comp(state)), + LocationData("Zero Hour (Protoss)", "Zero Hour (Protoss): Fourth Hatchery", SC2_RACESWAP_LOC_ID_OFFSET + 607, LocationType.CHALLENGE, + lambda state: logic.protoss_competent_comp(state)), + LocationData("Zero Hour (Protoss)", "Zero Hour (Protoss): Ride's on its Way", SC2_RACESWAP_LOC_ID_OFFSET + 608, LocationType.EXTRA, + lambda state: logic.protoss_common_unit(state)), + LocationData("Zero Hour (Protoss)", "Zero Hour (Protoss): Hold Just a Little Longer", SC2_RACESWAP_LOC_ID_OFFSET + 609, + LocationType.EXTRA, + lambda state: logic.protoss_common_unit(state)), + LocationData("Zero Hour (Protoss)", "Zero Hour (Protoss): Cavalry's on the Way", SC2_RACESWAP_LOC_ID_OFFSET + 610, LocationType.EXTRA, + lambda state: logic.protoss_common_unit(state)), + # 70X/80X - Evacuation + # 90X/100X - Outbreak + # 110X/120X - Safe Haven + # 130X/140X - Haven's Fall + LocationData("Smash and Grab (Zerg)", "Smash and Grab (Zerg): Victory", SC2_RACESWAP_LOC_ID_OFFSET + 1500, LocationType.VICTORY, lambda state: logic.zerg_common_unit(state) and (adv_tactics and logic.zerg_basic_anti_air(state) or logic.zerg_competent_anti_air(state))), - LocationData("Smash and Grab (Z)", "Smash and Grab (Zerg): First Relic", SC2_RACESWAP_LOC_ID_OFFSET + 1501, LocationType.VANILLA), - LocationData("Smash and Grab (Z)", "Smash and Grab (Zerg): Second Relic", SC2_RACESWAP_LOC_ID_OFFSET + 1502, LocationType.VANILLA), - LocationData("Smash and Grab (Z)", "Smash and Grab (Zerg): Third Relic", SC2_RACESWAP_LOC_ID_OFFSET + 1503, LocationType.VANILLA, + LocationData("Smash and Grab (Zerg)", "Smash and Grab (Zerg): First Relic", SC2_RACESWAP_LOC_ID_OFFSET + 1501, LocationType.VANILLA), + LocationData("Smash and Grab (Zerg)", "Smash and Grab (Zerg): Second Relic", SC2_RACESWAP_LOC_ID_OFFSET + 1502, LocationType.VANILLA), + LocationData("Smash and Grab (Zerg)", "Smash and Grab (Zerg): Third Relic", SC2_RACESWAP_LOC_ID_OFFSET + 1503, LocationType.VANILLA, lambda state: logic.zerg_common_unit(state) and (adv_tactics and logic.zerg_basic_kerriganless_anti_air(state) or logic.zerg_competent_anti_air(state))), - LocationData("Smash and Grab (Z)", "Smash and Grab (Zerg): Fourth Relic", SC2_RACESWAP_LOC_ID_OFFSET + 1504, LocationType.VANILLA, + LocationData("Smash and Grab (Zerg)", "Smash and Grab (Zerg): Fourth Relic", SC2_RACESWAP_LOC_ID_OFFSET + 1504, LocationType.VANILLA, lambda state: logic.zerg_common_unit(state) and (adv_tactics and logic.zerg_basic_kerriganless_anti_air(state) or logic.zerg_competent_anti_air(state))), - LocationData("Smash and Grab (Z)", "Smash and Grab (Zerg): First Forcefield Area Busted", SC2_RACESWAP_LOC_ID_OFFSET + 1505, LocationType.EXTRA, + LocationData("Smash and Grab (Zerg)", "Smash and Grab (Zerg): First Forcefield Area Busted", SC2_RACESWAP_LOC_ID_OFFSET + 1505, LocationType.EXTRA, lambda state: logic.zerg_common_unit(state) and (adv_tactics and logic.zerg_basic_kerriganless_anti_air(state) or logic.zerg_competent_anti_air(state))), - LocationData("Smash and Grab (Z)", "Smash and Grab (Zerg): Second Forcefield Area Busted", SC2_RACESWAP_LOC_ID_OFFSET + 1506, LocationType.EXTRA, + LocationData("Smash and Grab (Zerg)", "Smash and Grab (Zerg): Second Forcefield Area Busted", SC2_RACESWAP_LOC_ID_OFFSET + 1506, LocationType.EXTRA, lambda state: logic.zerg_common_unit(state) and (adv_tactics and logic.zerg_basic_kerriganless_anti_air(state) or logic.zerg_competent_anti_air(state))), - LocationData("Smash and Grab (P)", "Smash and Grab (Protoss): Victory", SC2_RACESWAP_LOC_ID_OFFSET + 1600, LocationType.VICTORY, + LocationData("Smash and Grab (Protoss)", "Smash and Grab (Protoss): Victory", SC2_RACESWAP_LOC_ID_OFFSET + 1600, LocationType.VICTORY, lambda state: logic.protoss_common_unit(state) and (adv_tactics and logic.protoss_basic_anti_air(state) or logic.protoss_competent_anti_air(state))), - LocationData("Smash and Grab (P)", "Smash and Grab (Protoss): First Relic", SC2_RACESWAP_LOC_ID_OFFSET + 1601, LocationType.VANILLA), - LocationData("Smash and Grab (P)", "Smash and Grab (Protoss): Second Relic", SC2_RACESWAP_LOC_ID_OFFSET + 1602, LocationType.VANILLA), - LocationData("Smash and Grab (P)", "Smash and Grab (Protoss): Third Relic", SC2_RACESWAP_LOC_ID_OFFSET + 1603, LocationType.VANILLA, + LocationData("Smash and Grab (Protoss)", "Smash and Grab (Protoss): First Relic", SC2_RACESWAP_LOC_ID_OFFSET + 1601, LocationType.VANILLA), + LocationData("Smash and Grab (Protoss)", "Smash and Grab (Protoss): Second Relic", SC2_RACESWAP_LOC_ID_OFFSET + 1602, LocationType.VANILLA), + LocationData("Smash and Grab (Protoss)", "Smash and Grab (Protoss): Third Relic", SC2_RACESWAP_LOC_ID_OFFSET + 1603, LocationType.VANILLA, lambda state: logic.protoss_common_unit(state) and (adv_tactics and logic.protoss_basic_anti_air(state) or logic.protoss_competent_anti_air(state))), - LocationData("Smash and Grab (P)", "Smash and Grab (Protoss): Fourth Relic", SC2_RACESWAP_LOC_ID_OFFSET + 1604, LocationType.VANILLA, + LocationData("Smash and Grab (Protoss)", "Smash and Grab (Protoss): Fourth Relic", SC2_RACESWAP_LOC_ID_OFFSET + 1604, LocationType.VANILLA, lambda state: logic.protoss_common_unit(state) and (adv_tactics and logic.protoss_basic_anti_air(state) or logic.protoss_competent_anti_air(state))), - LocationData("Smash and Grab (P)", "Smash and Grab (Protoss): First Forcefield Area Busted", SC2_RACESWAP_LOC_ID_OFFSET + 1605, LocationType.EXTRA, + LocationData("Smash and Grab (Protoss)", "Smash and Grab (Protoss): First Forcefield Area Busted", SC2_RACESWAP_LOC_ID_OFFSET + 1605, LocationType.EXTRA, lambda state: logic.protoss_common_unit(state) and (adv_tactics and logic.protoss_basic_anti_air(state) or logic.protoss_competent_anti_air(state))), - LocationData("Smash and Grab (P)", "Smash and Grab (Protoss): Second Forcefield Area Busted", SC2_RACESWAP_LOC_ID_OFFSET + 1606, LocationType.EXTRA, + LocationData("Smash and Grab (Protoss)", "Smash and Grab (Protoss): Second Forcefield Area Busted", SC2_RACESWAP_LOC_ID_OFFSET + 1606, LocationType.EXTRA, lambda state: logic.protoss_common_unit(state) and (adv_tactics and logic.protoss_basic_anti_air(state) or logic.protoss_competent_anti_air(state))), diff --git a/worlds/sc2/mission_tables.py b/worlds/sc2/mission_tables.py index b0d9ee9ce824..8569c659283c 100644 --- a/worlds/sc2/mission_tables.py +++ b/worlds/sc2/mission_tables.py @@ -101,13 +101,13 @@ def __init__(self, mission_id: int, name: str, campaign: SC2Campaign, area: str, # Wings of Liberty LIBERATION_DAY = 1, "Liberation Day", SC2Campaign.WOL, "Mar Sara", SC2Race.ANY, MissionPools.STARTER, "ap_liberation_day", MissionFlag.Terran|MissionFlag.NoBuild|MissionFlag.VsTerran - THE_OUTLAWS = 2, "The Outlaws", SC2Campaign.WOL, "Mar Sara", SC2Race.TERRAN, MissionPools.EASY, "ap_the_outlaws", MissionFlag.Terran|MissionFlag.VsTerran - ZERO_HOUR = 3, "Zero Hour", SC2Campaign.WOL, "Mar Sara", SC2Race.TERRAN, MissionPools.EASY, "ap_zero_hour", MissionFlag.Terran|MissionFlag.TimedDefense|MissionFlag.VsZerg + THE_OUTLAWS = 2, "The Outlaws (Terran)", SC2Campaign.WOL, "Mar Sara", SC2Race.TERRAN, MissionPools.EASY, "ap_the_outlaws", MissionFlag.Terran|MissionFlag.VsTerran|MissionFlag.HasRaceSwap + ZERO_HOUR = 3, "Zero Hour (Terran)", SC2Campaign.WOL, "Mar Sara", SC2Race.TERRAN, MissionPools.EASY, "ap_zero_hour", MissionFlag.Terran|MissionFlag.TimedDefense|MissionFlag.VsZerg|MissionFlag.HasRaceSwap EVACUATION = 4, "Evacuation", SC2Campaign.WOL, "Colonist", SC2Race.TERRAN, MissionPools.EASY, "ap_evacuation", MissionFlag.Terran|MissionFlag.AutoScroller|MissionFlag.VsZerg OUTBREAK = 5, "Outbreak", SC2Campaign.WOL, "Colonist", SC2Race.TERRAN, MissionPools.EASY, "ap_outbreak", MissionFlag.Terran|MissionFlag.Defense|MissionFlag.VsZerg SAFE_HAVEN = 6, "Safe Haven", SC2Campaign.WOL, "Colonist", SC2Race.TERRAN, MissionPools.MEDIUM, "ap_safe_haven", MissionFlag.Terran|MissionFlag.Countdown|MissionFlag.VsProtoss HAVENS_FALL = 7, "Haven's Fall", SC2Campaign.WOL, "Colonist", SC2Race.TERRAN, MissionPools.MEDIUM, "ap_havens_fall", MissionFlag.Terran|MissionFlag.VsZerg - SMASH_AND_GRAB = 8, "Smash and Grab (T)", SC2Campaign.WOL, "Artifact", SC2Race.TERRAN, MissionPools.EASY, "ap_smash_and_grab", MissionFlag.Terran|MissionFlag.Countdown|MissionFlag.VsPZ|MissionFlag.HasRaceSwap + SMASH_AND_GRAB = 8, "Smash and Grab (Terran)", SC2Campaign.WOL, "Artifact", SC2Race.TERRAN, MissionPools.EASY, "ap_smash_and_grab", MissionFlag.Terran|MissionFlag.Countdown|MissionFlag.VsPZ|MissionFlag.HasRaceSwap THE_DIG = 9, "The Dig", SC2Campaign.WOL, "Artifact", SC2Race.TERRAN, MissionPools.MEDIUM, "ap_the_dig", MissionFlag.Terran|MissionFlag.TimedDefense|MissionFlag.VsProtoss THE_MOEBIUS_FACTOR = 10, "The Moebius Factor", SC2Campaign.WOL, "Artifact", SC2Race.TERRAN, MissionPools.MEDIUM, "ap_the_moebius_factor", MissionFlag.Terran|MissionFlag.Countdown|MissionFlag.VsZerg SUPERNOVA = 11, "Supernova", SC2Campaign.WOL, "Artifact", SC2Race.TERRAN, MissionPools.HARD, "ap_supernova", MissionFlag.Terran|MissionFlag.Countdown|MissionFlag.VsProtoss @@ -197,8 +197,17 @@ def __init__(self, mission_id: int, name: str, campaign: SC2Campaign, area: str, END_GAME = 83, "End Game", SC2Campaign.NCO, "_3", SC2Race.TERRAN, MissionPools.VERY_HARD, "ap_end_game", MissionFlag.Terran|MissionFlag.Nova|MissionFlag.Defense|MissionFlag.VsTerran # Race-Swapped Variants - SMASH_AND_GRAB_Z = 98, "Smash and Grab (Z)", SC2Campaign.WOL, "Artifact", SC2Race.ZERG, MissionPools.EASY, "ap_smash_and_grab", MissionFlag.Zerg|MissionFlag.Countdown|MissionFlag.VsPZ|MissionFlag.RaceSwap - SMASH_AND_GRAB_P = 99, "Smash and Grab (P)", SC2Campaign.WOL, "Artifact", SC2Race.PROTOSS, MissionPools.EASY, "ap_smash_and_grab", MissionFlag.Protoss|MissionFlag.Countdown|MissionFlag.VsPZ|MissionFlag.RaceSwap + # 84/85 - Liberation Day + THE_OUTLAWS_Z = 86, "The Outlaws (Zerg)", SC2Campaign.WOL, "Mar Sara", SC2Race.ZERG, MissionPools.EASY, "ap_the_outlaws", MissionFlag.Zerg|MissionFlag.VsTerran|MissionFlag.RaceSwap + THE_OUTLAWS_P = 87, "The Outlaws (Protoss)", SC2Campaign.WOL, "Mar Sara", SC2Race.PROTOSS, MissionPools.EASY, "ap_the_outlaws", MissionFlag.Protoss|MissionFlag.VsTerran|MissionFlag.RaceSwap + ZERO_HOUR_Z = 88, "Zero Hour (Zerg)", SC2Campaign.WOL, "Mar Sara", SC2Race.ZERG, MissionPools.EASY, "ap_zero_hour", MissionFlag.Zerg|MissionFlag.TimedDefense|MissionFlag.VsZerg|MissionFlag.RaceSwap + ZERO_HOUR_P = 89, "Zero Hour (Protoss)", SC2Campaign.WOL, "Mar Sara", SC2Race.PROTOSS, MissionPools.EASY, "ap_zero_hour", MissionFlag.Protoss|MissionFlag.TimedDefense|MissionFlag.VsZerg|MissionFlag.RaceSwap + # 90/91 - Evacuation + # 92/93 - Outbreak + # 94/95 - Safe Haven + # 96/97 - Haven's Fall + SMASH_AND_GRAB_Z = 98, "Smash and Grab (Zerg)", SC2Campaign.WOL, "Artifact", SC2Race.ZERG, MissionPools.EASY, "ap_smash_and_grab", MissionFlag.Zerg|MissionFlag.Countdown|MissionFlag.VsPZ|MissionFlag.RaceSwap + SMASH_AND_GRAB_P = 99, "Smash and Grab (Protoss)", SC2Campaign.WOL, "Artifact", SC2Race.PROTOSS, MissionPools.EASY, "ap_smash_and_grab", MissionFlag.Protoss|MissionFlag.Countdown|MissionFlag.VsPZ|MissionFlag.RaceSwap class MissionConnection: diff --git a/worlds/sc2/options.py b/worlds/sc2/options.py index 5f1d1a97fff4..70f5be01892a 100644 --- a/worlds/sc2/options.py +++ b/worlds/sc2/options.py @@ -149,7 +149,7 @@ class MaximumCampaignSize(Range): """ display_name = "Maximum Campaign Size" range_start = 1 - range_end = 85 + range_end = 89 default = 83 @@ -263,15 +263,16 @@ class EnableNCOMissions(DefaultOnToggle): class EnableRaceSwapVariants(Choice): """ Allow mission variants where you play a faction other than the one the map was initially - designed for. + designed for. NOTE: Cutscenes are always skipped on race-swapped mission variants. Disabled: Don't shuffle any non-vanilla map variants into the pool. - Pick One: Only allow one version of each map at a time Shuffle All: Each version of a map can appear in the same pool (so a map can appear up to 3 times as different races) + ("Pick Just One At Random" coming soon) """ display_name = "Enable Race-Swapped Mission Variants" option_disabled = 0 - option_pick_one = 1 + # TODO: Implement pick-one logic + # option_pick_one = 1 option_shuffle_all = 2 default = option_disabled @@ -1012,7 +1013,7 @@ def get_enabled_campaigns(world: 'SC2World') -> Set[SC2Campaign]: enabled_campaigns.add(SC2Campaign.EPILOGUE) if get_option_value(world, "enable_nco_missions"): enabled_campaigns.add(SC2Campaign.NCO) - return set([campaign for campaign in enabled_campaigns if campaign.race in get_enabled_races(world)]) + return enabled_campaigns def get_disabled_campaigns(world: 'SC2World') -> Set[SC2Campaign]: @@ -1039,7 +1040,6 @@ def get_excluded_missions(world: 'SC2World') -> Set[SC2Mission]: excluded_mission_names = world.options.excluded_missions.value disabled_campaigns = get_disabled_campaigns(world) disabled_flags = get_disabled_flags(world) - just_one_variant = get_option_value(world, "enable_race_swap") == EnableRaceSwapVariants.option_pick_one excluded_missions: Set[SC2Mission] = set([lookup_name_to_mission[name] for name in excluded_mission_names]) @@ -1060,7 +1060,6 @@ def get_excluded_missions(world: 'SC2World') -> Set[SC2Mission]: # Omitting missions not in enabled campaigns for campaign in disabled_campaigns: excluded_missions = excluded_missions.union(campaign_mission_table[campaign]) - # TODO: if just_one_variant: return excluded_missions diff --git a/worlds/sc2/regions.py b/worlds/sc2/regions.py index e33c6232dd52..4fc8c20f4d8e 100644 --- a/worlds/sc2/regions.py +++ b/worlds/sc2/regions.py @@ -66,38 +66,38 @@ 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 (Terran)', lambda state: state.has("Beat Liberation Day", player)) - connect(world, names, 'The Outlaws', 'Zero Hour', - lambda state: state.has("Beat The Outlaws", player)) - connect(world, names, 'Zero Hour', 'Evacuation', - lambda state: state.has("Beat Zero Hour", player)) + connect(world, names, 'The Outlaws (Terran)', 'Zero Hour (Terran)', + lambda state: state.has("Beat The Outlaws (Terran)", player)) + connect(world, names, 'Zero Hour (Terran)', 'Evacuation', + lambda state: state.has("Beat Zero Hour (Terran)", player)) connect(world, names, 'Evacuation', 'Outbreak', lambda state: state.has("Beat Evacuation", player)) connect(world, names, "Outbreak", "Safe Haven", 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', - lambda state: state.has("Beat Zero Hour", player)) - connect(world, names, 'Smash and Grab', 'The Dig', - lambda state: wol_cleared_missions(state, 8) and state.has("Beat Smash and Grab", player)) + connect(world, names, 'Zero Hour (Terran)', 'Smash and Grab (Terran)', + lambda state: state.has("Beat Zero Hour (Terran)", player)) + connect(world, names, 'Smash and Grab (Terran)', 'The Dig', + lambda state: wol_cleared_missions(state, 8) and state.has("Beat Smash and Grab (Terran)", player)) connect(world, names, 'The Dig', 'The Moebius Factor', lambda state: wol_cleared_missions(state, 11) and state.has("Beat The Dig", player)) connect(world, names, 'The Moebius Factor', 'Supernova', 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", - lambda state: wol_cleared_missions(state, 4) and state.has("Beat Zero Hour", player)) + connect(world, names, 'Zero Hour (Terran)', "Devil's Playground", + lambda state: wol_cleared_missions(state, 4) and state.has("Beat Zero Hour (Terran)", player)) connect(world, names, "Devil's Playground", 'Welcome to the Jungle', lambda state: state.has("Beat Devil's Playground", player)) connect(world, names, "Welcome to the Jungle", 'Breakout', 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', - lambda state: wol_cleared_missions(state, 6) and state.has("Beat Zero Hour", player)) + connect(world, names, "Zero Hour (Terran)", 'The Great Train Robbery', + lambda state: wol_cleared_missions(state, 6) and state.has("Beat Zero Hour (Terran)", player)) connect(world, names, 'The Great Train Robbery', 'Cutthroat', lambda state: state.has("Beat The Great Train Robbery", player)) connect(world, names, 'Cutthroat', 'Engine of Destruction', diff --git a/worlds/sc2/rules.py b/worlds/sc2/rules.py index c8d30b1cf852..cdc7dd6011eb 100644 --- a/worlds/sc2/rules.py +++ b/worlds/sc2/rules.py @@ -939,7 +939,7 @@ def __init__(self, world: 'SC2World'): self.advanced_tactics = self.logic_level != RequiredTactics.option_standard self.take_over_ai_allies = get_option_value(world, "take_over_ai_allies") == TakeOverAIAllies.option_true self.kerrigan_unit_available = get_option_value(world, 'kerrigan_presence') in kerrigan_unit_available \ - and SC2Campaign.HOTS in get_enabled_campaigns(world) + and SC2Campaign.HOTS in get_enabled_campaigns(world) and SC2Race.ZERG in get_enabled_races(world) self.kerrigan_levels_per_mission_completed = get_option_value(world, "kerrigan_levels_per_mission_completed") self.kerrigan_levels_per_mission_completed_cap = get_option_value(world, "kerrigan_levels_per_mission_completed_cap") self.kerrigan_total_level_cap = get_option_value(world, "kerrigan_total_level_cap") diff --git a/worlds/sc2/test/test_usecases.py b/worlds/sc2/test/test_usecases.py index adea595fe595..664f6af430ef 100644 --- a/worlds/sc2/test/test_usecases.py +++ b/worlds/sc2/test/test_usecases.py @@ -220,7 +220,8 @@ def test_excluding_zerg_excludes_campaigns_and_items(self) -> None: for item_name in world_item_names: self.assertNotEqual(items.item_table[item_name].race, mission_tables.SC2Race.ZERG, f"{item_name} is a ZERG item!") - for region in world_regions: + # have to manually exclude the only non-zerg HotS mission... + for region in filter(lambda region: region != "With Friends Like These", world_regions): self.assertNotIn(mission_tables.lookup_name_to_mission[region].campaign, ([mission_tables.SC2Campaign.HOTS]), f"{region} is a ZERG mission!")