slightly reduce cache-memory use of OWG rules to recoup some of the lost performance to additional logic rules

This commit is contained in:
Fabian Dill 2020-04-10 21:13:16 +02:00
parent 01b7a590e7
commit 659cfd5c3f
2 changed files with 116 additions and 135 deletions

View File

@ -1,182 +1,166 @@
''' """
Helper functions to deliver entrance/exit/region sets to OWG rules. Helper functions to deliver entrance/exit/region sets to OWG rules.
''' """
def get_immediately_accessible_entrances(world, player):
''' def get_immediately_accessible_entrances():
"""
Entrances that are available with no items at all. Entrances that are available with no items at all.
At this point, these are fake flipper spots. At this point, these are fake flipper spots.
''' """
entrances = [ yield 'Hobo Bridge'
'Hobo Bridge', yield 'Zoras River'
'Zoras River', yield 'Lake Hylia Central Island Pier'
'Lake Hylia Central Island Pier',
]
return entrances
def get_sword_required_superbunny_mirror_regions(): def get_sword_required_superbunny_mirror_regions():
''' """
Cave regions that superbunny can get through - but only with a sword. Cave regions that superbunny can get through - but only with a sword.
''' """
return [ yield 'Mini Moldorm Cave'
'Mini Moldorm Cave', yield 'Spiral Cave (Top)'
'Spiral Cave (Top)',
]
def get_invalid_mirror_bunny_entrances_dw(): def get_invalid_mirror_bunny_entrances_dw():
''' """
Dark World entrances that can't be superbunny-mirrored into. Dark World entrances that can't be superbunny-mirrored into.
''' """
return [
'Skull Woods Final Section (Entrance)', yield 'Skull Woods Final Section (Entrance)'
'Hype Cave', yield 'Hype Cave'
'Bonk Fairy (Dark)', yield 'Bonk Fairy (Dark)'
'Thieves Town', yield 'Thieves Town'
'Dark World Hammer Peg Cave', yield 'Dark World Hammer Peg Cave'
'Brewery', yield 'Brewery'
'Hookshot Cave', yield 'Hookshot Cave'
'Hookshot Cave Exit (South)', yield 'Hookshot Cave Exit (South)'
'Dark Lake Hylia Ledge Fairy', yield 'Dark Lake Hylia Ledge Fairy'
'Dark Lake Hylia Ledge Spike Cave', yield 'Dark Lake Hylia Ledge Spike Cave'
]
def get_invalid_mirror_bunny_entrances_lw(): def get_invalid_mirror_bunny_entrances_lw():
''' """
Light World entrances that can't be superbunny-mirrored into. Light World entrances that can't be superbunny-mirrored into.
A couple of these, like Blind's Hideout, are odd cases where the pixel A couple of these, like Blind's Hideout, are odd cases where the pixel
leading into the entrance prevents mirror superbunnying - generally due to leading into the entrance prevents mirror superbunnying - generally due to
there being stairs there. there being stairs there.
''' """
return [
'Bonk Rock Cave', yield 'Bonk Rock Cave'
'Bonk Fairy (Light)', yield 'Bonk Fairy (Light)'
'Blinds Hideout', yield 'Blinds Hideout'
'50 Rupee Cave', yield '50 Rupee Cave'
'20 Rupee Cave', yield '20 Rupee Cave'
'Checkerboard Cave', yield 'Checkerboard Cave'
'Light Hype Fairy', yield 'Light Hype Fairy'
'Waterfall of Wishing', yield 'Waterfall of Wishing'
'Light World Bomb Hut', yield 'Light World Bomb Hut'
'Mini Moldorm Cave', yield 'Mini Moldorm Cave'
'Ice Rod Cave', yield 'Ice Rod Cave'
'Hyrule Castle Secret Entrance Stairs', yield 'Hyrule Castle Secret Entrance Stairs'
'Sanctuary Grave', yield 'Sanctuary Grave'
'Kings Grave', yield 'Kings Grave'
'Tower of Hera', yield 'Tower of Hera'
]
def get_superbunny_accessible_locations(): def get_superbunny_accessible_locations():
''' """
Interior locations that can be accessed with superbunny state. Interior locations that can be accessed with superbunny state.
''' """
return [
'Waterfall of Wishing - Left', yield 'Waterfall of Wishing - Left'
'Waterfall of Wishing - Right', yield 'Waterfall of Wishing - Right'
'King\'s Tomb', 'Floodgate', yield 'King\'s Tomb', 'Floodgate'
'Floodgate Chest', yield 'Floodgate Chest'
'Cave 45', yield 'Cave 45'
'Bonk Rock Cave', yield 'Bonk Rock Cave'
'Brewery', yield 'Brewery'
'C-Shaped House', yield 'C-Shaped House'
'Chest Game', yield 'Chest Game'
'Mire Shed - Left', yield 'Mire Shed - Left'
'Mire Shed - Right', yield 'Mire Shed - Right'
'Secret Passage', yield 'Secret Passage'
'Ice Rod Cave', yield 'Ice Rod Cave'
'Pyramid Fairy - Left', yield 'Pyramid Fairy - Left'
'Pyramid Fairy - Right', yield 'Pyramid Fairy - Right'
'Superbunny Cave - Top', yield 'Superbunny Cave - Top'
'Superbunny Cave - Bottom', yield 'Superbunny Cave - Bottom'
]
def get_boots_clip_exits_lw(inverted = False): def get_boots_clip_exits_lw(inverted = False):
''' """
Special Light World region exits that require boots clips. Special Light World region exits that require boots clips.
''' """
exits = [
'Bat Cave River Clip Spot', yield 'Bat Cave River Clip Spot'
'Light World DMA Clip Spot', yield 'Light World DMA Clip Spot'
'Hera Ascent', yield 'Hera Ascent'
'Death Mountain Return Ledge Clip Spot', yield 'Death Mountain Return Ledge Clip Spot'
'Death Mountain Glitched Bridge', yield 'Death Mountain Glitched Bridge'
'Zora Descent Clip Spot', yield 'Zora Descent Clip Spot'
'Desert Northern Cliffs', yield 'Desert Northern Cliffs'
'Lake Hylia Island Clip Spot', yield 'Lake Hylia Island Clip Spot'
'Death Mountain Descent', yield 'Death Mountain Descent'
'Graveyard Ledge Clip Spot', yield 'Graveyard Ledge Clip Spot'
# Also requires a waterwalk setup, but the point still remains. # Also requires a waterwalk setup, but the point still remains.
'Waterfall of Wishing', yield 'Waterfall of Wishing'
]
if not inverted: if not inverted:
exits.append('Spectacle Rock Clip Spot') yield 'Spectacle Rock Clip Spot'
exits.append('Bombos Tablet Clip Spot') yield 'Bombos Tablet Clip Spot'
exits.append('Floating Island Clip Spot') yield 'Floating Island Clip Spot'
exits.append('Cave 45 Clip Spot') yield 'Cave 45 Clip Spot'
return exits
def get_boots_clip_exits_dw(inverted = False): def get_boots_clip_exits_dw(inverted = False):
''' """
Special Dark World region exits that require boots clips. Special Dark World region exits that require boots clips.
''' """
exits = [
'Dark World DMA Clip Spot', yield 'Dark World DMA Clip Spot'
'Bumper Cave Ledge Clip Spot', yield 'Bumper Cave Ledge Clip Spot'
'Catfish Descent', yield 'Catfish Descent'
'Hammer Pegs River Clip Spot', yield 'Hammer Pegs River Clip Spot'
'Dark Lake Hylia Ledge Clip Spot', yield 'Dark Lake Hylia Ledge Clip Spot'
'Dark Desert Cliffs Clip Spot', yield 'Dark Desert Cliffs Clip Spot'
'Dark Death Mountain Descent', yield 'Dark Death Mountain Descent'
]
if not inverted: if not inverted:
exits.append('Ganons Tower Ascent') yield 'Ganons Tower Ascent'
exits.append('Dark Death Mountain Glitched Bridge') yield 'Dark Death Mountain Glitched Bridge'
exits.append('Turtle Rock (Top) Clip Spot') yield 'Turtle Rock (Top) Clip Spot'
return exits
def get_glitched_speed_drops_dw(): def get_glitched_speed_drops_dw():
''' """
Dark World drop-down ledges that require glitched speed. Dark World drop-down ledges that require glitched speed.
''' """
return [ yield 'Dark Death Mountain Ledge Clip Spot'
'Dark Death Mountain Ledge Clip Spot',
]
def get_mirror_clip_spots_dw(): def get_mirror_clip_spots_dw():
''' """
Mirror shenanigans that are in logic even if the player is a bunny. Mirror shenanigans that are in logic even if the player is a bunny.
''' """
return [ yield 'Dark Death Mountain Offset Mirror'
'Dark Death Mountain Offset Mirror', yield 'Dark Death Mountain Bunny Descent Mirror Spot'
'Dark Death Mountain Bunny Descent Mirror Spot',
]
def get_mirror_clip_spots_lw(): def get_mirror_clip_spots_lw():
''' """
Inverted mirror shenanigans in logic even if the player is a bunny. Inverted mirror shenanigans in logic even if the player is a bunny.
''' """
return [ yield 'Death Mountain Bunny Descent Mirror Spot'
'Death Mountain Bunny Descent Mirror Spot', yield 'Death Mountain Offset Mirror'
'Death Mountain Offset Mirror',
]
def get_invalid_bunny_revival_dungeons(): def get_invalid_bunny_revival_dungeons():
''' """
Dungeon regions that can't be bunny revived from. Dungeon regions that can't be bunny revived from.
''' """
return [
'Tower of Hera (Bottom)', yield 'Tower of Hera (Bottom)'
'Swamp Palace (Entrance)', yield 'Swamp Palace (Entrance)'
'Turtle Rock (Entrance)', yield 'Turtle Rock (Entrance)'
]

