From 2e9814882e7a3bf3f1b578270a004c3a67323bd9 Mon Sep 17 00:00:00 2001 From: Kevin Cathcart Date: Sun, 15 Oct 2017 12:16:07 -0400 Subject: [PATCH] Refactor dungeon and item classes to support VT26 style dungeon item shuffling --- BaseClasses.py | 63 +++++++++++- Dungeons.py | 41 +++++--- Items.py | 267 ++++++++++++++++++++++++------------------------- Main.py | 20 ++-- Plando.py | 2 + 5 files changed, 231 insertions(+), 162 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index 0dd3d665..8f4bdafa 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -13,6 +13,7 @@ class World(object): self.difficulty = difficulty self.goal = goal self.algorithm = algorithm + self.dungeons = [] self.regions = [] self.itempool = [] self.seed = None @@ -133,7 +134,7 @@ class World(object): if not isinstance(location, Location): location = self.get_location(location) - if location.item_rule(item): + if location.can_fill(item): location.item = item item.location = location if collect: @@ -433,6 +434,7 @@ class Region(object): self.entrances = [] self.exits = [] self.locations = [] + self.dungeon = None self.spot_type = 'Region' self.hint_text = 'Hyrule' self.recursion_count = 0 @@ -442,6 +444,16 @@ class Region(object): if state.can_reach(entrance): return True return False + + def can_fill(self, item): + if item.key or item.map or item.compass: + if self.dungeon and self.dungeon.is_dungeon_item(item): + return True + else: + return False + + return True + def __str__(self): return str(self.__unicode__()) @@ -484,6 +496,31 @@ class Entrance(object): def __unicode__(self): return '%s' % self.name +class Dungeon(object): + + def __init__(self, name, regions, big_key, small_keys, dungeon_items): + self.name = name + self.regions = regions + self.big_key = big_key + self.small_keys = small_keys + self.dungeon_items = dungeon_items + + @property + def keys(self): + return self.small_keys + ([self.big_key] if self.big_key else []) + + @property + def all_items(self): + return self.dungeon_items+self.keys + + def is_dungeon_item(self, item): + return item.name in [dungeon_item.name for dungeon_item in self.all_items] + + def __str__(self): + return str(self.__unicode__()) + + def __unicode__(self): + return '%s' % self.name class Location(object): @@ -504,6 +541,9 @@ class Location(object): def item_rule(self, item): return True + + def can_fill(self, item): + return self.parent_region.can_fill(item) and self.item_rule(item) def can_reach(self, state): if self.access_rule(state) and state.can_reach(self.parent_region): @@ -519,12 +559,11 @@ class Location(object): class Item(object): - def __init__(self, name='', advancement=False, priority=False, key=False, crystal=False, code=None, altar_hint=None, altar_credit=None, sickkid_credit=None, zora_credit=None, witch_credit=None, fluteboy_credit=None): + def __init__(self, name='', advancement=False, priority=False, type=None, code=None, altar_hint=None, altar_credit=None, sickkid_credit=None, zora_credit=None, witch_credit=None, fluteboy_credit=None): self.name = name self.advancement = advancement self.priority = priority - self.key = key - self.crystal = crystal + self.type = type self.altar_hint_text = altar_hint self.altar_credit_text = altar_credit self.sickkid_credit_text = sickkid_credit @@ -533,6 +572,22 @@ class Item(object): self.fluteboy_credit_text = fluteboy_credit self.code = code self.location = None + + @property + def key(self): + return self.type == 'SmallKey' or self.type == 'BigKey' + + @property + def crystal(self): + return self.type == 'Crystal' + + @property + def map(self): + return self.type == 'Map' + + @property + def compass(self): + return self.type == 'Compass' def __str__(self): return str(self.__unicode__()) diff --git a/Dungeons.py b/Dungeons.py index e2fb6a85..daf2a58d 100644 --- a/Dungeons.py +++ b/Dungeons.py @@ -1,22 +1,33 @@ from Items import ItemFactory +from BaseClasses import Dungeon import random -def fill_dungeons(world): - ES = (['Hyrule Castle', 'Sewers', 'Sewers (Dark)', 'Sanctuary'], None, [ItemFactory('Small Key (Escape)')], [ItemFactory('Map (Escape)')]) - EP = (['Eastern Palace'], ItemFactory('Big Key (Eastern Palace)'), [], ItemFactory(['Map (Eastern Palace)', 'Compass (Eastern Palace)'])) - DP = (['Desert Palace North', 'Desert Palace Main', 'Desert Palace East'], ItemFactory('Big Key (Desert Palace)'), [ItemFactory('Small Key (Desert Palace)')], ItemFactory(['Map (Desert Palace)', 'Compass (Desert Palace)'])) - ToH = (['Tower of Hera (Bottom)', 'Tower of Hera (Basement)', 'Tower of Hera (Top)'], ItemFactory('Big Key (Tower of Hera)'), [ItemFactory('Small Key (Tower of Hera)')], ItemFactory(['Map (Tower of Hera)', 'Compass (Tower of Hera)'])) - AT = (['Agahnims Tower', 'Agahnim 1'], None, ItemFactory(['Small Key (Agahnims Tower)'] * 2), []) - PoD = (['Dark Palace (Entrance)', 'Dark Palace (Center)', 'Dark Palace (Big Key Chest)', 'Dark Palace (Bonk Section)', 'Dark Palace (North)', 'Dark Palace (Maze)', 'Dark Palace (Spike Statue Room)', 'Dark Palace (Final Section)'], ItemFactory('Big Key (Palace of Darkness)'), ItemFactory(['Small Key (Palace of Darkness)'] * 6), ItemFactory(['Map (Palace of Darkness)', 'Compass (Palace of Darkness)'])) - TT = (['Thieves Town (Entrance)', 'Thieves Town (Deep)', 'Blind Fight'], ItemFactory('Big Key (Thieves Town)'), [ItemFactory('Small Key (Thieves Town)')], ItemFactory(['Map (Thieves Town)', 'Compass (Thieves Town)'])) - SW = (['Skull Woods Final Section (Entrance)', 'Skull Woods First Section', 'Skull Woods Second Section', 'Skull Woods Final Section (Mothula)'], ItemFactory('Big Key (Skull Woods)'), ItemFactory(['Small Key (Skull Woods)'] * 2), ItemFactory(['Map (Skull Woods)', 'Compass (Skull Woods)'])) - SP = (['Swamp Palace (Entrance)', 'Swamp Palace (First Room)', 'Swamp Palace (Starting Area)', 'Swamp Palace (Center)', 'Swamp Palace (North)'], ItemFactory('Big Key (Swamp Palace)'), [ItemFactory('Small Key (Swamp Palace)')], ItemFactory(['Map (Swamp Palace)', 'Compass (Swamp Palace)'])) - IP = (['Ice Palace (Entrance)', 'Ice Palace (Main)', 'Ice Palace (East)', 'Ice Palace (East Top)', 'Ice Palace (Kholdstare)'], ItemFactory('Big Key (Ice Palace)'), ItemFactory(['Small Key (Ice Palace)'] * 2), ItemFactory(['Map (Ice Palace)', 'Compass (Ice Palace)'])) - MM = (['Misery Mire (Entrance)', 'Misery Mire (Main)', 'Misery Mire (West)', 'Misery Mire (Final Area)', 'Misery Mire (Vitreous)'], ItemFactory('Big Key (Misery Mire)'), ItemFactory(['Small Key (Misery Mire)'] * 3), ItemFactory(['Map (Misery Mire)', 'Compass (Misery Mire)'])) - TR = (['Turtle Rock (Entrance)', 'Turtle Rock (First Section)', 'Turtle Rock (Chain Chomp Room)', 'Turtle Rock (Second Section)', 'Turtle Rock (Big Chest)', 'Turtle Rock (Roller Switch Room)', 'Turtle Rock (Dark Room)', 'Turtle Rock (Eye Bridge)', 'Turtle Rock (Trinexx)'], ItemFactory('Big Key (Turtle Rock)'), ItemFactory(['Small Key (Turtle Rock)'] * 4), ItemFactory(['Map (Turtle Rock)', 'Compass (Turtle Rock)'])) - GT = (['Ganons Tower (Entrance)', 'Ganons Tower (Tile Room)', 'Ganons Tower (Compass Room)', 'Ganons Tower (Hookshot Room)', 'Ganons Tower (Map Room)', 'Ganons Tower (Firesnake Room)', 'Ganons Tower (Teleport Room)', 'Ganons Tower (Bottom)', 'Ganons Tower (Top)', 'Ganons Tower (Before Moldorm)', 'Ganons Tower (Moldorm)', 'Agahnim 2'], ItemFactory('Big Key (Ganons Tower)'), ItemFactory(['Small Key (Ganons Tower)'] * 4), ItemFactory(['Map (Ganons Tower)', 'Compass (Ganons Tower)'])) +def create_dungeons(world): + def make_dungeon(name, dungeon_regions, big_key, small_keys, dungeon_items): + dungeon = Dungeon(name, dungeon_regions, big_key, small_keys, dungeon_items) + for region in dungeon.regions: + world.get_region(region).dungeon = dungeon + return dungeon + ES = make_dungeon('Hyrule Castle', ['Hyrule Castle', 'Sewers', 'Sewers (Dark)', 'Sanctuary'], None, [ItemFactory('Small Key (Escape)')], [ItemFactory('Map (Escape)')]) + EP = make_dungeon('Eastern Palace', ['Eastern Palace'], ItemFactory('Big Key (Eastern Palace)'), [], ItemFactory(['Map (Eastern Palace)', 'Compass (Eastern Palace)'])) + DP = make_dungeon('Desert Palace', ['Desert Palace North', 'Desert Palace Main', 'Desert Palace East'], ItemFactory('Big Key (Desert Palace)'), [ItemFactory('Small Key (Desert Palace)')], ItemFactory(['Map (Desert Palace)', 'Compass (Desert Palace)'])) + ToH = make_dungeon('Tower of Hera', ['Tower of Hera (Bottom)', 'Tower of Hera (Basement)', 'Tower of Hera (Top)'], ItemFactory('Big Key (Tower of Hera)'), [ItemFactory('Small Key (Tower of Hera)')], ItemFactory(['Map (Tower of Hera)', 'Compass (Tower of Hera)'])) + AT = make_dungeon('Agahnims Tower', ['Agahnims Tower', 'Agahnim 1'], None, ItemFactory(['Small Key (Agahnims Tower)'] * 2), []) + PoD = make_dungeon('Palace of Darkness', ['Dark Palace (Entrance)', 'Dark Palace (Center)', 'Dark Palace (Big Key Chest)', 'Dark Palace (Bonk Section)', 'Dark Palace (North)', 'Dark Palace (Maze)', 'Dark Palace (Spike Statue Room)', 'Dark Palace (Final Section)'], ItemFactory('Big Key (Palace of Darkness)'), ItemFactory(['Small Key (Palace of Darkness)'] * 6), ItemFactory(['Map (Palace of Darkness)', 'Compass (Palace of Darkness)'])) + TT = make_dungeon('Thieves Town', ['Thieves Town (Entrance)', 'Thieves Town (Deep)', 'Blind Fight'], ItemFactory('Big Key (Thieves Town)'), [ItemFactory('Small Key (Thieves Town)')], ItemFactory(['Map (Thieves Town)', 'Compass (Thieves Town)'])) + SW = make_dungeon('Skull Woods', ['Skull Woods Final Section (Entrance)', 'Skull Woods First Section', 'Skull Woods Second Section', 'Skull Woods Final Section (Mothula)'], ItemFactory('Big Key (Skull Woods)'), ItemFactory(['Small Key (Skull Woods)'] * 2), ItemFactory(['Map (Skull Woods)', 'Compass (Skull Woods)'])) + SP = make_dungeon('Swamp Palace', ['Swamp Palace (Entrance)', 'Swamp Palace (First Room)', 'Swamp Palace (Starting Area)', 'Swamp Palace (Center)', 'Swamp Palace (North)'], ItemFactory('Big Key (Swamp Palace)'), [ItemFactory('Small Key (Swamp Palace)')], ItemFactory(['Map (Swamp Palace)', 'Compass (Swamp Palace)'])) + IP = make_dungeon('Ice Palace', ['Ice Palace (Entrance)', 'Ice Palace (Main)', 'Ice Palace (East)', 'Ice Palace (East Top)', 'Ice Palace (Kholdstare)'], ItemFactory('Big Key (Ice Palace)'), ItemFactory(['Small Key (Ice Palace)'] * 2), ItemFactory(['Map (Ice Palace)', 'Compass (Ice Palace)'])) + MM = make_dungeon('Misery Mire', ['Misery Mire (Entrance)', 'Misery Mire (Main)', 'Misery Mire (West)', 'Misery Mire (Final Area)', 'Misery Mire (Vitreous)'], ItemFactory('Big Key (Misery Mire)'), ItemFactory(['Small Key (Misery Mire)'] * 3), ItemFactory(['Map (Misery Mire)', 'Compass (Misery Mire)'])) + TR = make_dungeon('Turtle Rock', ['Turtle Rock (Entrance)', 'Turtle Rock (First Section)', 'Turtle Rock (Chain Chomp Room)', 'Turtle Rock (Second Section)', 'Turtle Rock (Big Chest)', 'Turtle Rock (Roller Switch Room)', 'Turtle Rock (Dark Room)', 'Turtle Rock (Eye Bridge)', 'Turtle Rock (Trinexx)'], ItemFactory('Big Key (Turtle Rock)'), ItemFactory(['Small Key (Turtle Rock)'] * 4), ItemFactory(['Map (Turtle Rock)', 'Compass (Turtle Rock)'])) + GT = make_dungeon('Ganons Tower', ['Ganons Tower (Entrance)', 'Ganons Tower (Tile Room)', 'Ganons Tower (Compass Room)', 'Ganons Tower (Hookshot Room)', 'Ganons Tower (Map Room)', 'Ganons Tower (Firesnake Room)', 'Ganons Tower (Teleport Room)', 'Ganons Tower (Bottom)', 'Ganons Tower (Top)', 'Ganons Tower (Before Moldorm)', 'Ganons Tower (Moldorm)', 'Agahnim 2'], ItemFactory('Big Key (Ganons Tower)'), ItemFactory(['Small Key (Ganons Tower)'] * 4), ItemFactory(['Map (Ganons Tower)', 'Compass (Ganons Tower)'])) + + world.dungeons = [TR, ES, EP, DP, ToH, AT, PoD, TT, SW, IP, MM, GT, SP] + + +def fill_dungeons(world): freebes = ['[dungeon-A2-1F] Ganons Tower - Map Room', '[dungeon-D1-1F] Dark Palace - Spike Statue Room', '[dungeon-D1-1F] Dark Palace - Big Key Room', '[dungeon-D7-B1] Turtle Rock - Big Key Room'] all_state_base = world.get_all_state() @@ -24,7 +35,7 @@ def fill_dungeons(world): world.push_item(world.get_location('[dungeon-D3-B1] Skull Woods - South of Big Chest'), ItemFactory('Small Key (Skull Woods)'), False) world.get_location('[dungeon-D3-B1] Skull Woods - South of Big Chest').event = True - dungeons = [TR, ES, EP, DP, ToH, AT, PoD, TT, SW, IP, MM, GT, SP] + dungeons = [(list(dungeon.regions), dungeon.big_key, list(dungeon.small_keys), list(dungeon.dungeon_items)) for dungeon in world.dungeons] loopcnt = 0 while dungeons: diff --git a/Items.py b/Items.py index fbb53e6e..67e35f73 100644 --- a/Items.py +++ b/Items.py @@ -11,11 +11,11 @@ def ItemFactory(items): singleton = True for item in items: if item in item_table: - advancement, priority, key, crystal, code, altar_hint, altar_credit, sickkid_credit, zora_credit, witch_credit, fluteboy_credit = item_table[item] + advancement, priority, type, code, altar_hint, altar_credit, sickkid_credit, zora_credit, witch_credit, fluteboy_credit = item_table[item] if item == 'Bottle': # randomly fill bottle code = [0x16, 0x2B, 0x2C, 0x2D, 0x3C, 0x3D, 0x48][random.randint(0, 6)] - ret.append(Item(item, advancement, priority, key, crystal, code, altar_hint, altar_credit, sickkid_credit, zora_credit, witch_credit, fluteboy_credit)) + ret.append(Item(item, advancement, priority, type, code, altar_hint, altar_credit, sickkid_credit, zora_credit, witch_credit, fluteboy_credit)) else: logging.getLogger('').warning('Unknown Item: %s' % item) return None @@ -26,135 +26,134 @@ def ItemFactory(items): return ret -# Format: Name: (Advancement, Priority, Key, Crystal, ItemCode, Altar Hint Text, Altar Credit Text, Sick Kid Credit Text, Zora Credit Text, Witch Credit Text, Flute Boy Credit Text) -item_table = {'Bow': (True, False, False, False, 0x0B, 'You have\nchosen the\narcher class.', 'and the D', 'Ex-Adventurer', None, None, None), - 'Book of Mudora': (True, False, False, False, 0x1D, 'This is a\nparadox?!', 'and the Paradox', 'Lazy Reader', None, None, None), - 'Hammer': (True, False, False, False, 0x09, 'stop\nhammer time!', 'and the blunt weapon', None, None, None, None), - 'Hookshot': (True, False, False, False, 0x0A, 'BOING!!!\nBOING!!!\nBOING!!!', 'and the finglonger', None, None, None, None), - 'Magic Mirror': (True, False, False, False, 0x1A, 'Isn\'t your\nreflection so\npretty?', 'and the narcissism', None, None, None, None), - 'Ocarina': (True, False, False, False, 0x14, 'Save the duck\nand fly to\nfreedom!', 'and the sequel bait', None, None, None, None), - 'Pegasus Boots': (True, False, False, False, 0x4B, 'Gotta go fast!', 'and the cowboy boots', None, None, None, None), - 'Power Glove': (True, False, False, False, 0x1B, 'Now you can\nlift weak\nstuff!', 'and the input device', None, None, None, None), - 'Cape': (True, False, False, False, 0x19, 'Wear this to\nbecome\ninvisible!', 'and the invisicloak', None, None, None, None), - 'Mushroom': (True, False, False, False, 0x29, 'I\'m a fun guy!\n\nI\'m a funghi!', 'and the drugs', None, None, None, None), - 'Shovel': (True, False, False, False, 0x13, 'Can\n You\n Dig it?', 'and the fetch quest', None, None, None, None), - 'Lamp': (True, False, False, False, 0x12, 'Baby, baby,\nbaby.\nLight my way!', 'and the light source', None, None, None, None), - 'Magic Powder': (True, False, False, False, 0x0D, 'you can turn\nanti-faeries\ninto fairies', 'and the sprinkles', None, None, None, None), - 'Moon Pearl': (True, False, False, False, 0x1F, ' Bunny Link\n be\n gone!', 'and the debunnifier', None, None, None, None), - 'Cane of Somaria': (True, False, False, False, 0x15, 'I make blocks\nto hold down\nswitches!', 'and the red blocks', None, None, None, None), - 'Fire Rod': (True, False, False, False, 0x07, 'I\'m the hot\nrod. I make\nthings burn!', 'and the flamethrower', None, None, None, None), - 'Flippers': (True, False, False, False, 0x1E, 'fancy a swim?', 'and the toewebs', None, None, None, None), - 'Ice Rod': (True, False, False, False, 0x08, 'I\'m the cold\nrod. I make\nthings freeze!', 'and the ice machine', None, None, None, None), - 'Titans Mitts': (True, False, False, False, 0x1C, 'Now you can\nlift heavy\nstuff!', 'and Midas\' touch', None, None, None, None), - 'Ether': (True, False, False, False, 0x10, 'This magic\ncoin freezes\neverything!', 'and the fancy key', None, None, None, None), - 'Bombos': (True, False, False, False, 0x0F, 'Burn, baby,\nburn! Fear my\nring of fire!', 'and the airstrike', None, None, None, None), - 'Quake': (True, False, False, False, 0x11, 'Maxing out the\nRichter scale\nis what I do!', 'and the fancy key', None, None, None, None), - 'Bottle': (True, False, False, False, 0xFF, 'Now you can\nstore potions\nand stuff!', 'and the bee storage', None, None, None, None), # specific content written on creation - 'Master Sword': (True, False, False, False, 0x50, 'I beat barries and pigs alike', 'and excalibur', None, None, None, None), - 'Tempered Sword': (True, False, False, False, 0x02, 'I stole the\nblacksmith\'s\njob!', 'and the forged bread', None, None, None, None), - 'Fighter Sword': (True, False, False, False, 0x49, 'A pathetic\nsword rests\nhere!', 'and the butter knife', None, None, None, None), - 'Golden Sword': (True, False, False, False, 0x03, 'The butter\nsword rests\nhere!', 'and the butter stick', None, None, None, None), - 'Progressive Sword': (True, False, False, False, 0x5E, 'a better copy\nof your sword\nfor your time', 'and the poke upgrade', None, None, None, None), - 'Progressive Glove': (True, False, False, False, 0x61, 'a way to lift\nheavier things', 'and the lift upgrade', None, None, None, None), - 'Silver Arrows': (True, False, False, False, 0x58, 'Do you fancy\nsilver tipped\narrows?', 'and the pig remover', None, None, None, None), - 'Green Pendant': (True, False, False, True, [0x04, 0x38, 0x62, 0x00, 0x69, 0x01], None, None, None, None, None, None), - 'Red Pendant': (True, False, False, True, [0x02, 0x34, 0x60, 0x00, 0x69, 0x02], None, None, None, None, None, None), - 'Blue Pendant': (True, False, False, True, [0x01, 0x32, 0x60, 0x00, 0x69, 0x03], None, None, None, None, None, None), - 'Triforce': (True, False, False, False, 0x6A, '\n YOU WIN!', 'and the triforce', None, None, None, None), - 'Power Star': (True, False, False, False, 0x6B, 'a small victory', 'and the power star', None, None, None, None), - 'Triforce Piece': (True, False, False, False, 0x6C, 'a small victory', 'and the thirdforce', None, None, None, None), - 'Crystal 1': (True, False, False, True, [0x02, 0x34, 0x64, 0x40, 0x7F, 0x06], None, None, None, None, None, None), - 'Crystal 2': (True, False, False, True, [0x10, 0x34, 0x64, 0x40, 0x79, 0x06], None, None, None, None, None, None), - 'Crystal 3': (True, False, False, True, [0x40, 0x34, 0x64, 0x40, 0x6C, 0x06], None, None, None, None, None, None), - 'Crystal 4': (True, False, False, True, [0x20, 0x34, 0x64, 0x40, 0x6D, 0x06], None, None, None, None, None, None), - 'Crystal 5': (True, False, False, True, [0x04, 0x34, 0x64, 0x40, 0x6E, 0x06], None, None, None, None, None, None), - 'Crystal 6': (True, False, False, True, [0x01, 0x34, 0x64, 0x40, 0x6F, 0x06], None, None, None, None, None, None), - 'Crystal 7': (True, False, False, True, [0x08, 0x34, 0x64, 0x40, 0x7C, 0x06], None, None, None, None, None, None), - 'Single Arrow': (False, False, False, False, 0x43, 'a lonely arrow\nsits here.', 'and the arrow', None, None, None, None), - 'Arrows (10)': (False, False, False, False, 0x44, 'This will give\nyou ten shots\nwith your bow!', 'and the arrow pack', None, None, None, None), - 'Arrow Upgrade (+10)': (False, False, False, False, 0x54, 'increase arrow\nstorage, low\nlow price', 'and the quiver', None, None, None, None), - 'Arrow Upgrade (+5)': (False, False, False, False, 0x53, 'increase arrow\nstorage, low\nlow price', 'and the quiver', None, None, None, None), - 'Single Bomb': (False, False, False, False, 0x27, 'I make things\ngo BOOM! But\njust once.', 'and the explosive', None, None, None, None), - 'Bombs (3)': (False, False, False, False, 0x28, 'I make things\ngo triple\nBOOM!!!', 'and the boombox', None, None, None, None), - 'Bomb Upgrade (+10)': (False, False, False, False, 0x52, 'increase bomb\nstorage, low\nlow price', 'and the bomb bag', None, None, None, None), - 'Bomb Upgrade (+5)': (False, False, False, False, 0x51, 'increase bomb\nstorage, low\nlow price', 'and the bomb bag', None, None, None, None), - 'Blue Mail': (False, True, False, False, 0x22, 'Now you\'re a\nblue elf!', 'and the banana hat', None, None, None, None), - 'Red Mail': (False, True, False, False, 0x23, 'Now you\'re a\nred elf!', 'and the eggplant hat', None, None, None, None), - 'Progressive Armor': (False, True, False, False, 0x60, 'time for a\nchange of\nclothes?', 'and the hurt upgrade', None, None, None, None), - 'Blue Boomerang': (False, True, False, False, 0x0C, 'No matter what\nyou do, blue\nreturns to you', 'and the bluemarang', None, None, None, None), - 'Red Boomerang': (False, True, False, False, 0x2A, 'No matter what\nyou do, red\nreturns to you', 'and the badmarang', None, None, None, None), - 'Blue Shield': (False, True, False, False, 0x04, 'Now you can\ndefend against\npebbles!', 'and the stone blocker', None, None, None, None), - 'Red Shield': (False, True, False, False, 0x05, 'Now you can\ndefend against\nfireballs!', 'and the shot blocker', None, None, None, None), - 'Mirror Shield': (False, True, False, False, 0x06, 'Now you can\ndefend against\nlasers!', 'and the laser blocker', None, None, None, None), - 'Progressive Shield': (False, True, False, False, 0x5F, 'have a better\nblocker in\nfront of you', 'and the new shield', None, None, None, None), - 'Bug Catching Net': (False, True, False, False, 0x21, 'Let\'s catch\nsome bees and\nfaeries!', 'and the bee catcher', None, None, None, None), - 'Cane of Byrna': (True, False, False, False, 0x18, 'Use this to\nbecome\ninvincible!', 'and the bad cane', None, None, None, None), - 'Boss Heart Container': (False, False, False, False, 0x3E, 'Maximum health\nincreased!\nYeah!', 'and the love', None, None, None, None), - 'Sanctuary Heart Container': (False, False, False, False, 0x3F, 'Maximum health\nincreased!\nYeah!', 'and the love', None, None, None, None), - 'Piece of Heart': (False, False, False, False, 0x17, 'Just a little\npiece of love!', 'and the love', None, None, None, None), - 'Rupee (1)': (False, False, False, False, 0x34, 'Just pocket\nchange. Move\nright along.', 'and the cash stash', None, None, None, None), - 'Rupees (5)': (False, False, False, False, 0x35, 'Just pocket\nchange. Move\nright along.', 'and the cash stash', None, None, None, None), - 'Rupees (20)': (False, False, False, False, 0x36, 'Just couch\ncash. Move\nright along.', 'and the cash stash', None, None, None, None), - 'Rupees (50)': (False, False, False, False, 0x41, 'Just couch\ncash. Move\nright along.', 'and the cash stash', None, None, None, None), - 'Rupees (100)': (False, False, False, False, 0x40, 'A rupee stash!\nHell yeah!', 'and the cash stash', None, None, None, None), - 'Rupees (300)': (False, False, False, False, 0x46, 'A rupee hoard!\nHell yeah!', 'and the cash stash', None, None, None, None), - 'Rupoor': (False, False, False, False, 0x59, 'a debt collector', None, None, None, None, None), - 'Red Clock': (False, True, False, False, 0x5B, 'a waste of time', 'and the rolex', None, None, None, None), - 'Blue Clock': (False, True, False, False, 0x5C, 'a bit of time', 'and the rolex', None, None, None, None), - 'Green Clock': (False, True, False, False, 0x5D, 'a lot of time', 'and the rolex', None, None, None, None), - 'Single RNG': (False, True, False, False, 0x62, 'something you don\'t yet have', None, None, None, None, None), - 'Multi RNG': (False, True, False, False, 0x63, 'something you may already have', None, None, None, None, None), - 'Magic Upgrade (1/2)': (True, False, False, False, 0x4E, 'Your magic\npower has been\ndoubled!', 'and the spell power', None, None, None, None), # can be required to beat mothula in an open seed in very very rare circumstance - 'Magic Upgrade (1/4)': (True, False, False, False, 0x4F, 'Your magic\npower has been\nquadrupled!', 'and the spell power', None, None, None, None), # can be required to beat mothula in an open seed in very very rare circumstance - # ToDo Use dungeons specific items once they work correctly - 'Small Key (Eastern Palace)': (False, False, True, False, 0xA2, 'Okay, this\nkey doesn\'t\nreally exist', None, None, None, None, None), - 'Big Key (Eastern Palace)': (False, False, True, False, 0x9D, 'The big key\nof the east', None, None, None, None, None), - 'Compass (Eastern Palace)': (False, True, False, False, 0x8D, None, None, None, None, None, None), - 'Map (Eastern Palace)': (False, True, False, False, 0x7D, None, None, None, None, None, None), - 'Small Key (Desert Palace)': (False, False, True, False, 0xA3, 'Sand spills\nout of this\nsmall key', None, None, None, None, None), - 'Big Key (Desert Palace)': (False, False, True, False, 0x9C, 'Sand spills\nout of this\nbig key', None, None, None, None, None), - 'Compass (Desert Palace)': (False, True, False, False, 0x8C, None, None, None, None, None, None), - 'Map (Desert Palace)': (False, True, False, False, 0x7C, None, None, None, None, None, None), - 'Small Key (Tower of Hera)': (False, False, True, False, 0xAA, 'The key\nto moldorms\nbasement', None, None, None, None, None), - 'Big Key (Tower of Hera)': (False, False, True, False, 0x95, 'The big key\nto moldorms\nheart', None, None, None, None, None), - 'Compass (Tower of Hera)': (False, True, False, False, 0x85, None, None, None, None, None, None), - 'Map (Tower of Hera)': (False, True, False, False, 0x75, None, None, None, None, None, None), - 'Small Key (Escape)': (False, False, True, False, 0xA0, 'The key to\nthe castle', None, None, None, None, None), - 'Big Key (Escape)': (False, False, True, False, 0x9F, 'You should\nhave got this\nfrom a guard', None, None, None, None, None), - 'Map (Escape)': (False, True, False, False, 0x7F, None, None, None, None, None, None), - 'Small Key (Agahnims Tower)': (False, False, True, False, 0xA4, 'Agahanim\nhalfway\nunlocked', None, None, None, None, None), - 'Small Key (Palace of Darkness)': (False, False, True, False, 0xA6, 'A small key\nthat steals\nlight', None, None, None, None, None), - 'Big Key (Palace of Darkness)': (False, False, True, False, 0x99, 'Hammeryump\nwith this\nbig key', None, None, None, None, None), - 'Compass (Palace of Darkness)': (False, True, False, False, 0x89, None, None, None, None, None, None), - 'Map (Palace of Darkness)': (False, True, False, False, 0x79, None, None, None, None, None, None), - 'Small Key (Thieves Town)': (False, False, True, False, 0xAB, 'The small key\nof rouges', None, None, None, None, None), - 'Big Key (Thieves Town)': (False, False, True, False, 0x94, 'The Big Key\nof rouges', None, None, None, None, None), - 'Compass (Thieves Town)': (False, True, False, False, 0x84, None, None, None, None, None, None), - 'Map (Thieves Town)': (False, True, False, False, 0x74, None, None, None, None, None, None), - 'Small Key (Skull Woods)': (False, False, True, False, 0xA8, 'The small key\nof the dark\nforest', None, None, None, None, None), - 'Big Key (Skull Woods)': (False, False, True, False, 0x97, 'The big key\nof the dark\nforest', None, None, None, None, None), - 'Compass (Skull Woods)': (False, True, False, False, 0x87, None, None, None, None, None, None), - 'Map (Skull Woods)': (False, True, False, False, 0x77, None, None, None, None, None, None), - 'Small Key (Swamp Palace)': (False, False, True, False, 0xA5, 'Access to\nthe swamp\nis granted', None, None, None, None, None), - 'Big Key (Swamp Palace)': (False, False, True, False, 0x9A, 'The Big key\nto the swamp', None, None, None, None, None), - 'Compass (Swamp Palace)': (False, True, False, False, 0x8A, None, None, None, None, None, None), - 'Map (Swamp Palace)': (False, True, False, False, 0x7A, None, None, None, None, None, None), - 'Small Key (Ice Palace)': (False, False, True, False, 0xA9, 'A frozen\nsmall key\nrests here', None, None, None, None, None), - 'Big Key (Ice Palace)': (False, False, True, False, 0x96, 'A frozen\nbig key\nrests here', None, None, None, None, None), - 'Compass (Ice Palace)': (False, True, False, False, 0x86, None, None, None, None, None, None), - 'Map (Ice Palace)': (False, True, False, False, 0x76, None, None, None, None, None, None), - 'Small Key (Misery Mire)': (False, False, True, False, 0xA7, 'The small key\nto Vitreous', None, None, None, None, None), - 'Big Key (Misery Mire)': (False, False, True, False, 0x98, 'The big key\nto Vitreous', None, None, None, None, None), - 'Compass (Misery Mire)': (False, True, False, False, 0x88, None, None, None, None, None, None), - 'Map (Misery Mire)': (False, True, False, False, 0x78, None, None, None, None, None, None), - 'Small Key (Turtle Rock)': (False, False, True, False, 0xAC, 'The small key\nof terrorpins', None, None, None, None, None), - 'Big Key (Turtle Rock)': (False, False, True, False, 0x93, 'The big key\nof terrorpins', None, None, None, None, None), - 'Compass (Turtle Rock)': (False, True, False, False, 0x83, None, None, None, None, None, None), - 'Map (Turtle Rock)': (False, True, False, False, 0x73, None, None, None, None, None, None), - 'Small Key (Ganons Tower)': (False, False, True, False, 0xAD, 'The small key\nof evils bane', None, None, None, None, None), - 'Big Key (Ganons Tower)': (False, False, True, False, 0x92, 'The Big Key\nof evils bane', 'la key of evils bane', None, None, None, None), - 'Compass (Ganons Tower)': (False, True, False, False, 0x82, None, None, None, None, None, None), - 'Map (Ganons Tower)': (False, True, False, False, 0x72, None, None, None, None, None, None), - 'Nothing': (False, False, False, False, 0x5A, 'Some Hot Air', 'and the Nothing', None, None, None, None), - 'Beat Agahnim 1': (True, False, False, False, None, None, None, None, None, None, None), - 'Beat Agahnim 2': (True, False, False, False, None, None, None, None, None, None, None)} +# Format: Name: (Advancement, Priority, Type, Crystal, ItemCode, Altar Hint Text, Altar Credit Text, Sick Kid Credit Text, Zora Credit Text, Witch Credit Text, Flute Boy Credit Text) +item_table = {'Bow': (True, False, None, 0x0B, 'You have\nchosen the\narcher class.', 'and the D', 'Ex-Adventurer', None, None, None), + 'Book of Mudora': (True, False, None, 0x1D, 'This is a\nparadox?!', 'and the Paradox', 'Lazy Reader', None, None, None), + 'Hammer': (True, False, None, 0x09, 'stop\nhammer time!', 'and the blunt weapon', None, None, None, None), + 'Hookshot': (True, False, None, 0x0A, 'BOING!!!\nBOING!!!\nBOING!!!', 'and the finglonger', None, None, None, None), + 'Magic Mirror': (True, False, None, 0x1A, 'Isn\'t your\nreflection so\npretty?', 'and the narcissism', None, None, None, None), + 'Ocarina': (True, False, None, 0x14, 'Save the duck\nand fly to\nfreedom!', 'and the sequel bait', None, None, None, None), + 'Pegasus Boots': (True, False, None, 0x4B, 'Gotta go fast!', 'and the cowboy boots', None, None, None, None), + 'Power Glove': (True, False, None, 0x1B, 'Now you can\nlift weak\nstuff!', 'and the input device', None, None, None, None), + 'Cape': (True, False, None, 0x19, 'Wear this to\nbecome\ninvisible!', 'and the invisicloak', None, None, None, None), + 'Mushroom': (True, False, None, 0x29, 'I\'m a fun guy!\n\nI\'m a funghi!', 'and the drugs', None, None, None, None), + 'Shovel': (True, False, None, 0x13, 'Can\n You\n Dig it?', 'and the fetch quest', None, None, None, None), + 'Lamp': (True, False, None, 0x12, 'Baby, baby,\nbaby.\nLight my way!', 'and the light source', None, None, None, None), + 'Magic Powder': (True, False, None, 0x0D, 'you can turn\nanti-faeries\ninto fairies', 'and the sprinkles', None, None, None, None), + 'Moon Pearl': (True, False, None, 0x1F, ' Bunny Link\n be\n gone!', 'and the debunnifier', None, None, None, None), + 'Cane of Somaria': (True, False, None, 0x15, 'I make blocks\nto hold down\nswitches!', 'and the red blocks', None, None, None, None), + 'Fire Rod': (True, False, None, 0x07, 'I\'m the hot\nrod. I make\nthings burn!', 'and the flamethrower', None, None, None, None), + 'Flippers': (True, False, None, 0x1E, 'fancy a swim?', 'and the toewebs', None, None, None, None), + 'Ice Rod': (True, False, None, 0x08, 'I\'m the cold\nrod. I make\nthings freeze!', 'and the ice machine', None, None, None, None), + 'Titans Mitts': (True, False, None, 0x1C, 'Now you can\nlift heavy\nstuff!', 'and Midas\' touch', None, None, None, None), + 'Ether': (True, False, None, 0x10, 'This magic\ncoin freezes\neverything!', 'and the fancy key', None, None, None, None), + 'Bombos': (True, False, None, 0x0F, 'Burn, baby,\nburn! Fear my\nring of fire!', 'and the airstrike', None, None, None, None), + 'Quake': (True, False, None, 0x11, 'Maxing out the\nRichter scale\nis what I do!', 'and the fancy key', None, None, None, None), + 'Bottle': (True, False, None, 0xFF, 'Now you can\nstore potions\nand stuff!', 'and the bee storage', None, None, None, None), # specific content written on creation + 'Master Sword': (True, False, None, 0x50, 'I beat barries and pigs alike', 'and excalibur', None, None, None, None), + 'Tempered Sword': (True, False, None, 0x02, 'I stole the\nblacksmith\'s\njob!', 'and the forged bread', None, None, None, None), + 'Fighter Sword': (True, False, None, 0x49, 'A pathetic\nsword rests\nhere!', 'and the butter knife', None, None, None, None), + 'Golden Sword': (True, False, None, 0x03, 'The butter\nsword rests\nhere!', 'and the butter stick', None, None, None, None), + 'Progressive Sword': (True, False, None, 0x5E, 'a better copy\nof your sword\nfor your time', 'and the poke upgrade', None, None, None, None), + 'Progressive Glove': (True, False, None, 0x61, 'a way to lift\nheavier things', 'and the lift upgrade', None, None, None, None), + 'Silver Arrows': (True, False, None, 0x58, 'Do you fancy\nsilver tipped\narrows?', 'and the pig remover', None, None, None, None), + 'Green Pendant': (True, False, 'Crystal', [0x04, 0x38, 0x62, 0x00, 0x69, 0x01], None, None, None, None, None, None), + 'Red Pendant': (True, False, 'Crystal', [0x02, 0x34, 0x60, 0x00, 0x69, 0x02], None, None, None, None, None, None), + 'Blue Pendant': (True, False, 'Crystal', [0x01, 0x32, 0x60, 0x00, 0x69, 0x03], None, None, None, None, None, None), + 'Triforce': (True, False, None, 0x6A, '\n YOU WIN!', 'and the triforce', None, None, None, None), + 'Power Star': (True, False, None, 0x6B, 'a small victory', 'and the power star', None, None, None, None), + 'Triforce Piece': (True, False, None, 0x6C, 'a small victory', 'and the thirdforce', None, None, None, None), + 'Crystal 1': (True, False, 'Crystal', [0x02, 0x34, 0x64, 0x40, 0x7F, 0x06], None, None, None, None, None, None), + 'Crystal 2': (True, False, 'Crystal', [0x10, 0x34, 0x64, 0x40, 0x79, 0x06], None, None, None, None, None, None), + 'Crystal 3': (True, False, 'Crystal', [0x40, 0x34, 0x64, 0x40, 0x6C, 0x06], None, None, None, None, None, None), + 'Crystal 4': (True, False, 'Crystal', [0x20, 0x34, 0x64, 0x40, 0x6D, 0x06], None, None, None, None, None, None), + 'Crystal 5': (True, False, 'Crystal', [0x04, 0x34, 0x64, 0x40, 0x6E, 0x06], None, None, None, None, None, None), + 'Crystal 6': (True, False, 'Crystal', [0x01, 0x34, 0x64, 0x40, 0x6F, 0x06], None, None, None, None, None, None), + 'Crystal 7': (True, False, 'Crystal', [0x08, 0x34, 0x64, 0x40, 0x7C, 0x06], None, None, None, None, None, None), + 'Single Arrow': (False, False, None, 0x43, 'a lonely arrow\nsits here.', 'and the arrow', None, None, None, None), + 'Arrows (10)': (False, False, None, 0x44, 'This will give\nyou ten shots\nwith your bow!', 'and the arrow pack', None, None, None, None), + 'Arrow Upgrade (+10)': (False, False, None, 0x54, 'increase arrow\nstorage, low\nlow price', 'and the quiver', None, None, None, None), + 'Arrow Upgrade (+5)': (False, False, None, 0x53, 'increase arrow\nstorage, low\nlow price', 'and the quiver', None, None, None, None), + 'Single Bomb': (False, False, None, 0x27, 'I make things\ngo BOOM! But\njust once.', 'and the explosive', None, None, None, None), + 'Bombs (3)': (False, False, None, 0x28, 'I make things\ngo triple\nBOOM!!!', 'and the boombox', None, None, None, None), + 'Bomb Upgrade (+10)': (False, False, None, 0x52, 'increase bomb\nstorage, low\nlow price', 'and the bomb bag', None, None, None, None), + 'Bomb Upgrade (+5)': (False, False, None, 0x51, 'increase bomb\nstorage, low\nlow price', 'and the bomb bag', None, None, None, None), + 'Blue Mail': (False, True, None, 0x22, 'Now you\'re a\nblue elf!', 'and the banana hat', None, None, None, None), + 'Red Mail': (False, True, None, 0x23, 'Now you\'re a\nred elf!', 'and the eggplant hat', None, None, None, None), + 'Progressive Armor': (False, True, None, 0x60, 'time for a\nchange of\nclothes?', 'and the hurt upgrade', None, None, None, None), + 'Blue Boomerang': (False, True, None, 0x0C, 'No matter what\nyou do, blue\nreturns to you', 'and the bluemarang', None, None, None, None), + 'Red Boomerang': (False, True, None, 0x2A, 'No matter what\nyou do, red\nreturns to you', 'and the badmarang', None, None, None, None), + 'Blue Shield': (False, True, None, 0x04, 'Now you can\ndefend against\npebbles!', 'and the stone blocker', None, None, None, None), + 'Red Shield': (False, True, None, 0x05, 'Now you can\ndefend against\nfireballs!', 'and the shot blocker', None, None, None, None), + 'Mirror Shield': (False, True, None, 0x06, 'Now you can\ndefend against\nlasers!', 'and the laser blocker', None, None, None, None), + 'Progressive Shield': (False, True, None, 0x5F, 'have a better\nblocker in\nfront of you', 'and the new shield', None, None, None, None), + 'Bug Catching Net': (False, True, None, 0x21, 'Let\'s catch\nsome bees and\nfaeries!', 'and the bee catcher', None, None, None, None), + 'Cane of Byrna': (True, False, None, 0x18, 'Use this to\nbecome\ninvincible!', 'and the bad cane', None, None, None, None), + 'Boss Heart Container': (False, False, None, 0x3E, 'Maximum health\nincreased!\nYeah!', 'and the love', None, None, None, None), + 'Sanctuary Heart Container': (False, False, None, 0x3F, 'Maximum health\nincreased!\nYeah!', 'and the love', None, None, None, None), + 'Piece of Heart': (False, False, None, 0x17, 'Just a little\npiece of love!', 'and the love', None, None, None, None), + 'Rupee (1)': (False, False, None, 0x34, 'Just pocket\nchange. Move\nright along.', 'and the cash stash', None, None, None, None), + 'Rupees (5)': (False, False, None, 0x35, 'Just pocket\nchange. Move\nright along.', 'and the cash stash', None, None, None, None), + 'Rupees (20)': (False, False, None, 0x36, 'Just couch\ncash. Move\nright along.', 'and the cash stash', None, None, None, None), + 'Rupees (50)': (False, False, None, 0x41, 'Just couch\ncash. Move\nright along.', 'and the cash stash', None, None, None, None), + 'Rupees (100)': (False, False, None, 0x40, 'A rupee stash!\nHell yeah!', 'and the cash stash', None, None, None, None), + 'Rupees (300)': (False, False, None, 0x46, 'A rupee hoard!\nHell yeah!', 'and the cash stash', None, None, None, None), + 'Rupoor': (False, False, None, 0x59, 'a debt collector', None, None, None, None, None), + 'Red Clock': (False, True, None, 0x5B, 'a waste of time', 'and the rolex', None, None, None, None), + 'Blue Clock': (False, True, None, 0x5C, 'a bit of time', 'and the rolex', None, None, None, None), + 'Green Clock': (False, True, None, 0x5D, 'a lot of time', 'and the rolex', None, None, None, None), + 'Single RNG': (False, True, None, 0x62, 'something you don\'t yet have', None, None, None, None, None), + 'Multi RNG': (False, True, None, 0x63, 'something you may already have', None, None, None, None, None), + 'Magic Upgrade (1/2)': (True, False, None, 0x4E, 'Your magic\npower has been\ndoubled!', 'and the spell power', None, None, None, None), # can be required to beat mothula in an open seed in very very rare circumstance + 'Magic Upgrade (1/4)': (True, False, None, 0x4F, 'Your magic\npower has been\nquadrupled!', 'and the spell power', None, None, None, None), # can be required to beat mothula in an open seed in very very rare circumstance + 'Small Key (Eastern Palace)': (False, False, 'SmallKey', 0xA2, 'Okay, this\nkey doesn\'t\nreally exist', None, None, None, None, None), + 'Big Key (Eastern Palace)': (False, False, 'BigKey', 0x9D, 'The big key\nof the east', None, None, None, None, None), + 'Compass (Eastern Palace)': (False, True, 'Compass', 0x8D, None, None, None, None, None, None), + 'Map (Eastern Palace)': (False, True, 'Map', 0x7D, None, None, None, None, None, None), + 'Small Key (Desert Palace)': (False, False, 'SmallKey', 0xA3, 'Sand spills\nout of this\nsmall key', None, None, None, None, None), + 'Big Key (Desert Palace)': (False, False, 'BigKey', 0x9C, 'Sand spills\nout of this\nbig key', None, None, None, None, None), + 'Compass (Desert Palace)': (False, True, 'Compass', 0x8C, None, None, None, None, None, None), + 'Map (Desert Palace)': (False, True, 'Map', 0x7C, None, None, None, None, None, None), + 'Small Key (Tower of Hera)': (False, False, 'SmallKey', 0xAA, 'The key\nto moldorms\nbasement', None, None, None, None, None), + 'Big Key (Tower of Hera)': (False, False, 'BigKey', 0x95, 'The big key\nto moldorms\nheart', None, None, None, None, None), + 'Compass (Tower of Hera)': (False, True, 'Compass', 0x85, None, None, None, None, None, None), + 'Map (Tower of Hera)': (False, True, 'Map', 0x75, None, None, None, None, None, None), + 'Small Key (Escape)': (False, False, 'SmallKey', 0xA0, 'The key to\nthe castle', None, None, None, None, None), + 'Big Key (Escape)': (False, False, 'BigKey', 0x9F, 'You should\nhave got this\nfrom a guard', None, None, None, None, None), + 'Map (Escape)': (False, True, 'Map', 0x7F, None, None, None, None, None, None), + 'Small Key (Agahnims Tower)': (False, False, 'SmallKey', 0xA4, 'Agahanim\nhalfway\nunlocked', None, None, None, None, None), + 'Small Key (Palace of Darkness)': (False, False, 'SmallKey', 0xA6, 'A small key\nthat steals\nlight', None, None, None, None, None), + 'Big Key (Palace of Darkness)': (False, False, 'BigKey', 0x99, 'Hammeryump\nwith this\nbig key', None, None, None, None, None), + 'Compass (Palace of Darkness)': (False, True, 'Compass', 0x89, None, None, None, None, None, None), + 'Map (Palace of Darkness)': (False, True, 'Map', 0x79, None, None, None, None, None, None), + 'Small Key (Thieves Town)': (False, False, 'SmallKey', 0xAB, 'The small key\nof rouges', None, None, None, None, None), + 'Big Key (Thieves Town)': (False, False, 'BigKey', 0x94, 'The Big Key\nof rouges', None, None, None, None, None), + 'Compass (Thieves Town)': (False, True, 'Compass', 0x84, None, None, None, None, None, None), + 'Map (Thieves Town)': (False, True, 'Map', 0x74, None, None, None, None, None, None), + 'Small Key (Skull Woods)': (False, False, 'SmallKey', 0xA8, 'The small key\nof the dark\nforest', None, None, None, None, None), + 'Big Key (Skull Woods)': (False, False, 'BigKey', 0x97, 'The big key\nof the dark\nforest', None, None, None, None, None), + 'Compass (Skull Woods)': (False, True, 'Compass', 0x87, None, None, None, None, None, None), + 'Map (Skull Woods)': (False, True, 'Map', 0x77, None, None, None, None, None, None), + 'Small Key (Swamp Palace)': (False, False, 'SmallKey', 0xA5, 'Access to\nthe swamp\nis granted', None, None, None, None, None), + 'Big Key (Swamp Palace)': (False, False, 'BigKey', 0x9A, 'The Big key\nto the swamp', None, None, None, None, None), + 'Compass (Swamp Palace)': (False, True, 'Compass', 0x8A, None, None, None, None, None, None), + 'Map (Swamp Palace)': (False, True, 'Map', 0x7A, None, None, None, None, None, None), + 'Small Key (Ice Palace)': (False, False, 'SmallKey', 0xA9, 'A frozen\nsmall key\nrests here', None, None, None, None, None), + 'Big Key (Ice Palace)': (False, False, 'BigKey', 0x96, 'A frozen\nbig key\nrests here', None, None, None, None, None), + 'Compass (Ice Palace)': (False, True, 'Compass', 0x86, None, None, None, None, None, None), + 'Map (Ice Palace)': (False, True, 'Map', 0x76, None, None, None, None, None, None), + 'Small Key (Misery Mire)': (False, False, 'SmallKey', 0xA7, 'The small key\nto Vitreous', None, None, None, None, None), + 'Big Key (Misery Mire)': (False, False, 'BigKey', 0x98, 'The big key\nto Vitreous', None, None, None, None, None), + 'Compass (Misery Mire)': (False, True, 'Compass', 0x88, None, None, None, None, None, None), + 'Map (Misery Mire)': (False, True, 'Map', 0x78, None, None, None, None, None, None), + 'Small Key (Turtle Rock)': (False, False, 'SmallKey', 0xAC, 'The small key\nof terrorpins', None, None, None, None, None), + 'Big Key (Turtle Rock)': (False, False, 'BigKey', 0x93, 'The big key\nof terrorpins', None, None, None, None, None), + 'Compass (Turtle Rock)': (False, True, 'Compass', 0x83, None, None, None, None, None, None), + 'Map (Turtle Rock)': (False, True, 'Map', 0x73, None, None, None, None, None, None), + 'Small Key (Ganons Tower)': (False, False, 'SmallKey', 0xAD, 'The small key\nof evils bane', None, None, None, None, None), + 'Big Key (Ganons Tower)': (False, False, 'BigKey', 0x92, 'The Big Key\nof evils bane', 'la key of evils bane', None, None, None, None), + 'Compass (Ganons Tower)': (False, True, 'Compass', 0x82, None, None, None, None, None, None), + 'Map (Ganons Tower)': (False, True, 'Map', 0x72, None, None, None, None, None, None), + 'Nothing': (False, False, None, 0x5A, 'Some Hot Air', 'and the Nothing', None, None, None, None), + 'Beat Agahnim 1': (True, False, 'Event', None, None, None, None, None, None, None), + 'Beat Agahnim 2': (True, False, 'Event', None, None, None, None, None, None, None)} diff --git a/Main.py b/Main.py index 7a64ef04..50c7b495 100644 --- a/Main.py +++ b/Main.py @@ -3,7 +3,7 @@ from Regions import create_regions from EntranceShuffle import link_entrances from Rom import patch_rom, LocalRom, JsonRom from Rules import set_rules -from Dungeons import fill_dungeons +from Dungeons import create_dungeons, fill_dungeons from Items import ItemFactory from collections import OrderedDict import random @@ -29,7 +29,6 @@ def main(args, seed=None): # initialize the world world = World(args.shuffle, args.logic, args.mode, args.difficulty, args.goal, args.algorithm, not args.nodungeonitems, args.beatableonly, args.shuffleganon, args.quickswap) logger = logging.getLogger('') - if seed is None: random.seed(None) world.seed = random.randint(0, 999999999) @@ -40,6 +39,8 @@ def main(args, seed=None): logger.info('ALttP Entrance Randomizer Version %s - Seed: %s\n\n' % (__version__, world.seed)) create_regions(world) + + create_dungeons(world); logger.info('Shuffling the World about.') @@ -158,7 +159,7 @@ def distribute_items_cutoff(world, cutoffrate=0.33): spot_to_fill = None for location in (fill_locations if placed_advancement_items/total_advancement_items < cutoffrate else reversed(fill_locations)): - if world.state.can_reach(location) and location.item_rule(item_to_place): + if world.state.can_reach(location) and location.can_fill(item_to_place): spot_to_fill = location break @@ -230,7 +231,7 @@ def distribute_items_staleness(world): if not progress_done and random.randint(0, location.staleness_count) > 2: continue - if world.state.can_reach(location) and location.item_rule(item_to_place): + if world.state.can_reach(location) and location.can_fill(item_to_place): spot_to_fill = location break else: @@ -239,7 +240,7 @@ def distribute_items_staleness(world): # might have skipped too many locations due to potential staleness. Do not check for staleness now to find a candidate if spot_to_fill is None: for location in fill_locations: - if world.state.can_reach(location) and location.item_rule(item_to_place): + if world.state.can_reach(location) and location.can_fill(item_to_place): spot_to_fill = location break @@ -271,7 +272,7 @@ def fill_restrictive(world, base_state, locations, itempool): spot_to_fill = None for location in locations: - if location.item_rule(item_to_place): + if location.can_fill(item_to_place): if world.check_beatable_only: starting_state = base_state.copy() for item in itempool: @@ -356,7 +357,7 @@ def flood_items(world): random.shuffle(location_list) spot_to_fill = None for location in location_list: - if world.state.can_reach(location) and location.item_rule(itempool[0]): + if world.state.can_reach(location) and location.can_fill(itempool[0]): spot_to_fill = location break @@ -507,6 +508,7 @@ def copy_world(world): ret.seed = world.seed ret.can_access_trock_eyebridge = world.can_access_trock_eyebridge create_regions(ret) + create_dungeons(ret) # connect copied world for region in world.regions: @@ -516,7 +518,7 @@ def copy_world(world): # fill locations for location in world.get_locations(): if location.item is not None: - item = Item(location.item.name, location.item.advancement, location.item.priority, location.item.key) + item = Item(location.item.name, location.item.advancement, location.item.priority, location.item.type) ret.get_location(location.name).item = item item.location = ret.get_location(location.name) if location.event: @@ -524,7 +526,7 @@ def copy_world(world): # copy remaining itempool. No item in itempool should have an assigned location for item in world.itempool: - ret.itempool.append(Item(item.name, item.advancement, item.priority, item.key)) + ret.itempool.append(Item(item.name, item.advancement, item.priority, item.type)) # copy progress items in state ret.state.prog_items = list(world.state.prog_items) diff --git a/Plando.py b/Plando.py index 0bb66b75..68fe5803 100644 --- a/Plando.py +++ b/Plando.py @@ -3,6 +3,7 @@ from Regions import create_regions from EntranceShuffle import link_entrances, connect_entrance, connect_two_way, connect_exit from Rom import patch_rom, LocalRom, write_string_to_rom, write_credits_string_to_rom from Rules import set_rules +from Dungeons import create_dungeons from Items import ItemFactory from Main import create_playthrough import random @@ -42,6 +43,7 @@ def main(args, seed=None): logger.info('ALttP Plandomizer Version %s - Seed: %s\n\n' % (__version__, args.plando)) create_regions(world) + create_dungeons(world) link_entrances(world)