logging.getLogger('').debug('Building up collection spheres.')
whilesphere_candidates:
sphere=[]
# build up spheres of collection radius. Everything in each sphere is independent from each other in dependencies and only depends on lower spheres
forlocationinsphere_candidates:
ifstate.can_reach(location):
sphere.append(location)
forlocationinsphere:
sphere_candidates.remove(location)
state.collect(location.item)
collection_spheres.append(sphere)
logging.getLogger('').debug('Calculated sphere %i, containing %i of %i progress items.'%(len(collection_spheres),len(sphere),len(prog_locations)))
ifnotsphere:
logging.getLogger('').debug('The following items could not be placed: %s'%['%s at %s'%(location.item.name,location.name)forlocationinsphere_candidates])
raiseRuntimeError('Not all progression items reachable. Something went terribly wrong here.')
# in the second phase, we cull each sphere such that the game is still beatable, reducing each range of influence to the bare minimum required inside it
forsphereinreversed(collection_spheres):
to_delete=[]
forlocationinsphere:
# we remove the item at location and check if game is still beatable
logging.getLogger('').debug('Checking if %s is required to beat the game.'%location.item.name)
old_item=location.item
location.item=None
state.remove(old_item)
world._item_cache={}# need to invalidate
ifworld.can_beat_game():
to_delete.append(location)
else:
# still required, got to keep it around
location.item=old_item
# cull entries in spheres for spoiler walkthrough at end
forlocationinto_delete:
sphere.remove(location)
# we are now down to just the required progress items in collection_spheres in a minimum number of spheres. As a cleanup, we right trim empty spheres (can happen if we have multiple triforces)
parser.add_argument('--loglevel',default='info',const='info',nargs='?',choices=['error','info','warning','debug'],help='Select level of logging for output.')
parser.add_argument('--seed',help='Define seed number to generate.',type=int)
parser.add_argument('--quickswap',help='Enable quick item swapping with L and R.',action='store_true')
help='Select the rate at which the heart beep sound is played at low health.')
parser.add_argument('--sprite',help='Path to a sprite sheet to use for Link. Needs to be in binary format and have a length of 0x7000 (28672) bytes.')
parser.add_argument('--plando',help='Filled out template to use for setting up the rom.')
args=parser.parse_args()
# ToDo: Validate files further than mere existance
ifnotos.path.isfile(args.rom):
input('Could not find valid base rom for patching at expected path %s. Please run with -h to see help for further information. \nPress Enter to exit.'%args.rom)
exit(1)
ifnotos.path.isfile(args.plando):
input('Could not find Plandomizer distribution at expected path %s. Please run with -h to see help for further information. \nPress Enter to exit.'%args.plando)