View File

@ -40,7 +40,6 @@ def set_rules(world, player):
if world.logic[player] == 'noglitches': if world.logic[player] == 'noglitches':
no_glitches_rules(world, player) no_glitches_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.')
# Initially setting no_glitches_rules to set the baseline rules for some # Initially setting no_glitches_rules to set the baseline rules for some
# entrances. The overworld_glitches_rules set is primarily additive. # entrances. The overworld_glitches_rules set is primarily additive.
no_glitches_rules(world, player) no_glitches_rules(world, player)
@ -745,7 +744,7 @@ def add_conditional_lamps(world, player):
def overworld_glitches_rules(world, player): def overworld_glitches_rules(world, player):
# Spots that are immediately accessible. # Spots that are immediately accessible.
for entrance in OWGSets.get_immediately_accessible_entrances(world, player): for entrance in OWGSets.get_immediately_accessible_entrances():
set_rule(world.get_entrance(entrance, player), lambda state: True) set_rule(world.get_entrance(entrance, player), lambda state: True)
# Boots-accessible locations. # Boots-accessible locations.
@ -823,8 +822,6 @@ def standard_rules(world, player):
def set_trock_key_rules(world, player): def set_trock_key_rules(world, player):
# First set all relevant locked doors to impassible. # First set all relevant locked doors to impassible.
for entrance in ['Turtle Rock Dark Room Staircase', 'Turtle Rock (Chain Chomp Room) (North)', 'Turtle Rock (Chain Chomp Room) (South)', 'Turtle Rock Pokey Room']: for entrance in ['Turtle Rock Dark Room Staircase', 'Turtle Rock (Chain Chomp Room) (North)', 'Turtle Rock (Chain Chomp Room) (South)', 'Turtle Rock Pokey Room']:
set_rule(world.get_entrance(entrance, player), lambda state: False) set_rule(world.get_entrance(entrance, player), lambda state: False)