Whitespace fixes
This commit is contained in:
parent
cdf04b8a45
commit
5b3d4449c1
|
@ -13,6 +13,7 @@ class ArgumentDefaultsHelpFormatter(argparse.RawTextHelpFormatter):
|
||||||
def _get_help_string(self, action):
|
def _get_help_string(self, action):
|
||||||
return textwrap.dedent(action.help)
|
return textwrap.dedent(action.help)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
|
parser = argparse.ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
|
||||||
parser.add_argument('--create_spoiler', help='Output a Spoiler File', action='store_true')
|
parser.add_argument('--create_spoiler', help='Output a Spoiler File', action='store_true')
|
||||||
|
|
5
Fill.py
5
Fill.py
|
@ -1,6 +1,7 @@
|
||||||
import random
|
import random
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
def distribute_items_cutoff(world, cutoffrate=0.33):
|
def distribute_items_cutoff(world, cutoffrate=0.33):
|
||||||
# get list of locations to fill in
|
# get list of locations to fill in
|
||||||
fill_locations = world.get_unfilled_locations()
|
fill_locations = world.get_unfilled_locations()
|
||||||
|
@ -55,7 +56,7 @@ def distribute_items_cutoff(world, cutoffrate=0.33):
|
||||||
raise RuntimeError('No more progress items left to place.')
|
raise RuntimeError('No more progress items left to place.')
|
||||||
|
|
||||||
spot_to_fill = None
|
spot_to_fill = None
|
||||||
for location in (fill_locations if placed_advancement_items/total_advancement_items < cutoffrate else reversed(fill_locations)):
|
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.can_fill(item_to_place):
|
if world.state.can_reach(location) and location.can_fill(item_to_place):
|
||||||
spot_to_fill = location
|
spot_to_fill = location
|
||||||
break
|
break
|
||||||
|
@ -199,7 +200,7 @@ def fill_restrictive(world, base_state, locations, itempool):
|
||||||
spot_to_fill.event = True
|
spot_to_fill.event = True
|
||||||
|
|
||||||
|
|
||||||
def distribute_items_restrictive(world, gftower_trash_count=0,fill_locations=None):
|
def distribute_items_restrictive(world, gftower_trash_count=0, fill_locations=None):
|
||||||
# If not passed in, then get a shuffled list of locations to fill in
|
# If not passed in, then get a shuffled list of locations to fill in
|
||||||
if not fill_locations:
|
if not fill_locations:
|
||||||
fill_locations = world.get_unfilled_locations()
|
fill_locations = world.get_unfilled_locations()
|
||||||
|
|
1
Gui.py
1
Gui.py
|
@ -45,6 +45,7 @@ def guiMain(args=None):
|
||||||
baseRomLabel = Label(romDialogFrame, text='Base Rom')
|
baseRomLabel = Label(romDialogFrame, text='Base Rom')
|
||||||
romVar = StringVar()
|
romVar = StringVar()
|
||||||
romEntry = Entry(romDialogFrame, textvariable=romVar)
|
romEntry = Entry(romDialogFrame, textvariable=romVar)
|
||||||
|
|
||||||
def RomSelect():
|
def RomSelect():
|
||||||
rom = filedialog.askopenfilename()
|
rom = filedialog.askopenfilename()
|
||||||
romVar.set(rom)
|
romVar.set(rom)
|
||||||
|
|
5
Main.py
5
Main.py
|
@ -41,7 +41,7 @@ def main(args, seed=None):
|
||||||
|
|
||||||
create_regions(world)
|
create_regions(world)
|
||||||
|
|
||||||
create_dungeons(world);
|
create_dungeons(world)
|
||||||
|
|
||||||
logger.info('Shuffling the World about.')
|
logger.info('Shuffling the World about.')
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ def main(args, seed=None):
|
||||||
else:
|
else:
|
||||||
sprite = None
|
sprite = None
|
||||||
|
|
||||||
outfilebase = 'ER_%s_%s-%s-%s_%s-%s%s%s%s%s_%s' % (world.logic, world.difficulty, world.mode, world.goal, world.shuffle, world.algorithm, "-keysanity" if world.keysanity else "", "-fastmenu" if world.fastmenu else "","-quickswap" if world.quickswap else "", "-shuffleganon" if world.shuffle_ganon else "", world.seed)
|
outfilebase = 'ER_%s_%s-%s-%s_%s-%s%s%s%s%s_%s' % (world.logic, world.difficulty, world.mode, world.goal, world.shuffle, world.algorithm, "-keysanity" if world.keysanity else "", "-fastmenu" if world.fastmenu else "", "-quickswap" if world.quickswap else "", "-shuffleganon" if world.shuffle_ganon else "", world.seed)
|
||||||
|
|
||||||
if not args.suppress_rom:
|
if not args.suppress_rom:
|
||||||
if args.jsonout:
|
if args.jsonout:
|
||||||
|
@ -315,4 +315,3 @@ def create_playthrough(world):
|
||||||
|
|
||||||
# we can finally output our playthrough
|
# we can finally output our playthrough
|
||||||
old_world.spoiler.playthrough = OrderedDict([(str(i + 1), {str(location): str(location.item) for location in sphere}) for i, sphere in enumerate(collection_spheres)])
|
old_world.spoiler.playthrough = OrderedDict([(str(i + 1), {str(location): str(location.item) for location in sphere}) for i, sphere in enumerate(collection_spheres)])
|
||||||
|
|
||||||
|
|
18
Rom.py
18
Rom.py
|
@ -83,12 +83,14 @@ def patch_rom(world, rom, hashtable, beep='normal', sprite=None):
|
||||||
|
|
||||||
locationaddress = location.address
|
locationaddress = location.address
|
||||||
if not location.crystal:
|
if not location.crystal:
|
||||||
#Keys in their native dungeon should use the orignal item code for keys
|
# Keys in their native dungeon should use the orignal item code for keys
|
||||||
if location.parent_region.dungeon:
|
if location.parent_region.dungeon:
|
||||||
dungeon=location.parent_region.dungeon
|
dungeon = location.parent_region.dungeon
|
||||||
if location.item.key and dungeon.is_dungeon_item(location.item):
|
if location.item.key and dungeon.is_dungeon_item(location.item):
|
||||||
if location.item.type == "BigKey": itemid = 0x32
|
if location.item.type == "BigKey":
|
||||||
if location.item.type == "SmallKey": itemid = 0x24
|
itemid = 0x32
|
||||||
|
if location.item.type == "SmallKey":
|
||||||
|
itemid = 0x24
|
||||||
rom.write_byte(locationaddress, itemid)
|
rom.write_byte(locationaddress, itemid)
|
||||||
else:
|
else:
|
||||||
# crystals
|
# crystals
|
||||||
|
@ -105,7 +107,7 @@ def patch_rom(world, rom, hashtable, beep='normal', sprite=None):
|
||||||
rom.write_byte(music_address, music)
|
rom.write_byte(music_address, music)
|
||||||
|
|
||||||
if world.keysanity:
|
if world.keysanity:
|
||||||
rom.write_byte(0x155C9, random.choice([0x11, 0x16])) #Randomize GT music too in keysanity mode
|
rom.write_byte(0x155C9, random.choice([0x11, 0x16])) # Randomize GT music too in keysanity mode
|
||||||
|
|
||||||
# patch entrances
|
# patch entrances
|
||||||
for region in world.regions:
|
for region in world.regions:
|
||||||
|
@ -319,9 +321,9 @@ def patch_rom(world, rom, hashtable, beep='normal', sprite=None):
|
||||||
|
|
||||||
# compasses showing dungeon count
|
# compasses showing dungeon count
|
||||||
if world.clock_mode != 'off':
|
if world.clock_mode != 'off':
|
||||||
rom.write_byte(0x18003C, 0x00) #Currently must be off if timer is on, because they use same HUD location
|
rom.write_byte(0x18003C, 0x00) # Currently must be off if timer is on, because they use same HUD location
|
||||||
elif world.keysanity:
|
elif world.keysanity:
|
||||||
rom.write_byte(0x18003C, 0x01) #show on pickup
|
rom.write_byte(0x18003C, 0x01) # show on pickup
|
||||||
else:
|
else:
|
||||||
rom.write_byte(0x18003C, 0x00)
|
rom.write_byte(0x18003C, 0x00)
|
||||||
|
|
||||||
|
@ -375,7 +377,7 @@ def patch_rom(world, rom, hashtable, beep='normal', sprite=None):
|
||||||
rom.write_byte(0x15E25, 0xA4)
|
rom.write_byte(0x15E25, 0xA4)
|
||||||
# todo fix screen scrolling
|
# todo fix screen scrolling
|
||||||
|
|
||||||
#enable instant item menu
|
# enable instant item menu
|
||||||
if world.fastmenu:
|
if world.fastmenu:
|
||||||
rom.write_byte(0x180048, 0x01)
|
rom.write_byte(0x180048, 0x01)
|
||||||
# Sound twekas for fastmenu:
|
# Sound twekas for fastmenu:
|
||||||
|
|
12
Rules.py
12
Rules.py
|
@ -20,8 +20,6 @@ def set_rules(world):
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError('Not implemented yet')
|
raise NotImplementedError('Not implemented yet')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if world.goal == 'dungeons':
|
if world.goal == 'dungeons':
|
||||||
# require all dungeons to beat ganon
|
# require all dungeons to beat ganon
|
||||||
add_rule(world.get_location('Ganon'), lambda state: state.can_reach('Master Sword Pedestal', 'Location') and state.has('Beat Agahnim 1') and state.has('Beat Agahnim 2'))
|
add_rule(world.get_location('Ganon'), lambda state: state.can_reach('Master Sword Pedestal', 'Location') and state.has('Beat Agahnim 1') and state.has('Beat Agahnim 2'))
|
||||||
|
@ -56,9 +54,10 @@ def forbid_item(location, item):
|
||||||
old_rule = location.item_rule
|
old_rule = location.item_rule
|
||||||
location.item_rule = lambda i: i.name != item and old_rule(i)
|
location.item_rule = lambda i: i.name != item and old_rule(i)
|
||||||
|
|
||||||
|
|
||||||
def item_in_locations(state, item, locations):
|
def item_in_locations(state, item, locations):
|
||||||
for location in locations:
|
for location in locations:
|
||||||
loc=state.world.get_location(location)
|
loc = state.world.get_location(location)
|
||||||
if loc.item is not None and loc.item.name == item:
|
if loc.item is not None and loc.item.name == item:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -209,7 +208,6 @@ def global_rules(world):
|
||||||
for location in ['Desert Palace - Lanmolas', 'Desert Palace - Big Key Chest', 'Desert Palace - Compass Chest']:
|
for location in ['Desert Palace - Lanmolas', 'Desert Palace - Big Key Chest', 'Desert Palace - Compass Chest']:
|
||||||
forbid_item(world.get_location(location), 'Small Key (Desert Palace)')
|
forbid_item(world.get_location(location), 'Small Key (Desert Palace)')
|
||||||
|
|
||||||
|
|
||||||
set_rule(world.get_entrance('Tower of Hera Small Key Door'), lambda state: state.has('Small Key (Tower of Hera)'))
|
set_rule(world.get_entrance('Tower of Hera Small Key Door'), lambda state: state.has('Small Key (Tower of Hera)'))
|
||||||
set_rule(world.get_entrance('Tower of Hera Big Key Door'), lambda state: state.has('Big Key (Tower of Hera)'))
|
set_rule(world.get_entrance('Tower of Hera Big Key Door'), lambda state: state.has('Big Key (Tower of Hera)'))
|
||||||
set_rule(world.get_location('Tower of Hera - Big Chest'), lambda state: state.has('Big Key (Tower of Hera)'))
|
set_rule(world.get_location('Tower of Hera - Big Chest'), lambda state: state.has('Big Key (Tower of Hera)'))
|
||||||
|
@ -242,7 +240,7 @@ def global_rules(world):
|
||||||
|
|
||||||
set_rule(world.get_entrance('Skull Woods First Section South Door'), lambda state: state.has('Small Key (Skull Woods)'))
|
set_rule(world.get_entrance('Skull Woods First Section South Door'), lambda state: state.has('Small Key (Skull Woods)'))
|
||||||
set_rule(world.get_entrance('Skull Woods First Section (Right) North Door'), lambda state: state.has('Small Key (Skull Woods)'))
|
set_rule(world.get_entrance('Skull Woods First Section (Right) North Door'), lambda state: state.has('Small Key (Skull Woods)'))
|
||||||
set_rule(world.get_entrance('Skull Woods First Section West Door'), lambda state: state.has('Small Key (Skull Woods)', 2)) #ideally would only be one key, but we may have spent thst key already on escaping the right section
|
set_rule(world.get_entrance('Skull Woods First Section West Door'), lambda state: state.has('Small Key (Skull Woods)', 2)) # ideally would only be one key, but we may have spent thst key already on escaping the right section
|
||||||
set_rule(world.get_entrance('Skull Woods First Section (Left) Door to Exit'), lambda state: state.has('Small Key (Skull Woods)', 2))
|
set_rule(world.get_entrance('Skull Woods First Section (Left) Door to Exit'), lambda state: state.has('Small Key (Skull Woods)', 2))
|
||||||
set_rule(world.get_location('Skull Woods - Big Chest'), lambda state: state.has('Big Key (Skull Woods)'))
|
set_rule(world.get_location('Skull Woods - Big Chest'), lambda state: state.has('Big Key (Skull Woods)'))
|
||||||
set_rule(world.get_entrance('Skull Woods Torch Room'), lambda state: state.has('Small Key (Skull Woods)', 3) and state.has('Fire Rod') and state.has_sword()) # sword required for curtain
|
set_rule(world.get_entrance('Skull Woods Torch Room'), lambda state: state.has('Small Key (Skull Woods)', 3) and state.has('Fire Rod') and state.has_sword()) # sword required for curtain
|
||||||
|
@ -254,7 +252,7 @@ def global_rules(world):
|
||||||
set_rule(world.get_entrance('Ice Palace Entrance Room'), lambda state: state.has('Fire Rod') or (state.has('Bombos') and state.has_sword()))
|
set_rule(world.get_entrance('Ice Palace Entrance Room'), lambda state: state.has('Fire Rod') or (state.has('Bombos') and state.has_sword()))
|
||||||
set_rule(world.get_location('Ice Palace - Big Chest'), lambda state: state.has('Big Key (Ice Palace)'))
|
set_rule(world.get_location('Ice Palace - Big Chest'), lambda state: state.has('Big Key (Ice Palace)'))
|
||||||
set_rule(world.get_entrance('Ice Palace (Kholdstare)'), lambda state: state.can_lift_rocks() and state.has('Hammer') and state.has('Big Key (Ice Palace)') and (state.has('Small Key (Ice Palace)', 2) or (state.has('Cane of Somaria') and state.has('Small Key (Ice Palace)', 1))))
|
set_rule(world.get_entrance('Ice Palace (Kholdstare)'), lambda state: state.can_lift_rocks() and state.has('Hammer') and state.has('Big Key (Ice Palace)') and (state.has('Small Key (Ice Palace)', 2) or (state.has('Cane of Somaria') and state.has('Small Key (Ice Palace)', 1))))
|
||||||
set_rule(world.get_entrance('Ice Palace (East)'), lambda state: (state.has('Hookshot') or (item_in_locations(state,'Big Key (Ice Palace)',['Ice Palace - Spike Room','Ice Palace - Big Key Chest','Ice Palace - Map Chest']) and state.has('Small Key (Ice Palace)')) or state.has('Small Key (Ice Palace)',2)) and (state.has('Hookshot') or state.has('Cape') or state.has('Cane of Byrna')))
|
set_rule(world.get_entrance('Ice Palace (East)'), lambda state: (state.has('Hookshot') or (item_in_locations(state, 'Big Key (Ice Palace)', ['Ice Palace - Spike Room', 'Ice Palace - Big Key Chest', 'Ice Palace - Map Chest']) and state.has('Small Key (Ice Palace)')) or state.has('Small Key (Ice Palace)', 2)) and (state.has('Hookshot') or state.has('Cape') or state.has('Cane of Byrna')))
|
||||||
set_rule(world.get_entrance('Ice Palace (East Top)'), lambda state: state.can_lift_rocks() and state.has('Hammer'))
|
set_rule(world.get_entrance('Ice Palace (East Top)'), lambda state: state.can_lift_rocks() and state.has('Hammer'))
|
||||||
for location in ['Ice Palace - Big Chest', 'Ice Palace - Kholdstare']:
|
for location in ['Ice Palace - Big Chest', 'Ice Palace - Kholdstare']:
|
||||||
forbid_item(world.get_location(location), 'Big Key (Ice Palace)')
|
forbid_item(world.get_location(location), 'Big Key (Ice Palace)')
|
||||||
|
@ -531,7 +529,7 @@ def set_big_bomb_rules(world):
|
||||||
'Cave Shop (Dark Death Mountain)',
|
'Cave Shop (Dark Death Mountain)',
|
||||||
'Dark Death Mountain Fairy',
|
'Dark Death Mountain Fairy',
|
||||||
'Mimic Cave Mirror Spot']
|
'Mimic Cave Mirror Spot']
|
||||||
Isolated_LW_entrances =['Capacity Upgrade',
|
Isolated_LW_entrances = ['Capacity Upgrade',
|
||||||
'Hookshot Fairy']
|
'Hookshot Fairy']
|
||||||
set_rule(world.get_entrance('Pyramid Fairy'), lambda state: state.has_Pearl() and state.can_reach('Big Bomb Shop', 'Region') and state.has('Crystal 5') and state.has('Crystal 6'))
|
set_rule(world.get_entrance('Pyramid Fairy'), lambda state: state.has_Pearl() and state.can_reach('Big Bomb Shop', 'Region') and state.has('Crystal 5') and state.has('Crystal 6'))
|
||||||
if bombshop_entrance.name in Normal_LW_entrances:
|
if bombshop_entrance.name in Normal_LW_entrances:
|
||||||
|
|
Loading…
Reference in New Issue