Create glitch connections in advance for dungeon generation.

Add overworld glitches to the gui.
This commit is contained in:
compiling
2021-04-27 18:12:24 +10:00
parent 1433c987f1
commit db1a37b374
5 changed files with 21 additions and 17 deletions

View File

@@ -11,6 +11,7 @@ import zlib
from BaseClasses import World, CollectionState, Item, Region, Location, Shop, Entrance, Settings
from Items import ItemFactory
from KeyDoorShuffle import validate_key_placement
from OverworldGlitchRules import create_owg_connections
from PotShuffle import shuffle_pots
from Regions import create_regions, create_shops, mark_light_world_regions, create_dungeon_regions, adjust_locations
from InvertedRegions import create_inverted_regions, mark_dark_world_regions
@@ -123,6 +124,8 @@ def main(args, seed=None, fish=None):
create_regions(world, player)
else:
create_inverted_regions(world, player)
if world.logic[player] in ('owglitches', 'nologic'):
create_owg_connections(world, player)
create_dungeon_regions(world, player)
create_shops(world, player)
create_doors(world, player)
@@ -419,6 +422,8 @@ def copy_world(world):
create_shops(ret, player)
create_rooms(ret, player)
create_dungeons(ret, player)
if world.logic[player] in ('owglitches', 'nologic'):
create_owg_connections(ret, player)
copy_dynamic_regions_and_locations(world, ret)
for player in range(1, world.players + 1):

View File

@@ -212,9 +212,9 @@ def get_mirror_offset_spots_lw(player):
yield ('Death Mountain Offset Mirror (Houlihan Exit)', 'Death Mountain', 'Hyrule Castle Ledge', lambda state: state.has_Mirror(player) and state.can_boots_clip_dw(player) and state.has_Pearl(player))
def no_logic_rules(world, player):
def create_owg_connections(world, player):
"""
Add OWG transitions to no logic player's world
Add OWG transitions to player's world without logic
"""
create_no_logic_connections(player, world, get_boots_clip_exits_lw(world.mode == 'inverted'))
create_no_logic_connections(player, world, get_boots_clip_exits_dw(world.mode == 'inverted'))
@@ -231,23 +231,22 @@ def no_logic_rules(world, player):
def overworld_glitches_rules(world, player):
# Boots-accessible locations.
create_owg_connections(player, world, get_boots_clip_exits_lw(world.mode == 'inverted'), lambda state: state.can_boots_clip_lw(player))
create_owg_connections(player, world, get_boots_clip_exits_dw(world.mode == 'inverted'), lambda state: state.can_boots_clip_dw(player))
set_owg_rules(player, world, get_boots_clip_exits_lw(world.mode == 'inverted'), lambda state: state.can_boots_clip_lw(player))
set_owg_rules(player, world, get_boots_clip_exits_dw(world.mode == 'inverted'), lambda state: state.can_boots_clip_dw(player))
# Glitched speed drops.
create_owg_connections(player, world, get_glitched_speed_drops_dw(world.mode == 'inverted'), lambda state: state.can_get_glitched_speed_dw(player))
set_owg_rules(player, world, get_glitched_speed_drops_dw(world.mode == 'inverted'), lambda state: state.can_get_glitched_speed_dw(player))
# Dark Death Mountain Ledge Clip Spot also accessible with mirror.
if world.mode != 'inverted':
add_alternate_rule(world.get_entrance('Dark Death Mountain Ledge Clip Spot', player), lambda state: state.has_Mirror(player))
# Mirror clip spots.
if world.mode != 'inverted':
create_owg_connections(player, world, get_mirror_clip_spots_dw(), lambda state: state.has_Mirror(player))
create_owg_connections(player, world, get_mirror_offset_spots_dw(), lambda state: state.has_Mirror(player) and state.can_boots_clip_lw(player))
set_owg_rules(player, world, get_mirror_clip_spots_dw(), lambda state: state.has_Mirror(player))
set_owg_rules(player, world, get_mirror_offset_spots_dw(), lambda state: state.has_Mirror(player) and state.can_boots_clip_lw(player))
else:
create_owg_connections(player, world, get_mirror_offset_spots_lw(player), lambda state: state.has_Mirror(player) and state.can_boots_clip_dw(player))
set_owg_rules(player, world, get_mirror_offset_spots_lw(player), lambda state: state.has_Mirror(player) and state.can_boots_clip_dw(player))
# Regions that require the boots and some other stuff.
if world.mode != 'inverted':
@@ -277,12 +276,9 @@ def create_no_logic_connections(player, world, connections):
parent.exits.append(connection)
connection.connect(target)
def create_owg_connections(player, world, connections, default_rule):
def set_owg_rules(player, world, connections, default_rule):
for entrance, parent_region, target_region, *rule_override in connections:
parent = world.get_region(parent_region, player)
target = world.get_region(target_region, player)
connection = Entrance(player, entrance, parent)
parent.exits.append(connection)
connection.connect(target)
connection = world.get_entrance(entrance, player)
rule = rule_override[0] if len(rule_override) > 0 else default_rule
connection.access_rule = rule

View File

@@ -5,14 +5,13 @@ from collections import deque
import OverworldGlitchRules
from BaseClasses import CollectionState, RegionType, DoorType, Entrance, CrystalBarrier
from RoomData import DoorKind
from OverworldGlitchRules import overworld_glitches_rules, no_logic_rules
from OverworldGlitchRules import overworld_glitches_rules
def set_rules(world, player):
if world.logic[player] == 'nologic':
logging.getLogger('').info('WARNING! Seeds generated under this logic often require major glitches and may be impossible!')
no_logic_rules(world, player)
world.get_region('Menu', player).can_reach_private = lambda state: True
for exit in world.get_region('Menu', player).exits:
exit.hide_path = True
@@ -36,6 +35,8 @@ def set_rules(world, player):
no_glitches_rules(world, player)
elif world.logic[player] == 'minorglitches':
logging.getLogger('').info('Minor Glitches may be buggy still. No guarantee for proper logic checks.')
no_glitches_rules(world, player)
fake_flipper_rules(world, player)
elif world.logic[player] == 'owglitches':
logging.getLogger('').info('There is a chance OWG has bugged edge case rulesets, especially in inverted. Definitely file a report on GitHub if you see anything strange.')
# Initially setting no_glitches_rules to set the baseline rules for some

View File

@@ -195,6 +195,7 @@
"randomizer.item.logiclevel": "Logic Level",
"randomizer.item.logiclevel.noglitches": "No Glitches",
"randomizer.item.logiclevel.minorglitches": "Minor Glitches",
"randomizer.item.logiclevel.owglitches": "Overworld Glitches",
"randomizer.item.logiclevel.nologic": "No Logic",
"randomizer.item.goal": "Goal",

View File

@@ -19,6 +19,7 @@
"options": [
"noglitches",
"minorglitches",
"owglitches",
"nologic"
]
},