SM: comeback fix4 (#1741)
This commit is contained in:
parent
4ef7e43521
commit
a38a2903d5
|
@ -127,6 +127,7 @@ class AreaRandomization(Choice):
|
|||
option_off = 0
|
||||
option_light = 1
|
||||
option_full = 2
|
||||
alias_true = 2
|
||||
default = 0
|
||||
|
||||
class AreaLayout(Toggle):
|
||||
|
|
|
@ -8,6 +8,7 @@ import base64
|
|||
from typing import Any, Dict, Iterable, List, Set, TextIO, TypedDict
|
||||
|
||||
from BaseClasses import Region, Entrance, Location, MultiWorld, Item, ItemClassification, CollectionState, Tutorial
|
||||
from Fill import fill_restrictive
|
||||
from worlds.AutoWorld import World, AutoLogicRegister, WebWorld
|
||||
|
||||
logger = logging.getLogger("Super Metroid")
|
||||
|
@ -149,6 +150,7 @@ class SMWorld(World):
|
|||
pool = []
|
||||
self.locked_items = {}
|
||||
self.NothingPool = []
|
||||
self.prefilled_locked_items = []
|
||||
weaponCount = [0, 0, 0]
|
||||
for item in itemPool:
|
||||
isAdvancement = True
|
||||
|
@ -170,13 +172,21 @@ class SMWorld(World):
|
|||
elif item.Category == 'Nothing':
|
||||
isAdvancement = False
|
||||
|
||||
classification = ItemClassification.progression if isAdvancement else ItemClassification.filler
|
||||
itemClass = ItemManager.Items[item.Type].Class
|
||||
smitem = SMItem(item.Name,
|
||||
classification,
|
||||
ItemClassification.progression if isAdvancement else ItemClassification.filler,
|
||||
item.Type,
|
||||
None if itemClass == 'Boss' else self.item_name_to_id[item.Name],
|
||||
player=self.player)
|
||||
|
||||
beamItems = ['Spazer', 'Ice', 'Wave' ,'Plasma']
|
||||
self.ammoItems = ['Missile', 'Super', 'PowerBomb']
|
||||
if self.multiworld.doors_colors_rando[self.player].value != 0:
|
||||
if item.Type in beamItems:
|
||||
self.multiworld.local_items[self.player].value.add(item.Name)
|
||||
elif item.Type in self.ammoItems and isAdvancement:
|
||||
self.prefilled_locked_items.append(smitem)
|
||||
|
||||
if itemClass == 'Boss':
|
||||
self.locked_items[item.Name] = smitem
|
||||
elif item.Category == 'Nothing':
|
||||
|
@ -205,11 +215,22 @@ class SMWorld(World):
|
|||
def set_rules(self):
|
||||
set_rules(self.multiworld, self.player)
|
||||
|
||||
|
||||
def create_regions(self):
|
||||
create_locations(self, self.player)
|
||||
create_regions(self, self.multiworld, self.player)
|
||||
|
||||
def pre_fill(self):
|
||||
from Fill import fill_restrictive
|
||||
if len(self.prefilled_locked_items) > 0:
|
||||
locations = [loc for loc in self.locations.values() if loc.item is None]
|
||||
self.multiworld.random.shuffle(locations)
|
||||
all_state = self.multiworld.get_all_state(False)
|
||||
for item in self.ammoItems:
|
||||
while (all_state.has(item.name, self.player, 1)):
|
||||
all_state.remove(item)
|
||||
|
||||
fill_restrictive(self.multiworld, all_state, locations, self.prefilled_locked_items, True, True)
|
||||
|
||||
def getWordArray(self, w: int) -> List[int]:
|
||||
""" little-endian convert a 16-bit number to an array of numbers <= 255 each """
|
||||
return [w & 0x00FF, (w & 0xFF00) >> 8]
|
||||
|
@ -813,7 +834,7 @@ class SMLocation(Location):
|
|||
comebackCheck = ComebackCheckType.JustComeback
|
||||
n = 2 if GraphUtils.isStandardStart(randoExec.graphSettings.startAP) else 3
|
||||
# is early game
|
||||
if (len([loc for loc in state.locations_checked if loc.player == self.player]) <= n):
|
||||
if (len([loc for loc in state.locations_checked if loc.player == self.player]) <= n or randoExec.graphSettings.startAP == state.smbm[self.player].lastAP):
|
||||
comebackCheck = ComebackCheckType.NoCheck
|
||||
container = ItemLocContainer(state.smbm[self.player], [], [])
|
||||
return randoService.fullComebackCheck( container,
|
||||
|
|
|
@ -373,6 +373,8 @@ def loadRandoPreset(world, player, args):
|
|||
args.gravityBehaviour = defaultMultiValues["gravityBehaviour"][world.gravity_behaviour[player].value]
|
||||
args.nerfedCharge = world.nerfed_charge[player].value
|
||||
args.area = world.area_randomization[player].current_key
|
||||
if (args.area == "true"):
|
||||
args.area = "full"
|
||||
if args.area != "off":
|
||||
args.areaLayoutBase = not world.area_layout[player].value
|
||||
args.escapeRando = world.escape_rando[player].value
|
||||
|
|
Loading…
Reference in New Issue