From fb5c9bd28b973a989a795ac2518b843be78bb350 Mon Sep 17 00:00:00 2001 From: Ziktofel Date: Mon, 25 Nov 2024 22:26:49 +0100 Subject: [PATCH] Add Brothers in Arms race swaps --- worlds/sc2/locations.py | 50 +++++++++++++++++++++++++++++++++--- worlds/sc2/mission_tables.py | 5 ++-- worlds/sc2/rules.py | 37 ++++++++++++++++++++++++-- 3 files changed, 85 insertions(+), 7 deletions(-) diff --git a/worlds/sc2/locations.py b/worlds/sc2/locations.py index c67dc4003806..62bf95cbc633 100644 --- a/worlds/sc2/locations.py +++ b/worlds/sc2/locations.py @@ -1692,14 +1692,14 @@ def get_locations(world: Optional['SC2World']) -> Tuple[LocationData, ...]: logic.protoss_common_unit_basic_aa ), make_location_data(SC2Mission.BROTHERS_IN_ARMS.mission_name, "Victory", SC2LOTV_LOC_ID_OFFSET + 800, LocationType.VICTORY, - logic.brothers_in_arms_requirement + logic.protoss_brothers_in_arms_requirement ), make_location_data(SC2Mission.BROTHERS_IN_ARMS.mission_name, "Mid Science Facility", SC2LOTV_LOC_ID_OFFSET + 801, LocationType.VANILLA, lambda state: logic.protoss_common_unit(state) or logic.take_over_ai_allies ), make_location_data(SC2Mission.BROTHERS_IN_ARMS.mission_name, "North Science Facility", SC2LOTV_LOC_ID_OFFSET + 802, LocationType.VANILLA, lambda state: ( - logic.brothers_in_arms_requirement(state) + logic.protoss_brothers_in_arms_requirement(state) or ( logic.take_over_ai_allies and logic.advanced_tactics @@ -1710,7 +1710,7 @@ def get_locations(world: Optional['SC2World']) -> Tuple[LocationData, ...]: )) ), make_location_data(SC2Mission.BROTHERS_IN_ARMS.mission_name, "South Science Facility", SC2LOTV_LOC_ID_OFFSET + 803, LocationType.VANILLA, - logic.brothers_in_arms_requirement + logic.protoss_brothers_in_arms_requirement ), make_location_data(SC2Mission.AMON_S_REACH.mission_name, "Victory", SC2LOTV_LOC_ID_OFFSET + 900, LocationType.VICTORY, logic.protoss_common_unit_anti_light_air @@ -4688,6 +4688,50 @@ def get_locations(world: Optional['SC2World']) -> Tuple[LocationData, ...]: make_location_data(SC2Mission.SKY_SHIELD_Z.mission_name, "East Raynor Base", SC2_RACESWAP_LOC_ID_OFFSET + 11210, LocationType.EXTRA, logic.zerg_competent_comp_competent_aa ), + make_location_data(SC2Mission.BROTHERS_IN_ARMS_T.mission_name, "Victory", SC2_RACESWAP_LOC_ID_OFFSET + 11300, LocationType.VICTORY, + lambda state: ( + logic.terran_common_unit(state) + and logic.terran_beats_protoss_deathball(state) + )), + make_location_data(SC2Mission.BROTHERS_IN_ARMS_T.mission_name, "Mid Science Facility", SC2_RACESWAP_LOC_ID_OFFSET + 11301, LocationType.VANILLA, + lambda state: logic.terran_common_unit(state) or logic.take_over_ai_allies + ), + make_location_data(SC2Mission.BROTHERS_IN_ARMS_T.mission_name, "North Science Facility", SC2_RACESWAP_LOC_ID_OFFSET + 11302, LocationType.VANILLA, + lambda state: ( + logic.terran_common_unit(state) + and logic.terran_beats_protoss_deathball(state) + or ( + logic.take_over_ai_allies + and logic.advanced_tactics + and logic.terran_common_unit(state) + )) + ), + make_location_data(SC2Mission.BROTHERS_IN_ARMS_T.mission_name, "South Science Facility", SC2_RACESWAP_LOC_ID_OFFSET + 11303, LocationType.VANILLA, + lambda state: ( + logic.terran_common_unit(state) + and logic.terran_beats_protoss_deathball(state) + )), + make_location_data(SC2Mission.BROTHERS_IN_ARMS_Z.mission_name, "Victory", SC2_RACESWAP_LOC_ID_OFFSET + 11400, LocationType.VICTORY, + logic.zerg_brothers_in_arms_requirement + ), + make_location_data(SC2Mission.BROTHERS_IN_ARMS_Z.mission_name, "Mid Science Facility", SC2_RACESWAP_LOC_ID_OFFSET + 11401, LocationType.VANILLA, + lambda state: logic.zerg_common_unit(state) or logic.take_over_ai_allies + ), + make_location_data(SC2Mission.BROTHERS_IN_ARMS_Z.mission_name, "North Science Facility", SC2_RACESWAP_LOC_ID_OFFSET + 11402, LocationType.VANILLA, + lambda state: ( + logic.zerg_brothers_in_arms_requirement(state) + or ( + logic.take_over_ai_allies + and logic.advanced_tactics + and ( + logic.zerg_common_unit(state) + or logic.terran_common_unit(state) + ) + )) + ), + make_location_data(SC2Mission.BROTHERS_IN_ARMS_Z.mission_name, "South Science Facility", SC2_RACESWAP_LOC_ID_OFFSET + 11403, LocationType.VANILLA, + logic.zerg_brothers_in_arms_requirement + ), ] beat_events = [] diff --git a/worlds/sc2/mission_tables.py b/worlds/sc2/mission_tables.py index 8625608d4bb6..bd94d1698ebc 100644 --- a/worlds/sc2/mission_tables.py +++ b/worlds/sc2/mission_tables.py @@ -164,7 +164,7 @@ def __init__(self, mission_id: int, name: str, campaign: SC2Campaign, area: str, THE_GROWING_SHADOW = 54, "The Growing Shadow (Protoss)", SC2Campaign.LOTV, "Aiur", SC2Race.PROTOSS, MissionPools.EASY, "ap_the_growing_shadow", MissionFlag.Protoss|MissionFlag.VsPZ|MissionFlag.HasRaceSwap THE_SPEAR_OF_ADUN = 55, "The Spear of Adun (Protoss)", SC2Campaign.LOTV, "Aiur", SC2Race.PROTOSS, MissionPools.EASY, "ap_the_spear_of_adun", MissionFlag.Protoss|MissionFlag.VanillaSoa|MissionFlag.VsPZ|MissionFlag.HasRaceSwap SKY_SHIELD = 56, "Sky Shield (Protoss)", SC2Campaign.LOTV, "Korhal", SC2Race.PROTOSS, MissionPools.EASY, "ap_sky_shield", MissionFlag.Protoss|MissionFlag.VanillaSoa|MissionFlag.Countdown|MissionFlag.VsTerran|MissionFlag.AiTerranAlly|MissionFlag.HasRaceSwap - BROTHERS_IN_ARMS = 57, "Brothers in Arms", SC2Campaign.LOTV, "Korhal", SC2Race.PROTOSS, MissionPools.MEDIUM, "ap_brothers_in_arms", MissionFlag.Protoss|MissionFlag.VanillaSoa|MissionFlag.VsTerran|MissionFlag.AiTerranAlly + BROTHERS_IN_ARMS = 57, "Brothers in Arms (Protoss)", SC2Campaign.LOTV, "Korhal", SC2Race.PROTOSS, MissionPools.MEDIUM, "ap_brothers_in_arms", MissionFlag.Protoss|MissionFlag.VanillaSoa|MissionFlag.VsTerran|MissionFlag.AiTerranAlly|MissionFlag.HasRaceSwap AMON_S_REACH = 58, "Amon's Reach", SC2Campaign.LOTV, "Shakuras", SC2Race.PROTOSS, MissionPools.EASY, "ap_amon_s_reach", MissionFlag.Protoss|MissionFlag.VanillaSoa|MissionFlag.VsZerg LAST_STAND = 59, "Last Stand", SC2Campaign.LOTV, "Shakuras", SC2Race.PROTOSS, MissionPools.HARD, "ap_last_stand", MissionFlag.Protoss|MissionFlag.VanillaSoa|MissionFlag.TimedDefense|MissionFlag.VsZerg FORBIDDEN_WEAPON = 60, "Forbidden Weapon", SC2Campaign.LOTV, "Purifier", SC2Race.PROTOSS, MissionPools.MEDIUM, "ap_forbidden_weapon", MissionFlag.Protoss|MissionFlag.VanillaSoa|MissionFlag.Countdown|MissionFlag.VsProtoss @@ -290,7 +290,8 @@ def __init__(self, mission_id: int, name: str, campaign: SC2Campaign, area: str, THE_SPEAR_OF_ADUN_Z = 193, "The Spear of Adun (Zerg)", SC2Campaign.LOTV, "Aiur", SC2Race.ZERG, MissionPools.MEDIUM, "ap_the_spear_of_adun", MissionFlag.Zerg|MissionFlag.VsPZ|MissionFlag.RaceSwap SKY_SHIELD_T = 194, "Sky Shield (Terran)", SC2Campaign.LOTV, "Korhal", SC2Race.TERRAN, MissionPools.EASY, "ap_sky_shield", MissionFlag.Terran|MissionFlag.Countdown|MissionFlag.VsTerran|MissionFlag.AiTerranAlly|MissionFlag.RaceSwap SKY_SHIELD_Z = 195, "Sky Shield (Zerg)", SC2Campaign.LOTV, "Korhal", SC2Race.ZERG, MissionPools.MEDIUM, "ap_sky_shield", MissionFlag.Zerg|MissionFlag.Countdown|MissionFlag.VsTerran|MissionFlag.AiTerranAlly|MissionFlag.RaceSwap - # 196/197 - Brothers in Arms + BROTHERS_IN_ARMS_T = 196, "Brothers in Arms (Terran)", SC2Campaign.LOTV, "Korhal", SC2Race.TERRAN, MissionPools.MEDIUM, "ap_brothers_in_arms", MissionFlag.Terran|MissionFlag.VsTerran|MissionFlag.AiTerranAlly|MissionFlag.RaceSwap + BROTHERS_IN_ARMS_Z = 197, "Brothers in Arms (Zerg)", SC2Campaign.LOTV, "Korhal", SC2Race.ZERG, MissionPools.MEDIUM, "ap_brothers_in_arms", MissionFlag.Zerg|MissionFlag.VsTerran|MissionFlag.AiTerranAlly|MissionFlag.RaceSwap # 198/199 - Amon's Reach # 200/201 - Last Stand # 202/203 - Forbidden Weapon diff --git a/worlds/sc2/rules.py b/worlds/sc2/rules.py index e1a0317ba340..f8bed161a254 100644 --- a/worlds/sc2/rules.py +++ b/worlds/sc2/rules.py @@ -1496,7 +1496,7 @@ def terran_spear_of_adun_requirement(self, state: CollectionState) -> bool: and self.terran_defense_rating(state, True, False) >= 5 ) - def brothers_in_arms_requirement(self, state: CollectionState) -> bool: + def protoss_brothers_in_arms_requirement(self, state: CollectionState) -> bool: return ( self.protoss_common_unit(state) and self.protoss_anti_armor_anti_air(state) @@ -1514,7 +1514,10 @@ def brothers_in_arms_requirement(self, state: CollectionState) -> bool: and ( self.protoss_hybrid_counter(state) or state.has_any({item_names.BATTLECRUISER, item_names.LIBERATOR, item_names.SIEGE_TANK}, self.player) - or state.has_all({item_names.SPECTRE, item_names.SPECTRE_PSIONIC_LASH}, self.player) + or ( + self.advanced_tactics + and state.has_all({item_names.SPECTRE, item_names.SPECTRE_PSIONIC_LASH}, self.player) + ) or (state.has(item_names.IMMORTAL, self.player) and state.has_any({item_names.MARINE, item_names.DOMINION_TROOPER, item_names.MARAUDER}, self.player) and self.terran_bio_heal(state) @@ -1522,6 +1525,36 @@ def brothers_in_arms_requirement(self, state: CollectionState) -> bool: ) ) + def zerg_brothers_in_arms_requirement(self, state: CollectionState) -> bool: + return ( + self.zerg_common_unit(state) + and self.zerg_competent_comp(state) + and self.zerg_competent_anti_air(state) + and self.zerg_big_monsters(state) + ) or ( + self.take_over_ai_allies + and ( + self.zerg_common_unit(state) + or self.protoss_common_unit(state) + ) + and ( + self.terran_competent_anti_air(state) + or self.zerg_competent_anti_air(state) + ) + and ( + self.zerg_big_monsters(state) + or state.has_any({item_names.BATTLECRUISER, item_names.LIBERATOR, item_names.SIEGE_TANK}, self.player) + or ( + self.advanced_tactics + and state.has_all({item_names.SPECTRE, item_names.SPECTRE_PSIONIC_LASH}, self.player) + ) + or (state.has(item_names.ABERRATION, self.player) + and state.has_any({item_names.MARINE, item_names.DOMINION_TROOPER, item_names.MARAUDER}, self.player) + and self.terran_bio_heal(state) + ) + ) + ) + def protoss_hybrid_counter(self, state: CollectionState) -> bool: """ Ground Hybrids