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:
parent
5c640c6c52
commit
a3907e800b
|
@ -181,6 +181,7 @@ class Item:
|
||||||
keycard = re.compile("^Card")
|
keycard = re.compile("^Card")
|
||||||
smMap = re.compile("^SmMap")
|
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 IsDungeonItem(self): return self.dungeon.match(self.Type.name)
|
||||||
def IsBigKey(self): return self.bigKey.match(self.Type.name)
|
def IsBigKey(self): return self.bigKey.match(self.Type.name)
|
||||||
def IsKey(self): return self.key.match(self.Type.name)
|
def IsKey(self): return self.key.match(self.Type.name)
|
||||||
|
|
|
@ -221,7 +221,9 @@ class SMZ3World(World):
|
||||||
if (self.smz3World.Config.Keysanity):
|
if (self.smz3World.Config.Keysanity):
|
||||||
progressionItems = self.progression + self.dungeon + self.keyCardsItems + self.SmMapsItems
|
progressionItems = self.progression + self.dungeon + self.keyCardsItems + self.SmMapsItems
|
||||||
else:
|
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:
|
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))
|
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):
|
def JunkFillGT(self, factor):
|
||||||
poolLength = len(self.multiworld.itempool)
|
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)
|
junkPoolIdx = [i for i in range(0, poolLength)
|
||||||
if self.multiworld.itempool[i].classification in (ItemClassification.filler, ItemClassification.trap) and
|
if self.multiworld.itempool[i].classification in (ItemClassification.filler, ItemClassification.trap)]
|
||||||
self.multiworld.itempool[i].player in playerGroups]
|
|
||||||
toRemove = []
|
toRemove = []
|
||||||
for loc in self.locations.values():
|
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
|
# 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)
|
poolLength = len(junkPoolIdx)
|
||||||
# start looking at a random starting index and loop at start if no match found
|
# start looking at a random starting index and loop at start if no match found
|
||||||
start = self.multiworld.random.randint(0, poolLength)
|
start = self.multiworld.random.randint(0, poolLength)
|
||||||
|
itemFromPool = None
|
||||||
for off in range(0, poolLength):
|
for off in range(0, poolLength):
|
||||||
i = (start + off) % poolLength
|
i = (start + off) % poolLength
|
||||||
candidate = self.multiworld.itempool[junkPoolIdx[i]]
|
candidate = self.multiworld.itempool[junkPoolIdx[i]]
|
||||||
|
@ -570,6 +570,7 @@ class SMZ3World(World):
|
||||||
itemFromPool = candidate
|
itemFromPool = candidate
|
||||||
toRemove.append(junkPoolIdx[i])
|
toRemove.append(junkPoolIdx[i])
|
||||||
break
|
break
|
||||||
|
assert itemFromPool is not None, "Can't find anymore item(s) to pre fill GT"
|
||||||
self.multiworld.push_item(loc, itemFromPool, False)
|
self.multiworld.push_item(loc, itemFromPool, False)
|
||||||
loc.event = False
|
loc.event = False
|
||||||
toRemove.sort(reverse = True)
|
toRemove.sort(reverse = True)
|
||||||
|
|
Loading…
Reference in New Issue