Create glitch connections in advance for dungeon generation.
Add overworld glitches to the gui.
This commit is contained in:
5
Main.py
5
Main.py
@@ -11,6 +11,7 @@ import zlib
|
|||||||
from BaseClasses import World, CollectionState, Item, Region, Location, Shop, Entrance, Settings
|
from BaseClasses import World, CollectionState, Item, Region, Location, Shop, Entrance, Settings
|
||||||
from Items import ItemFactory
|
from Items import ItemFactory
|
||||||
from KeyDoorShuffle import validate_key_placement
|
from KeyDoorShuffle import validate_key_placement
|
||||||
|
from OverworldGlitchRules import create_owg_connections
|
||||||
from PotShuffle import shuffle_pots
|
from PotShuffle import shuffle_pots
|
||||||
from Regions import create_regions, create_shops, mark_light_world_regions, create_dungeon_regions, adjust_locations
|
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
|
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)
|
create_regions(world, player)
|
||||||
else:
|
else:
|
||||||
create_inverted_regions(world, player)
|
create_inverted_regions(world, player)
|
||||||
|
if world.logic[player] in ('owglitches', 'nologic'):
|
||||||
|
create_owg_connections(world, player)
|
||||||
create_dungeon_regions(world, player)
|
create_dungeon_regions(world, player)
|
||||||
create_shops(world, player)
|
create_shops(world, player)
|
||||||
create_doors(world, player)
|
create_doors(world, player)
|
||||||
@@ -419,6 +422,8 @@ def copy_world(world):
|
|||||||
create_shops(ret, player)
|
create_shops(ret, player)
|
||||||
create_rooms(ret, player)
|
create_rooms(ret, player)
|
||||||
create_dungeons(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)
|
copy_dynamic_regions_and_locations(world, ret)
|
||||||
for player in range(1, world.players + 1):
|
for player in range(1, world.players + 1):
|
||||||
|
|||||||
@@ -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))
|
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_lw(world.mode == 'inverted'))
|
||||||
create_no_logic_connections(player, world, get_boots_clip_exits_dw(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):
|
def overworld_glitches_rules(world, player):
|
||||||
|
|
||||||
# Boots-accessible locations.
|
# Boots-accessible locations.
|
||||||
create_owg_connections(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_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_dw(world.mode == 'inverted'), lambda state: state.can_boots_clip_dw(player))
|
||||||
|
|
||||||
# Glitched speed drops.
|
# 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.
|
# Dark Death Mountain Ledge Clip Spot also accessible with mirror.
|
||||||
if world.mode != 'inverted':
|
if world.mode != 'inverted':
|
||||||
add_alternate_rule(world.get_entrance('Dark Death Mountain Ledge Clip Spot', player), lambda state: state.has_Mirror(player))
|
add_alternate_rule(world.get_entrance('Dark Death Mountain Ledge Clip Spot', player), lambda state: state.has_Mirror(player))
|
||||||
|
|
||||||
# Mirror clip spots.
|
# Mirror clip spots.
|
||||||
if world.mode != 'inverted':
|
if world.mode != 'inverted':
|
||||||
create_owg_connections(player, world, get_mirror_clip_spots_dw(), lambda state: state.has_Mirror(player))
|
set_owg_rules(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_offset_spots_dw(), lambda state: state.has_Mirror(player) and state.can_boots_clip_lw(player))
|
||||||
else:
|
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.
|
# Regions that require the boots and some other stuff.
|
||||||
if world.mode != 'inverted':
|
if world.mode != 'inverted':
|
||||||
@@ -277,12 +276,9 @@ def create_no_logic_connections(player, world, connections):
|
|||||||
parent.exits.append(connection)
|
parent.exits.append(connection)
|
||||||
connection.connect(target)
|
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:
|
for entrance, parent_region, target_region, *rule_override in connections:
|
||||||
parent = world.get_region(parent_region, player)
|
connection = world.get_entrance(entrance, player)
|
||||||
target = world.get_region(target_region, player)
|
|
||||||
connection = Entrance(player, entrance, parent)
|
|
||||||
parent.exits.append(connection)
|
|
||||||
connection.connect(target)
|
|
||||||
rule = rule_override[0] if len(rule_override) > 0 else default_rule
|
rule = rule_override[0] if len(rule_override) > 0 else default_rule
|
||||||
connection.access_rule = rule
|
connection.access_rule = rule
|
||||||
|
|||||||
5
Rules.py
5
Rules.py
@@ -5,14 +5,13 @@ from collections import deque
|
|||||||
import OverworldGlitchRules
|
import OverworldGlitchRules
|
||||||
from BaseClasses import CollectionState, RegionType, DoorType, Entrance, CrystalBarrier
|
from BaseClasses import CollectionState, RegionType, DoorType, Entrance, CrystalBarrier
|
||||||
from RoomData import DoorKind
|
from RoomData import DoorKind
|
||||||
from OverworldGlitchRules import overworld_glitches_rules, no_logic_rules
|
from OverworldGlitchRules import overworld_glitches_rules
|
||||||
|
|
||||||
|
|
||||||
def set_rules(world, player):
|
def set_rules(world, player):
|
||||||
|
|
||||||
if world.logic[player] == 'nologic':
|
if world.logic[player] == 'nologic':
|
||||||
logging.getLogger('').info('WARNING! Seeds generated under this logic often require major glitches and may be impossible!')
|
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
|
world.get_region('Menu', player).can_reach_private = lambda state: True
|
||||||
for exit in world.get_region('Menu', player).exits:
|
for exit in world.get_region('Menu', player).exits:
|
||||||
exit.hide_path = True
|
exit.hide_path = True
|
||||||
@@ -36,6 +35,8 @@ def set_rules(world, player):
|
|||||||
no_glitches_rules(world, player)
|
no_glitches_rules(world, player)
|
||||||
elif world.logic[player] == 'minorglitches':
|
elif world.logic[player] == 'minorglitches':
|
||||||
logging.getLogger('').info('Minor Glitches may be buggy still. No guarantee for proper logic checks.')
|
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':
|
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.')
|
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
|
# Initially setting no_glitches_rules to set the baseline rules for some
|
||||||
|
|||||||
@@ -195,6 +195,7 @@
|
|||||||
"randomizer.item.logiclevel": "Logic Level",
|
"randomizer.item.logiclevel": "Logic Level",
|
||||||
"randomizer.item.logiclevel.noglitches": "No Glitches",
|
"randomizer.item.logiclevel.noglitches": "No Glitches",
|
||||||
"randomizer.item.logiclevel.minorglitches": "Minor Glitches",
|
"randomizer.item.logiclevel.minorglitches": "Minor Glitches",
|
||||||
|
"randomizer.item.logiclevel.owglitches": "Overworld Glitches",
|
||||||
"randomizer.item.logiclevel.nologic": "No Logic",
|
"randomizer.item.logiclevel.nologic": "No Logic",
|
||||||
|
|
||||||
"randomizer.item.goal": "Goal",
|
"randomizer.item.goal": "Goal",
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
"options": [
|
"options": [
|
||||||
"noglitches",
|
"noglitches",
|
||||||
"minorglitches",
|
"minorglitches",
|
||||||
|
"owglitches",
|
||||||
"nologic"
|
"nologic"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user