SC2: Changed All In to require either previous mission instead of both
This commit is contained in:
		
							parent
							
								
									8ce2ecfaac
								
							
						
					
					
						commit
						3b644a0af1
					
				|  | @ -378,6 +378,7 @@ class MissionInfo(typing.NamedTuple): | ||||||
|     extra_locations: int |     extra_locations: int | ||||||
|     required_world: list[int] |     required_world: list[int] | ||||||
|     number: int = 0  # number of worlds need beaten |     number: int = 0  # number of worlds need beaten | ||||||
|  |     or_requirements: bool = False  # true if the requirements should be or-ed instead of and-ed | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| mission_req_table = { | mission_req_table = { | ||||||
|  | @ -409,7 +410,7 @@ mission_req_table = { | ||||||
|     "Gates of Hell": MissionInfo(26, 2, [12]), |     "Gates of Hell": MissionInfo(26, 2, [12]), | ||||||
|     "Belly of the Beast": MissionInfo(27, 4, [26]), |     "Belly of the Beast": MissionInfo(27, 4, [26]), | ||||||
|     "Shatter the Sky": MissionInfo(28, 5, [26]), |     "Shatter the Sky": MissionInfo(28, 5, [26]), | ||||||
|     "All-In": MissionInfo(29, -1, [27, 28]) |     "All-In": MissionInfo(29, -1, [27, 28], or_requirements=True) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| lookup_id_to_mission: typing.Dict[int, str] = { | lookup_id_to_mission: typing.Dict[int, str] = { | ||||||
|  | @ -494,15 +495,46 @@ def calc_available_missions(locations_done, locations): | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def mission_reqs_completed(location_to_check, missions_complete, locations_done, locations): | def mission_reqs_completed(location_to_check, missions_complete, locations_done, locations): | ||||||
|     if len(locations[location_to_check].required_world) >= 1: |     """Returns a bool signifying if the mission has all requirements complete and can be done | ||||||
| 
 | 
 | ||||||
|  |     Keyword arguments: | ||||||
|  |     locations_to_check -- the mission string name to check | ||||||
|  |     missions_complete -- an int of how many missions have been completed | ||||||
|  |     locations_done -- a list of the location ids that have been complete | ||||||
|  |     locations -- a dict of MissionInfo for mission requirements for this world""" | ||||||
|  |     if len(locations[location_to_check].required_world) >= 1: | ||||||
|  |         # A check for when the requirements are being or'd | ||||||
|  |         or_success = False | ||||||
|  | 
 | ||||||
|  |         # Loop through required missions | ||||||
|         for req_mission in locations[location_to_check].required_world: |         for req_mission in locations[location_to_check].required_world: | ||||||
|  |             req_success = True | ||||||
|  | 
 | ||||||
|  |             # Check if required mission has been completed | ||||||
|             if not (req_mission * 100 + SC2WOL_LOC_ID_OFFSET) in locations_done: |             if not (req_mission * 100 + SC2WOL_LOC_ID_OFFSET) in locations_done: | ||||||
|  |                 if not locations[location_to_check].or_requirements: | ||||||
|                     return False |                     return False | ||||||
|  |                 else: | ||||||
|  |                     req_success = False | ||||||
|  | 
 | ||||||
|  |             # Recursively check required mission to see if it's requirements are met, in case !collect has been done | ||||||
|             if not mission_reqs_completed(lookup_id_to_mission[req_mission], missions_complete, locations_done, |             if not mission_reqs_completed(lookup_id_to_mission[req_mission], missions_complete, locations_done, | ||||||
|                                           locations): |                                           locations): | ||||||
|  |                 if not locations[location_to_check].or_requirements: | ||||||
|  |                     return False | ||||||
|  |                 else: | ||||||
|  |                     req_success = False | ||||||
|  | 
 | ||||||
|  |             # If requirement check succeeded mark or as satisfied | ||||||
|  |             if locations[location_to_check].or_requirements and req_success: | ||||||
|  |                 or_success = True | ||||||
|  | 
 | ||||||
|  |         if locations[location_to_check].or_requirements: | ||||||
|  |             # Return false if or requirements not met | ||||||
|  |             if not or_success: | ||||||
|                 return False |                 return False | ||||||
| 
 | 
 | ||||||
|  |         # Check number of missions | ||||||
|         if missions_complete >= locations[location_to_check].number: |         if missions_complete >= locations[location_to_check].number: | ||||||
|             return True |             return True | ||||||
|         else: |         else: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue