Example #1
0
 def findTo(trFrom):
     ap = getAccessPoint(trFrom)
     fromArea = ap.GraphArea
     targets = [
         apName for apName in apNames if apName not in tTo
         and getAccessPoint(apName).GraphArea != fromArea
     ]
     if len(targets) == 0:  # fallback if no area transition is found
         targets = [apName for apName in apNames if apName != ap.Name]
     return targets[random.randint(0, len(targets) - 1)]
 def lateMorphInit(self, ap, emptyContainer, services):
     assert self.isLateMorph()
     morph = emptyContainer.getNextItemInPool('Morph')
     assert morph is not None
     locs = services.possibleLocations(morph, ap, emptyContainer)
     self.log.debug('lateMorphInit. locs=' + getLocListStr(locs))
     self.lateMorphLimit = len(locs)
     if len(set([loc['GraphArea'] for loc in locs])) > 1:
         self.lateMorphForbiddenArea = getAccessPoint(ap).GraphArea
     else:
         self.lateMorphForbiddenArea = None
 def checkStart(self):
     ap = getAccessPoint(self.startAP)
     if not self.graphSettings.areaRando or ap.Start is None or \
        (('needsPreRando' not in ap.Start or not ap.Start['needsPreRando']) and\
         ('areaMode' not in ap.Start or not ap.Start['areaMode'])):
         return True
     self.log.debug("********* PRE RANDO START")
     container = copy.copy(self.container)
     filler = FrontFiller(self.startAP, self.areaGraph, self.restrictions,
                          container)
     condition = filler.createStepCountCondition(4)
     (isStuck, itemLocations, progItems) = filler.generateItems(condition)
     self.log.debug("********* PRE RANDO END")
     return not isStuck and len(
         self.services.currentLocations(filler.ap, filler.container)) > 0
 def generateItem(self):
     itemLocDict, possibleProg = self.services.getPossiblePlacements(self.ap, self.container, self.getComebackCheck())
     if self.isEarlyGame() and possibleProg == True:
         # cheat a little bit if non-standard start: place early
         # progression away from crateria/blue brin if possible
         startAp = getAccessPoint(self.startAP)
         if startAp.GraphArea != "Crateria":
             newItemLocDict = {}
             for w, locs in itemLocDict.items():
                 filtered = [loc for loc in locs if loc['GraphArea'] != 'Crateria']
                 if len(filtered) > 0:
                     newItemLocDict[w] = filtered
             if len(newItemLocDict) > 0:
                 itemLocDict = newItemLocDict
     itemLoc = self.chooseItemLoc(itemLocDict, possibleProg)
     self.log.debug("generateItem. itemLoc="+"None" if itemLoc is None else getItemLocStr(itemLoc))
     return itemLoc
Example #5
0
 def isVanillaCroc(self):
     crocRoom = getAccessPoint('Crocomire Room Top')
     return SMBool(crocRoom.ConnectedTo == 'Crocomire Speedway Bottom')
Example #6
0
 def getDraygonConnection(self):
     return getAccessPoint('DraygonRoomOut').ConnectedTo
 def getDraygonConnection(self):
     if self.draygonConnection is None:
         drayRoomOut = getAccessPoint('DraygonRoomOut')
         self.draygonConnection = drayRoomOut.ConnectedTo
     return self.draygonConnection
            if args.startLocationList != None:
                # intersection between user whishes and reality
                startLocationList = args.startLocationList.split(',')
                possibleStartAPs = sorted(list(set(possibleStartAPs).intersection(set(startLocationList))))
                if len(possibleStartAPs) == 0:
                    reasonStr = '\n'.join(["%s : %s" % (apName, cause) for apName, cause in reasons.items() if apName in startLocationList])
                    optErrMsg += '\nInvalid start locations list with your settings.\n'+reasonStr
                    dumpErrorMsg(args.output, optErrMsg)
                    sys.exit(-1)
            args.startAP = random.choice(possibleStartAPs)
        elif args.startAP not in possibleStartAPs:
            optErrMsg += '\nInvalid start location: {}. {}'.format(args.startAP, reasons[args.startAP])
            optErrMsg += '\nPossible start locations with these settings: {}'.format(possibleStartAPs)
            dumpErrorMsg(args.output, optErrMsg)
            sys.exit(-1)
    ap = getAccessPoint(args.startAP)
    if 'forcedEarlyMorph' in ap.Start and ap.Start['forcedEarlyMorph'] == True:
        optErrMsg += forceArg('morphPlacement', 'early', "'Morph Placement' forced to early for custom start location")
    else:
        if progSpeed == 'speedrun':
            if args.morphPlacement == 'late':
                optErrMsg += forceArg('morphPlacement', 'normal', "'Morph Placement' forced to normal instead of late")
            elif (not GraphUtils.isStandardStart(args.startAP)) and args.morphPlacement != 'normal':
                optErrMsg += forceArg('morphPlacement', 'normal', "'Morph Placement' forced to normal for custom start location")
        if args.majorsSplit == 'Chozo' and args.morphPlacement == "late":
            optErrMsg += forceArg('morphPlacement', 'normal', "'Morph Placement' forced to normal for Chozo")

    if args.patchOnly == False:
        print("SEED: " + str(seed))

    # fill restrictions dict