Separate OWG and HMG connection code
Split making HMG entrances and connecting them Correctly link IP lobby (not portal)
This commit is contained in:
22
Main.py
22
Main.py
@@ -27,7 +27,7 @@ from Fill import distribute_items_restrictive, promote_dungeon_items, fill_dunge
|
|||||||
from Fill import dungeon_tracking
|
from Fill import dungeon_tracking
|
||||||
from Fill import sell_potions, sell_keys, balance_multiworld_progression, balance_money_progression, lock_shop_locations
|
from Fill import sell_potions, sell_keys, balance_multiworld_progression, balance_money_progression, lock_shop_locations
|
||||||
from ItemList import generate_itempool, difficulties, fill_prizes, customize_shops, fill_specific_items
|
from ItemList import generate_itempool, difficulties, fill_prizes, customize_shops, fill_specific_items
|
||||||
from UnderworldGlitchRules import create_hybridmajor_connections, get_hybridmajor_connection_entrances
|
from UnderworldGlitchRules import connect_hmg_entrances_regions, create_hmg_entrances_regions
|
||||||
from Utils import output_path, parse_player_names
|
from Utils import output_path, parse_player_names
|
||||||
|
|
||||||
from source.item.FillUtil import create_item_pool_config, massage_item_pool, district_item_pool_config, verify_item_pool_config
|
from source.item.FillUtil import create_item_pool_config, massage_item_pool, district_item_pool_config, verify_item_pool_config
|
||||||
@@ -282,7 +282,8 @@ def main(args, seed=None, fish=None):
|
|||||||
|
|
||||||
for player in range(1, world.players + 1):
|
for player in range(1, world.players + 1):
|
||||||
if world.logic[player] in ('nologic', 'hybridglitches'):
|
if world.logic[player] in ('nologic', 'hybridglitches'):
|
||||||
create_hybridmajor_connections(world, player)
|
create_hmg_entrances_regions(world, player)
|
||||||
|
connect_hmg_entrances_regions(world, player)
|
||||||
generate_itempool(world, player)
|
generate_itempool(world, player)
|
||||||
|
|
||||||
verify_item_pool_config(world)
|
verify_item_pool_config(world)
|
||||||
@@ -544,6 +545,10 @@ def copy_world(world):
|
|||||||
connection = Entrance(player, 'Uncle S&Q', parent)
|
connection = Entrance(player, 'Uncle S&Q', parent)
|
||||||
parent.exits.append(connection)
|
parent.exits.append(connection)
|
||||||
connection.connect(target)
|
connection.connect(target)
|
||||||
|
# This makes the regions for HMG only
|
||||||
|
# we'll connect them later after all other connections are made (OW <=> UW, Portals)
|
||||||
|
if world.logic[player] in ('nologic', 'hybridglitches'):
|
||||||
|
create_hmg_entrances_regions(ret, player)
|
||||||
|
|
||||||
# copy bosses
|
# copy bosses
|
||||||
for dungeon in world.dungeons:
|
for dungeon in world.dungeons:
|
||||||
@@ -560,7 +565,6 @@ def copy_world(world):
|
|||||||
|
|
||||||
# We have to skip these for now. They require both the rest of the entrances _and_ the dungeon portals to be copied first
|
# We have to skip these for now. They require both the rest of the entrances _and_ the dungeon portals to be copied first
|
||||||
# We will connect them later
|
# We will connect them later
|
||||||
hmg_entrances = get_hybridmajor_connection_entrances()
|
|
||||||
|
|
||||||
for region in world.regions:
|
for region in world.regions:
|
||||||
copied_region = ret.get_region(region.name, region.player)
|
copied_region = ret.get_region(region.name, region.player)
|
||||||
@@ -571,8 +575,6 @@ def copy_world(world):
|
|||||||
for location in copied_region.locations:
|
for location in copied_region.locations:
|
||||||
location.parent_region = copied_region
|
location.parent_region = copied_region
|
||||||
for entrance in region.entrances:
|
for entrance in region.entrances:
|
||||||
if entrance.name in hmg_entrances:
|
|
||||||
continue
|
|
||||||
ret.get_entrance(entrance.name, entrance.player).connect(copied_region)
|
ret.get_entrance(entrance.name, entrance.player).connect(copied_region)
|
||||||
|
|
||||||
# fill locations
|
# fill locations
|
||||||
@@ -620,15 +622,15 @@ def copy_world(world):
|
|||||||
|
|
||||||
for player in range(1, world.players + 1):
|
for player in range(1, world.players + 1):
|
||||||
if world.logic[player] in ('nologic', 'hybridglitches'):
|
if world.logic[player] in ('nologic', 'hybridglitches'):
|
||||||
create_hybridmajor_connections(ret, player)
|
connect_hmg_entrances_regions(ret, player)
|
||||||
|
|
||||||
for region in world.regions:
|
for region in world.regions:
|
||||||
copied_region = ret.get_region(region.name, region.player)
|
copied_region = ret.get_region(region.name, region.player)
|
||||||
for entrance in region.entrances:
|
for entrance in region.entrances:
|
||||||
if entrance.name not in hmg_entrances:
|
ent = ret.get_entrance(entrance.name, entrance.player)
|
||||||
continue
|
if (ent.connected_region != copied_region):
|
||||||
ret.get_entrance(entrance.name, entrance.player).connect(copied_region)
|
ent.connect(copied_region)
|
||||||
|
|
||||||
for player in range(1, world.players + 1):
|
for player in range(1, world.players + 1):
|
||||||
set_rules(ret, player)
|
set_rules(ret, player)
|
||||||
|
|
||||||
|
|||||||
@@ -282,20 +282,12 @@ def add_alternate_rule(entrance, rule):
|
|||||||
old_rule = entrance.access_rule
|
old_rule = entrance.access_rule
|
||||||
entrance.access_rule = lambda state: old_rule(state) or rule(state)
|
entrance.access_rule = lambda state: old_rule(state) or rule(state)
|
||||||
|
|
||||||
|
def create_no_logic_connections(player, world, connections):
|
||||||
def create_no_logic_connections(player, world, connections, connect_external=False):
|
|
||||||
for entrance, parent_region, target_region, *rule_override in connections:
|
for entrance, parent_region, target_region, *rule_override in connections:
|
||||||
parent = world.get_region(parent_region, player)
|
parent = world.get_region(parent_region, player)
|
||||||
|
target = world.get_region(target_region, player)
|
||||||
if isinstance(target_region, Region):
|
|
||||||
target_region = target_region.name
|
|
||||||
|
|
||||||
if connect_external and target_region.endswith(" Portal"):
|
|
||||||
target = world.get_portal(target_region[:-7], player).find_portal_entrance().parent_region
|
|
||||||
else:
|
|
||||||
target = world.get_region(target_region, player)
|
|
||||||
|
|
||||||
connection = Entrance(player, entrance, parent)
|
connection = Entrance(player, entrance, parent)
|
||||||
|
connection.spot_type = 'OWG'
|
||||||
parent.exits.append(connection)
|
parent.exits.append(connection)
|
||||||
connection.connect(target)
|
connection.connect(target)
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import functools
|
import functools
|
||||||
from BaseClasses import Entrance, DoorType
|
from BaseClasses import Entrance, DoorType, Door
|
||||||
from DoorShuffle import connect_simple_door
|
from DoorShuffle import connect_simple_door
|
||||||
import Rules
|
import Rules
|
||||||
from OverworldGlitchRules import create_no_logic_connections
|
|
||||||
from Doors import create_door
|
|
||||||
|
|
||||||
kikiskip_spots = [
|
kikiskip_spots = [
|
||||||
("Kiki Skip", "Spectacle Rock Cave (Bottom)", "Palace of Darkness Portal")
|
("Kiki Skip", "Spectacle Rock Cave (Bottom)", "Palace of Darkness Portal")
|
||||||
@@ -13,7 +11,7 @@ mirehera_spots = [("Mire to Hera Clip", "Mire Torches Top", "Hera Portal")]
|
|||||||
|
|
||||||
heraswamp_spots = [("Hera to Swamp Clip", "Mire Torches Top", "Swamp Portal")]
|
heraswamp_spots = [("Hera to Swamp Clip", "Mire Torches Top", "Swamp Portal")]
|
||||||
|
|
||||||
icepalace_spots = [("Ice Lobby Clip", "Ice Portal", "Ice Bomb Drop - Top")]
|
icepalace_spots = [("Ice Lobby Clip", "Ice Lobby", "Ice Bomb Drop - Top")]
|
||||||
|
|
||||||
thievesdesert_spots = [
|
thievesdesert_spots = [
|
||||||
("Thieves to Desert West Clip", "Thieves Attic", "Desert West Portal"),
|
("Thieves to Desert West Clip", "Thieves Attic", "Desert West Portal"),
|
||||||
@@ -29,10 +27,7 @@ paradox_spots = [
|
|||||||
("Paradox Front Teleport", "Paradox Cave Front", "Paradox Cave Chest Area")
|
("Paradox Front Teleport", "Paradox Cave Front", "Paradox Cave Chest Area")
|
||||||
]
|
]
|
||||||
|
|
||||||
# Create connections between dungeons/locations
|
def create_hmg_entrances_regions(world, player):
|
||||||
def create_hybridmajor_connections(world, player):
|
|
||||||
fix_fake_worlds = world.fix_fake_world[player]
|
|
||||||
|
|
||||||
for spots in [
|
for spots in [
|
||||||
kikiskip_spots,
|
kikiskip_spots,
|
||||||
mirehera_spots,
|
mirehera_spots,
|
||||||
@@ -42,34 +37,44 @@ def create_hybridmajor_connections(world, player):
|
|||||||
specrock_spots,
|
specrock_spots,
|
||||||
paradox_spots,
|
paradox_spots,
|
||||||
]:
|
]:
|
||||||
create_no_logic_connections(player, world, spots, connect_external=fix_fake_worlds)
|
for entrance, parent_region, _, *_ in spots:
|
||||||
|
parent = world.get_region(parent_region, player)
|
||||||
|
connection = Entrance(player, entrance, parent)
|
||||||
|
connection.spot_type = 'HMG'
|
||||||
|
if connection not in parent.exits:
|
||||||
|
parent.exits.append(connection)
|
||||||
|
|
||||||
|
ip_bomb_top_reg = world.get_region("Ice Bomb Drop - Top", player)
|
||||||
|
ip_clip_entrance = Entrance(player, "Ice Bomb Drop Clip", ip_bomb_top_reg)
|
||||||
|
ip_bomb_top_reg.exits.append(ip_clip_entrance)
|
||||||
|
|
||||||
|
|
||||||
|
def connect_hmg_entrances_regions(world, player):
|
||||||
|
for spots in [
|
||||||
|
kikiskip_spots,
|
||||||
|
mirehera_spots,
|
||||||
|
heraswamp_spots,
|
||||||
|
icepalace_spots,
|
||||||
|
thievesdesert_spots,
|
||||||
|
specrock_spots,
|
||||||
|
paradox_spots,
|
||||||
|
]:
|
||||||
|
for entrance, _, target_region, *_ in spots:
|
||||||
|
connection = world.get_entrance(entrance, player)
|
||||||
|
if world.fix_fake_world[player] and target_region.endswith(" Portal"):
|
||||||
|
target = world.get_portal(target_region[:-7], player).find_portal_entrance().parent_region
|
||||||
|
else:
|
||||||
|
target = world.get_region(target_region, player)
|
||||||
|
connection.connect(target)
|
||||||
|
|
||||||
# Add the new Ice path (back of bomb drop to front) to the world and model it properly
|
# Add the new Ice path (back of bomb drop to front) to the world and model it properly
|
||||||
clip_door = create_door(player, "Ice Bomb Drop Clip", DoorType.Logical)
|
ip_clip_entrance = world.get_entrance('Ice Bomb Drop Clip', 1)
|
||||||
|
clip_door = Door(player, "Ice Bomb Drop Clip", DoorType.Logical, ip_clip_entrance)
|
||||||
world.doors += [clip_door]
|
world.doors += [clip_door]
|
||||||
world.initialize_doors([clip_door])
|
world.initialize_doors([clip_door])
|
||||||
|
|
||||||
ice_bomb_top_reg = world.get_region("Ice Bomb Drop - Top", player)
|
|
||||||
ice_bomb_top_reg.exits.append(
|
|
||||||
Entrance(player, "Ice Bomb Drop Clip", ice_bomb_top_reg)
|
|
||||||
)
|
|
||||||
connect_simple_door(world, "Ice Bomb Drop Clip", "Ice Bomb Drop", player)
|
connect_simple_door(world, "Ice Bomb Drop Clip", "Ice Bomb Drop", player)
|
||||||
|
|
||||||
def get_hybridmajor_connection_entrances():
|
|
||||||
connections = []
|
|
||||||
for connector in (
|
|
||||||
kikiskip_spots
|
|
||||||
+ mirehera_spots
|
|
||||||
+ heraswamp_spots
|
|
||||||
+ icepalace_spots
|
|
||||||
+ thievesdesert_spots
|
|
||||||
+ specrock_spots
|
|
||||||
+ paradox_spots
|
|
||||||
):
|
|
||||||
connections.append(connector[0])
|
|
||||||
connections.append('Ice Bomb Drop Clip')
|
|
||||||
return set(connections)
|
|
||||||
|
|
||||||
# For some entrances, we need to fake having pearl, because we're in fake DW/LW.
|
# For some entrances, we need to fake having pearl, because we're in fake DW/LW.
|
||||||
# This creates a copy of the input state that has Moon Pearl.
|
# This creates a copy of the input state that has Moon Pearl.
|
||||||
def fake_pearl_state(state, player):
|
def fake_pearl_state(state, player):
|
||||||
|
|||||||
Reference in New Issue
Block a user