Core: remove bad hardcoded behavior around plando_connections (#2170)
This commit is contained in:
		
							parent
							
								
									57fcd57a85
								
							
						
					
					
						commit
						86a7ac466e
					
				
							
								
								
									
										35
									
								
								Generate.py
								
								
								
								
							
							
						
						
									
										35
									
								
								Generate.py
								
								
								
								
							| 
						 | 
					@ -462,20 +462,18 @@ def roll_settings(weights: dict, plando_options: PlandoOptions = PlandoOptions.b
 | 
				
			||||||
        handle_option(ret, game_weights, option_key, option, plando_options)
 | 
					        handle_option(ret, game_weights, option_key, option, plando_options)
 | 
				
			||||||
    if PlandoOptions.items in plando_options:
 | 
					    if PlandoOptions.items in plando_options:
 | 
				
			||||||
        ret.plando_items = game_weights.get("plando_items", [])
 | 
					        ret.plando_items = game_weights.get("plando_items", [])
 | 
				
			||||||
    if ret.game == "Minecraft" or ret.game == "Ocarina of Time":
 | 
					    if ret.game == "A Link to the Past":
 | 
				
			||||||
        # bad hardcoded behavior to make this work for now
 | 
					 | 
				
			||||||
        ret.plando_connections = []
 | 
					 | 
				
			||||||
        if PlandoOptions.connections in plando_options:
 | 
					 | 
				
			||||||
            options = game_weights.get("plando_connections", [])
 | 
					 | 
				
			||||||
            for placement in options:
 | 
					 | 
				
			||||||
                if roll_percentage(get_choice("percentage", placement, 100)):
 | 
					 | 
				
			||||||
                    ret.plando_connections.append(PlandoConnection(
 | 
					 | 
				
			||||||
                        get_choice("entrance", placement),
 | 
					 | 
				
			||||||
                        get_choice("exit", placement),
 | 
					 | 
				
			||||||
                        get_choice("direction", placement)
 | 
					 | 
				
			||||||
                    ))
 | 
					 | 
				
			||||||
    elif ret.game == "A Link to the Past":
 | 
					 | 
				
			||||||
        roll_alttp_settings(ret, game_weights, plando_options)
 | 
					        roll_alttp_settings(ret, game_weights, plando_options)
 | 
				
			||||||
 | 
					    if PlandoOptions.connections in plando_options:
 | 
				
			||||||
 | 
					        ret.plando_connections = []
 | 
				
			||||||
 | 
					        options = game_weights.get("plando_connections", [])
 | 
				
			||||||
 | 
					        for placement in options:
 | 
				
			||||||
 | 
					            if roll_percentage(get_choice("percentage", placement, 100)):
 | 
				
			||||||
 | 
					                ret.plando_connections.append(PlandoConnection(
 | 
				
			||||||
 | 
					                    get_choice("entrance", placement),
 | 
				
			||||||
 | 
					                    get_choice("exit", placement),
 | 
				
			||||||
 | 
					                    get_choice("direction", placement, "both")
 | 
				
			||||||
 | 
					                ))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return ret
 | 
					    return ret
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -494,17 +492,6 @@ def roll_alttp_settings(ret: argparse.Namespace, weights, plando_options):
 | 
				
			||||||
                    raise Exception(f"No text target \"{at}\" found.")
 | 
					                    raise Exception(f"No text target \"{at}\" found.")
 | 
				
			||||||
                ret.plando_texts[at] = str(get_choice_legacy("text", placement))
 | 
					                ret.plando_texts[at] = str(get_choice_legacy("text", placement))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ret.plando_connections = []
 | 
					 | 
				
			||||||
    if PlandoOptions.connections in plando_options:
 | 
					 | 
				
			||||||
        options = weights.get("plando_connections", [])
 | 
					 | 
				
			||||||
        for placement in options:
 | 
					 | 
				
			||||||
            if roll_percentage(get_choice_legacy("percentage", placement, 100)):
 | 
					 | 
				
			||||||
                ret.plando_connections.append(PlandoConnection(
 | 
					 | 
				
			||||||
                    get_choice_legacy("entrance", placement),
 | 
					 | 
				
			||||||
                    get_choice_legacy("exit", placement),
 | 
					 | 
				
			||||||
                    get_choice_legacy("direction", placement, "both")
 | 
					 | 
				
			||||||
                ))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ret.sprite_pool = weights.get('sprite_pool', [])
 | 
					    ret.sprite_pool = weights.get('sprite_pool', [])
 | 
				
			||||||
    ret.sprite = get_choice_legacy('sprite', weights, "Link")
 | 
					    ret.sprite = get_choice_legacy('sprite', weights, "Link")
 | 
				
			||||||
    if 'random_sprite_on_event' in weights:
 | 
					    if 'random_sprite_on_event' in weights:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -171,16 +171,16 @@ relevant guide: [A Link to the Past Plando Guide](/tutorial/A%20Link%20to%20the%
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Connections Plando
 | 
					## Connections Plando
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This is currently only supported by Minecraft and A Link to the Past. As the way that these games interact with their
 | 
					This is currently only supported by a few games, including A Link to the Past, Minecraft, and Ocarina of Time. As the way that these games interact with their
 | 
				
			||||||
connections is different, I will only explain the basics here, while more specifics for A Link to the Past connection
 | 
					connections is different, only the basics are explained here. More specific information for connection plando in A Link to the Past can be found in 
 | 
				
			||||||
plando can be found in its plando guide.
 | 
					its [plando guide](/tutorial/A%20Link%20to%20the%20Past/plando/en#connections).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* The options for connections are `percentage`, `entrance`, `exit`, and `direction`. Each of these options supports
 | 
					* The options for connections are `percentage`, `entrance`, `exit`, and `direction`. Each of these options supports
 | 
				
			||||||
  subweights.
 | 
					  subweights.
 | 
				
			||||||
* `percentage` is the percentage chance for this connection from 0 to 100 and defaults to 100.
 | 
					* `percentage` is the percentage chance for this connection from 0 to 100 and defaults to 100.
 | 
				
			||||||
* Every connection has an `entrance` and an `exit`. These can be unlinked like in A Link to the Past insanity entrance
 | 
					* Every connection has an `entrance` and an `exit`. These can be unlinked like in A Link to the Past insanity entrance
 | 
				
			||||||
  shuffle.
 | 
					  shuffle.
 | 
				
			||||||
* `direction` can be `both`, `entrance`, or `exit` and determines in which direction this connection will operate.
 | 
					* `direction` can be `both`, `entrance`, or `exit` and determines in which direction this connection will operate. `direction` defaults to `both`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[A Link to the Past connections](https://github.com/ArchipelagoMW/Archipelago/blob/main/worlds/alttp/EntranceShuffle.py#L3852)
 | 
					[A Link to the Past connections](https://github.com/ArchipelagoMW/Archipelago/blob/main/worlds/alttp/EntranceShuffle.py#L3852)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue