SMZ3: 0.4.2 non local items fix (#2212)

fixed generation failure when using non_local_items set to "Everything"
For this, GT prefill now allows non local non progression items to be placed.
This commit is contained in:
lordlou 2023-09-30 15:05:07 -04:00 committed by GitHub
parent 5c640c6c52
commit a3907e800b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -181,6 +181,7 @@ class Item:
keycard = re.compile("^Card")
smMap = re.compile("^SmMap")
def IsNameDungeonItem(item_name): return Item.dungeon.match(item_name)
def IsDungeonItem(self): return self.dungeon.match(self.Type.name)
def IsBigKey(self): return self.bigKey.match(self.Type.name)
def IsKey(self): return self.key.match(self.Type.name)

View File

@ -221,7 +221,9 @@ class SMZ3World(World):
if (self.smz3World.Config.Keysanity):
progressionItems = self.progression + self.dungeon + self.keyCardsItems + self.SmMapsItems
else:
progressionItems = self.progression
progressionItems = self.progression
# Dungeons items here are not in the itempool and will be prefilled locally so they must stay local
self.multiworld.non_local_items[self.player].value -= frozenset(item_name for item_name in self.item_names if TotalSMZ3Item.Item.IsNameDungeonItem(item_name))
for item in self.keyCardsItems:
self.multiworld.push_precollected(SMZ3Item(item.Type.name, ItemClassification.filler, item.Type, self.item_name_to_id[item.Type.name], self.player, item))
@ -548,11 +550,8 @@ class SMZ3World(World):
def JunkFillGT(self, factor):
poolLength = len(self.multiworld.itempool)
playerGroups = self.multiworld.get_player_groups(self.player)
playerGroups.add(self.player)
junkPoolIdx = [i for i in range(0, poolLength)
if self.multiworld.itempool[i].classification in (ItemClassification.filler, ItemClassification.trap) and
self.multiworld.itempool[i].player in playerGroups]
if self.multiworld.itempool[i].classification in (ItemClassification.filler, ItemClassification.trap)]
toRemove = []
for loc in self.locations.values():
# commenting this for now since doing a partial GT pre fill would allow for non SMZ3 progression in GT
@ -563,6 +562,7 @@ class SMZ3World(World):
poolLength = len(junkPoolIdx)
# start looking at a random starting index and loop at start if no match found
start = self.multiworld.random.randint(0, poolLength)
itemFromPool = None
for off in range(0, poolLength):
i = (start + off) % poolLength
candidate = self.multiworld.itempool[junkPoolIdx[i]]
@ -570,6 +570,7 @@ class SMZ3World(World):
itemFromPool = candidate
toRemove.append(junkPoolIdx[i])
break
assert itemFromPool is not None, "Can't find anymore item(s) to pre fill GT"
self.multiworld.push_item(loc, itemFromPool, False)
loc.event = False
toRemove.sort(reverse = True)