Sm comeback too strict (#755)
This commit is contained in:
parent
0d3bd6e2e8
commit
c806366469
|
@ -7,6 +7,8 @@ import threading
|
|||
import base64
|
||||
from typing import Set, List, TextIO
|
||||
|
||||
from worlds.sm.variaRandomizer.graph.graph_utils import GraphUtils
|
||||
|
||||
logger = logging.getLogger("Super Metroid")
|
||||
|
||||
from .Locations import lookup_name_to_id as locations_lookup_name_to_id
|
||||
|
@ -654,11 +656,10 @@ class SMLocation(Location):
|
|||
def can_comeback(self, state: CollectionState, item: Item):
|
||||
randoExec = state.world.worlds[self.player].variaRando.randoExec
|
||||
for key in locationsDict[self.name].AccessFrom.keys():
|
||||
if (randoExec.areaGraph.canAccess( state.smbm[self.player],
|
||||
key,
|
||||
randoExec.graphSettings.startAP,
|
||||
state.smbm[self.player].maxDiff,
|
||||
None)):
|
||||
if (randoExec.areaGraph.canAccessList( state.smbm[self.player],
|
||||
key,
|
||||
[randoExec.graphSettings.startAP, 'Landing Site'] if not GraphUtils.isStandardStart(randoExec.graphSettings.startAP) else ['Landing Site'],
|
||||
state.smbm[self.player].maxDiff)):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
@ -367,6 +367,22 @@ class AccessGraph(object):
|
|||
#print("canAccess: {}".format(can))
|
||||
return can
|
||||
|
||||
# test access from an access point to a list of others, given an optional item
|
||||
def canAccessList(self, smbm, srcAccessPointName, destAccessPointNameList, maxDiff, item=None):
|
||||
if item is not None:
|
||||
smbm.addItem(item)
|
||||
#print("canAccess: item: {}, src: {}, dest: {}".format(item, srcAccessPointName, destAccessPointName))
|
||||
destAccessPointList = [self.accessPoints[destAccessPointName] for destAccessPointName in destAccessPointNameList]
|
||||
srcAccessPoint = self.accessPoints[srcAccessPointName]
|
||||
availAccessPoints = self.getAvailableAccessPoints(srcAccessPoint, smbm, maxDiff, item)
|
||||
can = any(ap in availAccessPoints for ap in destAccessPointList)
|
||||
# if not can:
|
||||
# self.log.debug("canAccess KO: avail = {}".format([ap.Name for ap in availAccessPoints.keys()]))
|
||||
if item is not None:
|
||||
smbm.removeItem(item)
|
||||
#print("canAccess: {}".format(can))
|
||||
return can
|
||||
|
||||
# returns a list of AccessPoint instances from srcAccessPointName to destAccessPointName
|
||||
# (not including source ap)
|
||||
# or None if no possible path
|
||||
|
|
|
@ -341,6 +341,8 @@ class VariaRandomizer:
|
|||
if preset == 'custom':
|
||||
PresetLoader.factory(world.custom_preset[player].value).load(self.player)
|
||||
elif preset == 'varia_custom':
|
||||
if len(world.varia_custom_preset[player].value) == 0:
|
||||
raise Exception("varia_custom was chosen but varia_custom_preset is missing.")
|
||||
url = 'https://randommetroidsolver.pythonanywhere.com/presetWebService'
|
||||
preset_name = next(iter(world.varia_custom_preset[player].value))
|
||||
payload = '{{"preset": "{}"}}'.format(preset_name)
|
||||
|
|
Loading…
Reference in New Issue