SC2: Logic bugfixes (#5461)

* sc2: Fixing always-true rules in locations.py; fixed two over-constrained rules that put vanilla out-of-logic

* sc2: Minor min2() optimization in rules.py

* sc2: Fixing a Shatter the Sky logic bug where w/a upgrades were checked too many times and for the wrong units
This commit is contained in:
Phaneros
2025-09-21 09:54:22 -07:00
committed by GitHub
parent 3af1e92813
commit 7badc3e745
2 changed files with 88 additions and 90 deletions

View File

@@ -2150,8 +2150,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
"Victory",
SC2WOL_LOC_ID_OFFSET + 2800,
LocationType.VICTORY,
lambda state: logic.terran_competent_comp(state)
and logic.terran_army_weapon_armor_upgrade_min_level(state) >= 2,
lambda state: logic.terran_competent_comp(state, 2),
),
make_location_data(
SC2Mission.SHATTER_THE_SKY.mission_name,
@@ -2172,24 +2171,21 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
"Southeast Coolant Tower",
SC2WOL_LOC_ID_OFFSET + 2803,
LocationType.VANILLA,
lambda state: logic.terran_competent_comp(state)
and logic.terran_army_weapon_armor_upgrade_min_level(state) >= 2,
lambda state: logic.terran_competent_comp(state, 2),
),
make_location_data(
SC2Mission.SHATTER_THE_SKY.mission_name,
"Southwest Coolant Tower",
SC2WOL_LOC_ID_OFFSET + 2804,
LocationType.VANILLA,
lambda state: logic.terran_competent_comp(state)
and logic.terran_army_weapon_armor_upgrade_min_level(state) >= 2,
lambda state: logic.terran_competent_comp(state, 2),
),
make_location_data(
SC2Mission.SHATTER_THE_SKY.mission_name,
"Leviathan",
SC2WOL_LOC_ID_OFFSET + 2805,
LocationType.VANILLA,
lambda state: logic.terran_competent_comp(state)
and logic.terran_army_weapon_armor_upgrade_min_level(state) >= 2,
lambda state: logic.terran_competent_comp(state, 2),
hard_rule=logic.terran_any_anti_air,
),
make_location_data(
@@ -2262,7 +2258,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
SC2HOTS_LOC_ID_OFFSET + 100,
LocationType.VICTORY,
lambda state: (
logic.zerg_common_unit
logic.zerg_common_unit(state)
or state.has_any((item_names.ZERGLING, item_names.PYGALISK), player)
),
),
@@ -2279,7 +2275,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
LocationType.VANILLA,
lambda state: adv_tactics
or (
logic.zerg_common_unit
logic.zerg_common_unit(state)
or state.has_any((item_names.ZERGLING, item_names.PYGALISK), player)
),
),
@@ -2290,7 +2286,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
LocationType.VANILLA,
lambda state: adv_tactics
or (
logic.zerg_common_unit
logic.zerg_common_unit(state)
or state.has_any((item_names.ZERGLING, item_names.PYGALISK), player)
),
),
@@ -2301,7 +2297,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
LocationType.VANILLA,
lambda state: adv_tactics
or (
logic.zerg_common_unit
logic.zerg_common_unit(state)
or state.has_any((item_names.ZERGLING, item_names.PYGALISK), player)
),
),
@@ -2324,7 +2320,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
LocationType.EXTRA,
lambda state: adv_tactics
or (
logic.zerg_common_unit
logic.zerg_common_unit(state)
or state.has_any((item_names.ZERGLING, item_names.PYGALISK), player)
),
),
@@ -2334,7 +2330,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
SC2HOTS_LOC_ID_OFFSET + 108,
LocationType.CHALLENGE,
lambda state: (
logic.zerg_common_unit
logic.zerg_common_unit(state)
or state.has_any((item_names.ZERGLING, item_names.PYGALISK), player)
),
flags=LocationFlag.SPEEDRUN,
@@ -3862,15 +3858,11 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
SC2LOTV_LOC_ID_OFFSET + 300,
LocationType.VICTORY,
lambda state: adv_tactics
or state.count_from_list(
(
item_names.STALKER_PHASE_REACTOR,
item_names.STALKER_INSTIGATOR_SLAYER_DISINTEGRATING_PARTICLES,
item_names.STALKER_INSTIGATOR_SLAYER_PARTICLE_REFLECTION,
),
player,
)
>= 2,
or state.has_any((
item_names.STALKER_PHASE_REACTOR,
item_names.STALKER_INSTIGATOR_SLAYER_DISINTEGRATING_PARTICLES,
item_names.STALKER_INSTIGATOR_SLAYER_PARTICLE_REFLECTION,
), player),
),
make_location_data(
SC2Mission.EVIL_AWOKEN.mission_name,
@@ -4582,7 +4574,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
lambda state: (
logic.protoss_deathball(state)
and logic.protoss_power_rating(state) >= 6
and (adv_tactics or logic.protoss_fleet(state))
and (adv_tactics or logic.protoss_unsealing_the_past_ledge_requirement(state))
),
),
make_location_data(
@@ -4593,7 +4585,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
lambda state: (
logic.protoss_deathball(state)
and logic.protoss_power_rating(state) >= 6
and (adv_tactics or logic.protoss_fleet(state))
and (adv_tactics or logic.protoss_unsealing_the_past_ledge_requirement(state))
),
),
make_location_data(
@@ -7256,7 +7248,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
SC2_RACESWAP_LOC_ID_OFFSET + 1809,
LocationType.MASTERY,
lambda state: (
logic.protoss_anti_armor_anti_air
logic.protoss_anti_armor_anti_air(state)
and logic.protoss_defense_rating(state, False) >= 6
and logic.protoss_common_unit(state)
and logic.protoss_deathball(state)
@@ -9087,7 +9079,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
"Close Obelisk",
SC2_RACESWAP_LOC_ID_OFFSET + 4801,
LocationType.VANILLA,
lambda state: adv_tactics or logic.zerg_common_unit,
lambda state: adv_tactics or logic.zerg_common_unit(state),
),
make_location_data(
SC2Mission.ECHOES_OF_THE_FUTURE_Z.mission_name,
@@ -11841,7 +11833,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
"Victory",
SC2_RACESWAP_LOC_ID_OFFSET + 9600,
LocationType.VICTORY,
lambda state: logic.protoss_deathball
lambda state: logic.protoss_deathball(state)
or (adv_tactics and logic.protoss_competent_comp(state)),
),
make_location_data(
@@ -11876,7 +11868,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
"Main Path Command Center",
SC2_RACESWAP_LOC_ID_OFFSET + 9605,
LocationType.EXTRA,
lambda state: logic.protoss_deathball
lambda state: logic.protoss_deathball(state)
or (adv_tactics and logic.protoss_competent_comp(state)),
),
make_location_data(
@@ -12026,7 +12018,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
"Victory",
SC2_RACESWAP_LOC_ID_OFFSET + 10000,
LocationType.VICTORY,
lambda state: logic.zerg_competent_comp
lambda state: logic.zerg_competent_comp(state)
and logic.zerg_moderate_anti_air(state),
),
make_location_data(
@@ -12034,7 +12026,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
"First Prisoner Group",
SC2_RACESWAP_LOC_ID_OFFSET + 10001,
LocationType.VANILLA,
lambda state: logic.zerg_competent_comp
lambda state: logic.zerg_competent_comp(state)
and logic.zerg_moderate_anti_air(state),
),
make_location_data(
@@ -12042,7 +12034,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
"Second Prisoner Group",
SC2_RACESWAP_LOC_ID_OFFSET + 10002,
LocationType.VANILLA,
lambda state: logic.zerg_competent_comp
lambda state: logic.zerg_competent_comp(state)
and logic.zerg_moderate_anti_air(state),
),
make_location_data(
@@ -12050,7 +12042,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
"First Pylon",
SC2_RACESWAP_LOC_ID_OFFSET + 10003,
LocationType.VANILLA,
lambda state: logic.zerg_competent_comp
lambda state: logic.zerg_competent_comp(state)
and logic.zerg_moderate_anti_air(state),
),
make_location_data(
@@ -12058,7 +12050,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
"Second Pylon",
SC2_RACESWAP_LOC_ID_OFFSET + 10004,
LocationType.VANILLA,
lambda state: logic.zerg_competent_comp
lambda state: logic.zerg_competent_comp(state)
and logic.zerg_moderate_anti_air(state),
),
make_location_data(
@@ -12661,7 +12653,7 @@ def get_locations(world: Optional["SC2World"]) -> Tuple[LocationData, ...]:
SC2_RACESWAP_LOC_ID_OFFSET + 11406,
LocationType.CHALLENGE,
lambda state: (
logic.zerg_brothers_in_arms_requirement
logic.zerg_brothers_in_arms_requirement(state)
and logic.zerg_base_buster(state)
and logic.zerg_power_rating(state) >= 8
),