mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-03-30 09:13:23 -07:00
Fix a bug with seed group, continue changing fixed shop to entrance layout
This commit is contained in:
@@ -9,9 +9,9 @@ from .regions import tunic_regions
|
||||
from .er_scripts import create_er_regions
|
||||
from .er_data import portal_mapping
|
||||
from .options import (TunicOptions, EntranceRando, tunic_option_groups, tunic_option_presets, TunicPlandoConnections,
|
||||
LaurelsLocation)
|
||||
LaurelsLocation, EntranceLayout)
|
||||
from worlds.AutoWorld import WebWorld, World
|
||||
from Options import PlandoConnection
|
||||
from Options import PlandoConnection, OptionError
|
||||
from decimal import Decimal, ROUND_HALF_UP
|
||||
from settings import Group, Bool
|
||||
|
||||
@@ -53,7 +53,7 @@ class SeedGroup(TypedDict):
|
||||
ice_grappling: int # ice_grappling value
|
||||
ladder_storage: int # ls value
|
||||
laurels_at_10_fairies: bool # laurels location value
|
||||
fixed_shop: bool # fixed shop value
|
||||
entrance_layout: int # entrance layout value
|
||||
plando: TunicPlandoConnections # consolidated plando connections for the seed group
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ class TunicWorld(World):
|
||||
ice_grappling=tunic.options.ice_grappling.value,
|
||||
ladder_storage=tunic.options.ladder_storage.value,
|
||||
laurels_at_10_fairies=tunic.options.laurels_location == LaurelsLocation.option_10_fairies,
|
||||
fixed_shop=bool(tunic.options.fixed_shop),
|
||||
entrance_layout=tunic.options.entrance_layout.value,
|
||||
plando=multiworld.plando_connections[tunic.player])
|
||||
continue
|
||||
|
||||
@@ -148,9 +148,14 @@ class TunicWorld(World):
|
||||
if tunic.options.laurels_location == 3:
|
||||
cls.seed_groups[group]["laurels_at_10_fairies"] = True
|
||||
# more restrictive, overrides the option for others in the same group, which is better than failing imo
|
||||
if tunic.options.fixed_shop:
|
||||
cls.seed_groups[group]["fixed_shop"] = True
|
||||
if tunic.options.entrance_layout:
|
||||
if cls.seed_groups[group]["entrance_layout"] == EntranceLayout.option_standard:
|
||||
cls.seed_groups[group]["entrance_layout"] = tunic.options.entrance_layout.value
|
||||
elif cls.seed_groups[group]["entrance_layout"] != tunic.options.entrance_layout.value:
|
||||
raise OptionError(f"TUNIC: Conflict between seed group {group}'s Entrance Layout options. "
|
||||
f"Seed group cannot have both Fixed Shop and Direction Pairs enabled.")
|
||||
|
||||
# todo: make it break if you don't have matching portal directions with direction pairs on
|
||||
if multiworld.plando_connections[tunic.player]:
|
||||
# loop through the connections in the player's yaml
|
||||
for cxn in multiworld.plando_connections[tunic.player]:
|
||||
@@ -170,10 +175,10 @@ class TunicWorld(World):
|
||||
or cxn.exit == group_cxn.exit and cxn.entrance != group_cxn.entrance
|
||||
)
|
||||
if is_mismatched:
|
||||
raise Exception(f"TUNIC: Conflict between seed group {group}'s plando "
|
||||
f"connection {group_cxn.entrance} <-> {group_cxn.exit} and "
|
||||
f"{tunic.multiworld.get_player_name(tunic.player)}'s plando "
|
||||
f"connection {cxn.entrance} <-> {cxn.exit}")
|
||||
raise OptionError(f"TUNIC: Conflict between seed group {group}'s plando "
|
||||
f"connection {group_cxn.entrance} <-> {group_cxn.exit} and "
|
||||
f"{tunic.multiworld.get_player_name(tunic.player)}'s plando "
|
||||
f"connection {cxn.entrance} <-> {cxn.exit}")
|
||||
if new_cxn:
|
||||
cls.seed_groups[group]["plando"].value.append(cxn)
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from .locations import location_table
|
||||
from .er_data import Portal, tunic_er_regions, portal_mapping, traversal_requirements, DeadEnd
|
||||
from .er_rules import set_er_region_rules
|
||||
from Options import PlandoConnection
|
||||
from .options import EntranceRando
|
||||
from .options import EntranceRando, EntranceLayout
|
||||
from random import Random
|
||||
from copy import deepcopy
|
||||
|
||||
@@ -26,8 +26,13 @@ def create_er_regions(world: "TunicWorld") -> Dict[Portal, Portal]:
|
||||
if world.options.entrance_rando:
|
||||
for region_name, region_data in tunic_er_regions.items():
|
||||
# if fewer shops is off, zig skip is not made
|
||||
if region_name == "Zig Skip Exit" and not world.options.fixed_shop:
|
||||
continue
|
||||
if region_name == "Zig Skip Exit":
|
||||
# need to check if there's a seed group for this first
|
||||
if world.options.entrance_rando.value not in EntranceRando.options.values():
|
||||
if world.seed_groups[world.options.entrance_rando.value]["entrance_layout"] != EntranceLayout.option_fixed_shop:
|
||||
continue
|
||||
elif world.options.entrance_layout != EntranceLayout.option_fixed_shop:
|
||||
continue
|
||||
regions[region_name] = Region(region_name, world.player, world.multiworld)
|
||||
|
||||
portal_pairs = pair_portals(world, regions)
|
||||
@@ -152,7 +157,7 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
|
||||
laurels_zips = world.options.laurels_zips.value
|
||||
ice_grappling = world.options.ice_grappling.value
|
||||
ladder_storage = world.options.ladder_storage.value
|
||||
fixed_shop = world.options.fixed_shop
|
||||
entrance_layout = world.options.entrance_layout
|
||||
laurels_location = world.options.laurels_location
|
||||
traversal_reqs = deepcopy(traversal_requirements)
|
||||
has_laurels = True
|
||||
@@ -164,7 +169,7 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
|
||||
laurels_zips = seed_group["laurels_zips"]
|
||||
ice_grappling = seed_group["ice_grappling"]
|
||||
ladder_storage = seed_group["ladder_storage"]
|
||||
fixed_shop = seed_group["fixed_shop"]
|
||||
entrance_layout = seed_group["entrance_layout"]
|
||||
laurels_location = "10_fairies" if seed_group["laurels_at_10_fairies"] is True else False
|
||||
|
||||
logic_tricks: Tuple[bool, int, int] = (laurels_zips, ice_grappling, ladder_storage)
|
||||
@@ -176,7 +181,7 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
|
||||
# need to keep track of which scenes have shops, since you shouldn't have multiple shops connected to the same scene
|
||||
shop_scenes: Set[str] = set()
|
||||
shop_count = 6
|
||||
if fixed_shop:
|
||||
if entrance_layout == EntranceLayout.option_fixed_shop:
|
||||
shop_count = 0
|
||||
shop_scenes.add("Overworld Redux")
|
||||
else:
|
||||
@@ -185,6 +190,9 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
|
||||
if portal.region == "Zig Skip Exit":
|
||||
portal_map.remove(portal)
|
||||
break
|
||||
# need 8 shops with direction pairs or there won't be a valid set of pairs
|
||||
if entrance_layout == EntranceLayout.option_direction_pairs:
|
||||
shop_count = 8
|
||||
|
||||
# If using Universal Tracker, restore portal_map. Could be cleaner, but it does not matter for UT even a little bit
|
||||
if hasattr(world.multiworld, "re_gen_passthrough"):
|
||||
@@ -211,7 +219,7 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
|
||||
else:
|
||||
dead_ends.append(portal)
|
||||
if portal.region == "Zig Skip Exit":
|
||||
if fixed_shop:
|
||||
if entrance_layout == EntranceLayout.option_fixed_shop:
|
||||
two_plus.append(portal)
|
||||
else:
|
||||
dead_ends.append(portal)
|
||||
@@ -258,7 +266,7 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
|
||||
# secret gathering place and zig skip get weird, special handling
|
||||
elif region_info.dead_end == DeadEnd.special:
|
||||
if (region_name == "Secret Gathering Place" and laurels_location == "10_fairies") \
|
||||
or (region_name == "Zig Skip Exit" and fixed_shop):
|
||||
or (region_name == "Zig Skip Exit" and entrance_layout == EntranceLayout.option_fixed_shop):
|
||||
non_dead_end_regions.add(region_name)
|
||||
|
||||
if plando_connections:
|
||||
@@ -362,15 +370,15 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
|
||||
# if we have plando connections, our connected regions may change somewhat
|
||||
connected_regions = update_reachable_regions(connected_regions, traversal_reqs, has_laurels, logic_tricks)
|
||||
|
||||
if fixed_shop and not hasattr(world.multiworld, "re_gen_passthrough"):
|
||||
if entrance_layout == EntranceLayout.option_fixed_shop and not hasattr(world.multiworld, "re_gen_passthrough"):
|
||||
portal1 = None
|
||||
for portal in two_plus:
|
||||
if portal.scene_destination() == "Overworld Redux, Windmill_":
|
||||
portal1 = portal
|
||||
break
|
||||
if not portal1:
|
||||
raise Exception(f"Failed to do Fixed Shop option. "
|
||||
f"Did {player_name} plando connection the Windmill Shop entrance?")
|
||||
raise Exception(f"Failed to do Fixed Shop option for Entrance Layout. "
|
||||
f"Did {player_name} plando the Windmill Shop entrance?")
|
||||
|
||||
portal2 = Portal(name=f"Shop Portal {world.shop_num}", region=f"Shop {world.shop_num}",
|
||||
destination="Previous Region", tag="_")
|
||||
|
||||
@@ -271,6 +271,7 @@ class TunicOptions(PerGameCommonOptions):
|
||||
ability_shuffling: AbilityShuffling
|
||||
shuffle_ladders: ShuffleLadders
|
||||
entrance_rando: EntranceRando
|
||||
entrance_layout: EntranceLayout
|
||||
plando_connections: TunicPlandoConnections
|
||||
fool_traps: FoolTraps
|
||||
hexagon_quest: HexagonQuest
|
||||
@@ -286,7 +287,7 @@ class TunicOptions(PerGameCommonOptions):
|
||||
ladder_storage_without_items: LadderStorageWithoutItems
|
||||
|
||||
fixed_shop: FixedShop
|
||||
logic_rules: Removed
|
||||
logic_rules: Removed # fully removed in the direction pairs update
|
||||
|
||||
|
||||
tunic_option_groups = [
|
||||
|
||||
Reference in New Issue
Block a user