Preliminary bunny logic

This commit is contained in:
Kevin Cathcart
2017-12-13 09:51:53 -05:00
parent 1cfbe2e9ef
commit 6bd0664b7f
6 changed files with 137 additions and 55 deletions

View File

@@ -1,3 +1,4 @@
import collections
from BaseClasses import Region, Location, Entrance
@@ -178,7 +179,8 @@ def create_regions(world):
create_region('Spike Cave', ['Spike Cave']),
create_region('Hookshot Cave', ['Hookshot Cave - Top Right', 'Hookshot Cave - Top Left', 'Hookshot Cave - Bottom Right', 'Hookshot Cave - Bottom Left'],
['Hookshot Cave Exit (South)', 'Hookshot Cave Exit (North)']),
create_region('Death Mountain Floating Island', ['Floating Island'], ['Floating Island Drop', 'Hookshot Cave Back Entrance']),
create_region('Death Mountain Floating Island (Dark World)', None, ['Floating Island Drop', 'Hookshot Cave Back Entrance', 'Floating Island Mirror Spot']),
create_region('Death Mountain Floating Island (Light World)', ['Floating Island'] ),
create_region('Turtle Rock (Top)', None, ['Turtle Rock Drop']),
create_region('Mimic Cave', ['Mimic Cave']),
@@ -201,6 +203,7 @@ def create_regions(world):
create_region('Skull Woods First Section (Right)', ['Skull Woods - Pinball Room'], ['Skull Woods First Section (Right) North Door']),
create_region('Skull Woods First Section (Left)', ['Skull Woods - Compass Chest', 'Skull Woods - Pot Prison'], ['Skull Woods First Section (Left) Door to Exit', 'Skull Woods First Section (Left) Door to Right']),
create_region('Skull Woods First Section (Top)', ['Skull Woods - Big Chest'], ['Skull Woods First Section (Top) One-Way Path']),
create_region('Skull Woods Second Section (Drop)', None, ['Skull Woods Second Section (Drop)']),
create_region('Skull Woods Second Section', ['Skull Woods - Big Key Chest'], ['Skull Woods Second Section Exit (East)', 'Skull Woods Second Section Exit (West)']),
create_region('Skull Woods Final Section (Entrance)', ['Skull Woods - Bridge Room'], ['Skull Woods Torch Room', 'Skull Woods Final Section Exit']),
create_region('Skull Woods Final Section (Mothula)', ['Skull Woods - Mothula', 'Skull Woods - Prize']),
@@ -282,6 +285,27 @@ def create_region(name, locations=None, exits=None):
return ret
def mark_light_world_regions(world):
# Note that in "inanity" shuffle this code may mark some dark world locations as being in light world. That is fine because this flag
# is only used for bunny logic, and you start with a Moon pearl immediately availible in Insanity shuffle.
# Exclude entrances that represent connections from the light world to the dark world
excluded_entrances = set(['Top of Pyramid', 'Lake Hylia Central Island Teleporter', 'Dark Desert Teleporter', 'East Hyrule Teleporter', 'South Hyrule Teleporter', 'Kakariko Teleporter', 'Death Mountain Teleporter', 'East Death Mountain Teleporter', 'Turtle Rock Teleporter'])
starting_regions = ['Links House', 'Cave 45', 'Graveyard Cave','Mimic Cave', 'Death Mountain Floating Island (Light World)','Desert Ledge (West)', 'Lake Hylia Island', 'Spectacle Rock']
queue = collections.deque([world.get_region(region) for region in starting_regions])
seen = set(queue)
while queue:
current = queue.popleft()
current.is_light_world = True
for exit in current.exits:
if exit.name in excluded_entrances:
continue
if exit.connected_region not in seen:
seen.add(exit.connected_region)
queue.append(exit.connected_region)
location_table = {'Mushroom': (0x180013, False, 'in the woods'),
'Bottle Merchant': (0x2EB18, False, 'with a merchant'),
'Flute Spot': (0x18014A, False, 'underground'),