Skip to content

Commit

Permalink
Merge branch 'sc2-fix-goal-non-determinism' into sc2-next
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziktofel committed Apr 9, 2024
2 parents ba4cc9d + 430f0c7 commit dd6a14e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions worlds/sc2/PoolFilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def filter_missions(world: World) -> Dict[MissionPools, List[SC2Mission]]:
# Vanilla uses the entire mission pool
goal_priorities: Dict[SC2Campaign, SC2CampaignGoalPriority] = {campaign: get_campaign_goal_priority(campaign) for campaign in enabled_campaigns}
goal_level = max(goal_priorities.values())
candidate_campaigns = [campaign for campaign, goal_priority in goal_priorities.items() if goal_priority == goal_level]
candidate_campaigns: List[SC2Campaign] = [campaign for campaign, goal_priority in goal_priorities.items() if goal_priority == goal_level]
candidate_campaigns.sort(key=lambda it: it.id)
goal_campaign = world.random.choice(candidate_campaigns)
if campaign_final_mission_locations[goal_campaign] is not None:
mission_pools[MissionPools.FINAL] = [campaign_final_mission_locations[goal_campaign].mission]
Expand All @@ -70,7 +71,8 @@ def filter_missions(world: World) -> Dict[MissionPools, List[SC2Mission]]:
# Finding the goal map
goal_priorities = {campaign: get_campaign_goal_priority(campaign, excluded_missions) for campaign in enabled_campaigns}
goal_level = max(goal_priorities.values())
candidate_campaigns = [campaign for campaign, goal_priority in goal_priorities.items() if goal_priority == goal_level]
candidate_campaigns: List[SC2Campaign] = [campaign for campaign, goal_priority in goal_priorities.items() if goal_priority == goal_level]
candidate_campaigns.sort(key=lambda it: it.id)
goal_campaign = world.random.choice(candidate_campaigns)
primary_goal = campaign_final_mission_locations[goal_campaign]
if primary_goal is None or primary_goal.mission in excluded_missions:
Expand Down

0 comments on commit dd6a14e

Please sign in to comment.