Skip to content

Commit 0e0179d

Browse files
lordlouFlySniper
authored andcommitted
SM: 0.4.1 Fixes and Additional Objective Options (ArchipelagoMW#1859)
* first working (most of the time) progression generation for SM using VariaRandomizer's rules, items, locations and accessPoint (as regions) * first working single-world randomized SM rom patches * - SM now displays message when getting an item outside for someone else (fills ROM item table) This is dependant on modifications done to sm_randomizer_rom project * First working MultiWorld SM * some missing things: - player name inject in ROM and get in client - end game get from ROM in client - send self item to server - add player names table in ROM * replaced CollectionState inheritance from SMBoolManager with a composition of an array of it (required to generation more than one SM world, which is still fails but is better) * - reenabled balancing * post rebase fixes * updated SmClient.py * + added VariaRandomizer LICENSE * + added sm_randomizer_rom project (which builds sm.ips) * Moved VariaRandomizer and sm_randomizer_rom projects inside worlds/sm and done some cleaning * properly revert change made to CollectionState and more cleaning * Fixed multiworld support patch not working with VariaRandomizer's * missing file commit * Fixed syntax error in unused code to satisfy Linter * Revert "Fixed multiworld support patch not working with VariaRandomizer's" This reverts commit fb3ca18. * many fixes and improovement - fixed seeded generation - fixed broken logic when more than one SM world - added missing rules for inter-area transitions - added basic patch presence for logic - added DoorManager init call to reflect present patches for logic - moved CollectionState addition out of BaseClasses into SM world - added condition to apply progitempool presorting only if SM world is present - set Bosses item id to None to prevent them going into multidata - now use get_game_players * first working (most of the time) progression generation for SM using VariaRandomizer's rules, items, locations and accessPoint (as regions) * first working single-world randomized SM rom patches * - SM now displays message when getting an item outside for someone else (fills ROM item table) This is dependant on modifications done to sm_randomizer_rom project * First working MultiWorld SM * some missing things: - player name inject in ROM and get in client - end game get from ROM in client - send self item to server - add player names table in ROM * replaced CollectionState inheritance from SMBoolManager with a composition of an array of it (required to generation more than one SM world, which is still fails but is better) * - reenabled balancing * post rebase fixes * updated SmClient.py * + added VariaRandomizer LICENSE * + added sm_randomizer_rom project (which builds sm.ips) * Moved VariaRandomizer and sm_randomizer_rom projects inside worlds/sm and done some cleaning * properly revert change made to CollectionState and more cleaning * Fixed multiworld support patch not working with VariaRandomizer's * missing file commit * Fixed syntax error in unused code to satisfy Linter * Revert "Fixed multiworld support patch not working with VariaRandomizer's" This reverts commit fb3ca18. * many fixes and improovement - fixed seeded generation - fixed broken logic when more than one SM world - added missing rules for inter-area transitions - added basic patch presence for logic - added DoorManager init call to reflect present patches for logic - moved CollectionState addition out of BaseClasses into SM world - added condition to apply progitempool presorting only if SM world is present - set Bosses item id to None to prevent them going into multidata - now use get_game_players * Fixed multiworld support patch not working with VariaRandomizer's Added stage_fill_hook to set morph first in progitempool Added back VariaRandomizer's standard patches * + added missing files from variaRandomizer project * + added missing variaRandomizer files (custom sprites) + started integrating VariaRandomizer options (WIP) * Some fixes for player and server name display - fixed player name of 16 characters reading too far in SM client - fixed 12 bytes SM player name limit (now 16) - fixed server name not being displayed in SM when using server cheat ( now displays RECEIVED FROM ARCHIPELAGO) - request: temporarly changed default seed names displayed in SM main menu to OWTCH * Fixed Goal completion not triggering in smClient * integrated VariaRandomizer's options into AP (WIP) - startAP is working - door rando is working - skillset is working * - fixed itemsounds.ips crash by always including nofanfare.ips into multiworld.ips (itemsounds is now always applied and "itemsounds" preset must always be "off") * skillset are now instanced per player instead of being a singleton class * RomPatches are now instanced per player instead of being a singleton class * DoorManager is now instanced per player instead of being a singleton class * - fixed the last bugs that prevented generation of >1 SM world * fixed crash when no skillset preset is specified in randoPreset (default to "casual") * maxDifficulty support and itemsounds removal - added support for maxDifficulty - removed itemsounds patch as its always applied from multiworld patch for now * Fixed bad merge * Post merge adaptation * fixed player name length fix that got lost with the merge * fixed generation with other game type than SM * added default randoPreset json for SM in playerSettings.yaml * fixed broken SM client following merge * beautified json skillset presets * Fixed ArchipelagoSmClient not building * Fixed conflict between mutliworld patch and beam_doors_plms patch - doorsColorsRando now working * SM generation now outputs APBP - Fixed paths for patches and presets when frozen * added missing file and fixed multithreading issue * temporarily set data_version = 0 * more work - added support for AP starting items - fixed client crash with gamemode being None - patch.py "compatible_version" is now 3 * commited missing asm files fixed start item reserve breaking game (was using bad write offset when patching) * Nothing item are now handled game-side. the game will now skip displaying a message box for received Nothing item (but the client will still receive it). fixed crash in SMClient when loosing connection to SNI * fixed No Energy Item missing its ID fixed Plando * merge post fixes * fixed start item Grapple, XRay and Reserve HUD, as well as graphic beams (except ice palette color) * fixed freeze in blue brinstar caused by Varia's custom PLM not being filled with proper Multiworld PLM address (altLocsAddresses) * fixed start item x-ray HUD display * Fixed start items being sent by the server (is all handled in ROM) Start items are now not removed from itempool anymore Nothing Item is now local_items so no player will ever pickup Nothing. Doing so reduces contribution of this world to the Multiworld the more Nothing there is though. Fixed crash (and possibly passing but broken) at generation where the static list of IPSPatches used by all SM worlds was being modified * fixed settings that could be applied to any SM players * fixed auth to server only using player name (now does as ALTTP to authenticate) * - fixed End Credits broken text * added non SM item name display * added all supported SM options in playerSettings.yaml * fixed locations needing a list of parent regions (now generate a region for each location with one-way exits to each (previously) parent region did some cleaning (mainly reverts on unnecessary core classes * minor setting fixes and tweaks - merged Area and lightArea settings - made missileQty, superQty and powerBombQty use value from 10 to 90 and divide value by float(10) when generating - fixed inverted layoutPatch setting * added option start_inventory_removes_from_pool fixed option names formatting fixed lint errors small code and repo cleanup * Hopefully fixed ROR2 that could not send any items * - fixed missing required change to ROR2 * fixed 0 hp when respawning without having ever saved (start items were not updating the save checksum) * fixed typo with doors_colors_rando * fixed checksum * added custom sprites for off-world items (progression or not) the original AP sprite was made with PierRoulette's SM Item Sprite Utility by ijwu * - added missing change following upstream merge - changed patch filename extension from apbp to apm3 so patch can be used with the new client * added morph placement options: early means local and sphere 1 * fixed failing unit tests * - fixed broken custom_preset options * - big cleanup to remove unnecessary or unsupported features * - more cleanup * - moved sm_randomizer_rom and all always applied patches into an external project that outputs basepatch.ips - small cleanup * - added comment to refer to project for generating basepatch.ips (https://github.com/lordlou/SMBasepatch) * fixed g4_skip patch that can be not applied if hud is enabled * - fixed off world sprite that can have broken graphics (restricted to use only first 2 palette) * - updated basepatch to reflect g4_skip removal - moved more asm files to SMBasepatch project * - tourian grey doors at baby metroid are now always flashing (allowing to go back if needed) * fixed wrong path if using built as exe * - cleaned exposed maxDifficulty options - removed always enabled Knows * Merged LttPClient and SMClient into SNIClient * added varia_custom Preset Option that fetch a preset (read from a new varia_custom_preset Option) from varia's web service * small doc precision * - added death_link support - fixed broken Goal Completion - post merge fix * - removed now useless presets * - fixed bad internal mapping with maxDiff - increases maxDiff if only Bosses is preventing beating the game * - added support for lowercase custom preset sections (knows, settings and controller) - fixed controller settings not applying to ROM * - fixed death loop when dying with Door rando, bomb or speed booster as starting items - varia's backup save should now be usable (automatically enabled when doing door rando) * -added docstring for generated yaml * fixed bad merge * fixed broken infinity max difficulty * commented debug prints * adjusted credits to mark progression speed and difficulty as Non Available * added support for more than 255 players (will print Archipelago for higher player number) * fixed missing cleanup * added support for 65535 different player names in ROM * fixed generations failing when only bosses are unreachable * - replaced setting maxDiff to infinity with a bool only affecting boss logics if only bosses are left to finish * fixed failling generations when using 'fun' settings Accessibility checks are forced to 'items' if restricted locations are used by VARIA following usage of 'fun' settings * fixed debug logger * removed unsupported "suits_restriction" option * fixed generations failing when only bosses are unreachable (using a less intrusive approach for AP) * - fixed deathlink emptying reserves - added death_link_survive option that lets player survive when receiving a deathlink if the have non-empty reserves * - merged death_link and death_link_survive options * fixed death_link * added a fallback default starting location instead of failing generation if an invalid one was chosen * added Nothing and NoEnergy as hint blacklist added missing NoEnergy as local items and removed it from progression * fixed broken Item links * fixed failing generation that could happen with Disabled Tourian fixed shared Location list that could be modified for each world * added missing force disable of EscapeRando if an escape solution cant be found * fixed broken animal surprise patches * prevent receiving items when in the first room of Ceres (message box in mode7 is broken) * fixed generating with "activate chozo robots" Objective * added soft reset that saves to initial starting location reverted code change applied to fix softlocks from comeback checks reverted forcing all beam local when using door rando * replaced "save and reset" with "save and fast reload" (using same Start+Select+L+R) * added documentation about Save and Reload removed forgotten docstring about forcing beams as local items when using door rando * fixed frequent failing generation on WebHost (KeyError: 'Kraid') * added "objectiveRandom", "nbObjective", objectiveList and adapted Objective selection options to better reflect VARIA's. fixed "collect 100% items" not being excluded when objectiveRandom is used added Exception when VARIA initial layout fails * fixed broken non-AP items fixed determinism caused by the use of a set * fixed generation failing on Webhost with string as a OptionSet (replaced default with a list of string) cleaned doc and naming of Objective related Options
1 parent 181e0ff commit 0e0179d

15 files changed

+1118
-886
lines changed

worlds/sm/Options.py

+50-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import typing
2-
from Options import Choice, Range, OptionDict, OptionList, Option, Toggle, DefaultOnToggle
2+
from Options import Choice, Range, OptionDict, OptionList, OptionSet, Option, Toggle, DefaultOnToggle
33
from .variaRandomizer.utils.objectives import _goals
44

55
class StartItemsRemovesFromPool(Toggle):
@@ -136,7 +136,7 @@ class AreaLayout(Toggle):
136136

137137
class DoorsColorsRando(Toggle):
138138
"""Randomize the color of Red/Green/Yellow doors. Add four new type of doors which require Ice/Wave/Spazer/Plasma
139-
beams to open them. When enabled, will force those beams as local items."""
139+
beams to open them."""
140140
display_name = "Doors Colors Rando"
141141

142142
class AllowGreyDoors(Toggle):
@@ -215,7 +215,11 @@ class Hud(Toggle):
215215
display_name = "Hud"
216216

217217
class Animals(Toggle):
218-
"""Replace saving the animals in the escape sequence by a random surprise."""
218+
"""
219+
Replace saving the animals in the escape sequence by a random surprise.
220+
Note: This setting is not available when Escape Randomization is enabled, as it is replaced by Animals Challenges
221+
(see Escape Randomization help for more information).
222+
"""
219223
display_name = "Animals"
220224

221225
class NoMusic(Toggle):
@@ -286,17 +290,52 @@ class Tourian(Choice):
286290
option_Disabled = 2
287291
default = 0
288292

289-
class Objective(OptionList):
293+
class CustomObjective(Toggle):
294+
"""
295+
Use randomized custom objectives. You can choose which objectives are available for the randomizer to choose from. If enabled, the randomizer
296+
will choose "Custom objective count" objectives from "Custom objective list". Otherwise, only objective is used. Default is disabled.
297+
"""
298+
display_name = "Custom objectives"
299+
300+
class CustomObjectiveCount(Range):
290301
"""
291-
Choose which objectives are required to sink the Golden Four statue and to open access to Tourian.
292-
You can choose from 0 to 5 objectives.
302+
By default you need to complete 4 objectives from the list to access Tourian. You can choose between 1 and 5. This setting is ignored if
303+
""Custom objectives"" is set to false.
304+
"""
305+
display_name = "Custom objective count"
306+
range_start = 1
307+
range_end = 5
308+
default = 4
309+
310+
class CustomObjectiveList(OptionSet):
311+
"""
312+
If ""Custom objectives"" is enabled, "Custom Objective count" will be used to pick an amount of objective from the list.
313+
This setting is ignored if ""Custom objectives"" is set to false.
293314
Note: If you leave the list empty no objective is required to access Tourian, ie. it's open.
294315
Note: See the Tourian parameter to enable fast Tourian or trigger the escape when all objectives are completed.
295316
Note: Current percentage of collected items is displayed in the inventory pause menu.
296-
Note: Collect 100% items is excluded by default when randomizing the objectives list as it requires you to complete all the objectives.
317+
Note: Collect 100% items is excluded by default as it requires you to complete all the objectives.
297318
Note: In AP, Items% and areas objectives are counted toward location checks, not items collected or received, except for "collect all upgrades"
319+
320+
Format as a comma-separated list of objective names: ["kill three G4", "collect 75% items"] or ["random"] to specify the whole list except
321+
"collect 100% items" and "nothing". The default is ["random"]. A full list of supported objectives can be found at:
322+
https://github.com/ArchipelagoMW/Archipelago/blob/main/worlds/sm/variaRandomizer/utils/objectives.py
323+
"""
324+
display_name = "Custom objective list"
325+
default = ["random"]
326+
valid_keys = frozenset([name for name in _goals.keys()] + ["random"])
327+
#valid_keys_casefold = True
298328

299-
Format as a comma-separated list of objective names: ["kill three G4", "collect 75% items"].
329+
class Objective(OptionSet):
330+
"""
331+
If ""Custom objectives"" is disabled, choose which objectives are required to sink the Golden Four statue and to open access to Tourian.
332+
You can choose from 0 to 5 objectives. Up to the first 5 objectives from the list will be selected.
333+
Note: If you leave the list empty no objective is required to access Tourian, ie. it's open.
334+
Note: See the Tourian parameter to enable fast Tourian or trigger the escape when all objectives are completed.
335+
Note: Current percentage of collected items is displayed in the inventory pause menu.
336+
Note: In AP, Items% and areas objectives are counted toward location checks, not items collected or received, except for "collect all upgrades"
337+
338+
Format as a comma-separated list of objective names: ["kill three G4", "collect 75% items"]. The default is ["kill all G4"].
300339
A full list of supported objectives can be found at:
301340
https://github.com/ArchipelagoMW/Archipelago/blob/main/worlds/sm/variaRandomizer/utils/objectives.py
302341
"""
@@ -386,6 +425,9 @@ class RelaxedRoundRobinCF(Toggle):
386425
"custom_preset": CustomPreset,
387426
"varia_custom_preset": VariaCustomPreset,
388427
"tourian": Tourian,
428+
"custom_objective": CustomObjective,
429+
"custom_objective_list": CustomObjectiveList,
430+
"custom_objective_count": CustomObjectiveCount,
389431
"objective": Objective,
390432
"relaxed_round_robin_cf": RelaxedRoundRobinCF,
391433
}

worlds/sm/__init__.py

+45-67
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def init_mixin(self, parent: MultiWorld):
4040
# for unit tests where MultiWorld is instantiated before worlds
4141
if hasattr(parent, "state"):
4242
self.smbm = {player: SMBoolManager(player, parent.state.smbm[player].maxDiff,
43-
parent.state.smbm[player].onlyBossLeft, parent.state.smbm[player].lastAP) for player in
43+
parent.state.smbm[player].onlyBossLeft) for player in
4444
parent.get_game_players("Super Metroid")}
4545
for player, group in parent.groups.items():
4646
if (group["game"] == "Super Metroid"):
@@ -99,13 +99,15 @@ class SMWorld(World):
9999
required_client_version = (0, 2, 6)
100100

101101
itemManager: ItemManager
102+
spheres = None
102103

103104
Logic.factory('vanilla')
104105

105106
def __init__(self, world: MultiWorld, player: int):
106107
self.rom_name_available_event = threading.Event()
107108
self.locations = {}
108-
self.need_comeback_check = True
109+
if SMWorld.spheres != None:
110+
SMWorld.spheres = None
109111
super().__init__(world, player)
110112

111113
@classmethod
@@ -118,7 +120,7 @@ def generate_early(self):
118120
Logic.factory('vanilla')
119121

120122
self.variaRando = VariaRandomizer(self.multiworld, get_base_rom_path(), self.player)
121-
self.multiworld.state.smbm[self.player] = SMBoolManager(self.player, self.variaRando.maxDifficulty, lastAP = self.variaRando.args.startLocation)
123+
self.multiworld.state.smbm[self.player] = SMBoolManager(self.player, self.variaRando.maxDifficulty)
122124

123125
# keeps Nothing items local so no player will ever pickup Nothing
124126
# doing so reduces contribution of this world to the Multiworld the more Nothing there is though
@@ -177,12 +179,7 @@ def create_items(self):
177179
item.Type,
178180
None if itemClass == 'Boss' else self.item_name_to_id[item.Name],
179181
player=self.player)
180-
181-
beamItems = ['Spazer', 'Ice', 'Wave' ,'Plasma']
182-
if self.multiworld.doors_colors_rando[self.player].value != 0:
183-
if item.Type in beamItems:
184-
self.multiworld.local_items[self.player].value.add(item.Name)
185-
182+
186183
if itemClass == 'Boss':
187184
self.locked_items[item.Name] = smitem
188185
elif item.Category == 'Nothing':
@@ -217,19 +214,13 @@ def set_entrance_rule(entrance, player, func):
217214

218215
self.multiworld.completion_condition[self.player] = lambda state: state.has('Mother Brain', self.player)
219216

220-
ammoItems = ['Missile', 'Super', 'PowerBomb']
221217
for key, value in locationsDict.items():
222218
location = self.multiworld.get_location(key, self.player)
223219
set_available_rule(location, self.player, value.Available)
224220
if value.AccessFrom is not None:
225221
add_accessFrom_rule(location, self.player, value.AccessFrom)
226222
if value.PostAvailable is not None:
227223
add_postAvailable_rule(location, self.player, value.PostAvailable)
228-
229-
if self.multiworld.doors_colors_rando[self.player].value != 0:
230-
add_item_rule(location, lambda item: item.game != self.game or item.type not in ammoItems or
231-
(item.type in ammoItems and \
232-
(not item.advancement or (item.advancement and item.player == self.player))))
233224

234225
for accessPoint in Logic.accessPoints:
235226
if not accessPoint.Escape:
@@ -304,11 +295,6 @@ def create_regions(self):
304295

305296
def collect(self, state: CollectionState, item: Item) -> bool:
306297
state.smbm[self.player].addItem(item.type)
307-
if item.location != None and item.location.game == self.game:
308-
for entrance in self.multiworld.get_region(item.location.parent_region.name, item.location.player).entrances:
309-
if (entrance.parent_region.can_reach(state)):
310-
state.smbm[item.location.player].lastAP = entrance.parent_region.name
311-
break
312298
return super(SMWorld, self).collect(state, item)
313299

314300
def remove(self, state: CollectionState, item: Item) -> bool:
@@ -359,42 +345,57 @@ def pre_fill(self):
359345
loc.address = loc.item.code = None
360346

361347
def post_fill(self):
348+
# Having a sorted itemLocs from collection order is required for escapeTrigger when Tourian is Disabled.
349+
# We cant use stage_post_fill for this as its called after worlds' post_fill.
350+
# get_spheres could be cached in multiworld?
351+
# Another possible solution would be to have a globally accessible list of items in the order in which the get placed in push_item
352+
# and use the inversed starting from the first progression item.
353+
if (SMWorld.spheres == None):
354+
SMWorld.spheres = [itemLoc for sphere in self.multiworld.get_spheres() for itemLoc in sorted(sphere, key=lambda location: location.name)]
355+
362356
self.itemLocs = [
363-
ItemLocation(ItemManager.Items[itemLoc.item.type
357+
ItemLocation(copy.copy(ItemManager.Items[itemLoc.item.type
364358
if isinstance(itemLoc.item, SMItem) and itemLoc.item.type in ItemManager.Items else
365-
'ArchipelagoItem'],
366-
locationsDict[itemLoc.name], itemLoc.item.player, True)
359+
'ArchipelagoItem']),
360+
copy.copy(locationsDict[itemLoc.name]), itemLoc.item.player, True)
367361
for itemLoc in self.multiworld.get_locations(self.player)
368362
]
369-
self.progItemLocs = [
370-
ItemLocation(ItemManager.Items[itemLoc.item.type
371-
if isinstance(itemLoc.item, SMItem) and itemLoc.item.type in ItemManager.Items else
372-
'ArchipelagoItem'],
373-
locationsDict[itemLoc.name], itemLoc.item.player, True)
374-
for itemLoc in self.multiworld.get_locations(self.player) if itemLoc.item.advancement
375-
]
376-
for itemLoc in self.itemLocs:
377-
if itemLoc.Item.Class == "Boss":
378-
itemLoc.Item.Class = "Minor"
379-
for itemLoc in self.progItemLocs:
380-
if itemLoc.Item.Class == "Boss":
381-
itemLoc.Item.Class = "Minor"
382363

383-
localItemLocs = [il for il in self.itemLocs if il.player == self.player]
384-
localprogItemLocs = [il for il in self.progItemLocs if il.player == self.player]
364+
escapeTrigger = None
365+
if self.variaRando.randoExec.randoSettings.restrictions["EscapeTrigger"]:
366+
#used to simulate received items
367+
first_local_collected_loc = next(itemLoc for itemLoc in SMWorld.spheres if itemLoc.player == self.player)
368+
369+
playerItemsItemLocs = [
370+
ItemLocation(copy.copy(ItemManager.Items[
371+
itemLoc.item.type if isinstance(itemLoc.item, SMItem) and itemLoc.item.type in ItemManager.Items else
372+
'ArchipelagoItem']),
373+
copy.copy(locationsDict[itemLoc.name] if itemLoc.game == self.game else
374+
locationsDict[first_local_collected_loc.name]),
375+
itemLoc.item.player,
376+
True)
377+
for itemLoc in SMWorld.spheres if itemLoc.item.player == self.player
378+
]
379+
for itemLoc in playerItemsItemLocs:
380+
if itemLoc.Item.Class == "Boss":
381+
itemLoc.Item.Class = "Minor"
382+
383+
playerProgItemsItemLocs = [itemLoc for itemLoc in playerItemsItemLocs if itemLoc.item.advancement]
384+
385+
escapeTrigger = (playerItemsItemLocs, playerProgItemsItemLocs, 'Full')
385386

386-
escapeTrigger = (localItemLocs, localprogItemLocs, 'Full') if self.variaRando.randoExec.randoSettings.restrictions["EscapeTrigger"] else None
387387
escapeOk = self.variaRando.randoExec.graphBuilder.escapeGraph(self.variaRando.container, self.variaRando.randoExec.areaGraph, self.variaRando.randoExec.randoSettings.maxDiff, escapeTrigger)
388-
assert escapeOk, "Could not find a solution for escape"
389-
388+
if (not escapeOk):
389+
logger.warning(f"Escape Rando forced to 'Off' for player {self.multiworld.get_player_name(self.player)} because could not find a solution for escape")
390+
391+
# if we couldn't find an area layout then the escape graph is not created either
392+
# and getDoorConnections will crash if random escape is activated.
390393
self.variaRando.doors = GraphUtils.getDoorConnections(self.variaRando.randoExec.areaGraph,
391394
self.variaRando.args.area, self.variaRando.args.bosses,
392-
self.variaRando.args.escapeRando)
395+
self.variaRando.args.escapeRando if escapeOk else False)
393396

394397
self.variaRando.randoExec.postProcessItemLocs(self.itemLocs, self.variaRando.args.hideItems)
395398

396-
self.need_comeback_check = False
397-
398399
@classmethod
399400
def stage_post_fill(cls, world):
400401
new_state = CollectionState(world)
@@ -872,29 +873,6 @@ class SMLocation(Location):
872873
def __init__(self, player: int, name: str, address=None, parent=None):
873874
super(SMLocation, self).__init__(player, name, address, parent)
874875

875-
def can_reach(self, state: CollectionState) -> bool:
876-
# self.access_rule computes faster on average, so placing it first for faster abort
877-
assert self.parent_region, "Can't reach location without region"
878-
return super(SMLocation, self).can_reach(state) and \
879-
(not state.multiworld.worlds[self.player].need_comeback_check or \
880-
self.can_comeback(state, self.item))
881-
882-
def can_comeback(self, state: CollectionState, item):
883-
randoExec = state.multiworld.worlds[self.player].variaRando.randoExec
884-
randoService = randoExec.setup.services
885-
886-
comebackCheck = ComebackCheckType.JustComeback
887-
n = 2 if GraphUtils.isStandardStart(randoExec.graphSettings.startAP) else 3
888-
# is early game
889-
if (len([loc for loc in state.locations_checked if loc.player == self.player]) <= n or randoExec.graphSettings.startAP == state.smbm[self.player].lastAP):
890-
comebackCheck = ComebackCheckType.NoCheck
891-
container = ItemLocContainer(state.smbm[self.player], [], [])
892-
return randoService.fullComebackCheck( container,
893-
state.smbm[self.player].lastAP,
894-
ItemManager.Items[item.type] if item is not None and item.player == self.player else None,
895-
locationsDict[self.name],
896-
comebackCheck)
897-
898876
class SMItem(Item):
899877
game = "Super Metroid"
900878
type: str
Binary file not shown.

0 commit comments

Comments
 (0)