Skip to content

Commit 2d9ec84

Browse files
committed
Implemented various fixes
Changed the method of adding classifications together at Fuzzy's request. Corrected the order that Progression and Progression + Skip Balancing were checked so that Progression + Skip Balancing takes priority again. Modified a check so that it now looks for if an item has the Progression flag, rather than being exactly Progression or Progression + Skip Balancing. Added a case for removing Useful + Trap items if there aren't enough locations for them in the pool.
1 parent 4bb9081 commit 2d9ec84

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

src/DataValidation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ def preFillCheckIfEnoughItemsForValue(world: World, multiworld: MultiWorld):
282282
# compare whats available vs requested but only if there's anything requested
283283
if values_requested:
284284
errors = []
285-
existing_items = [item for item in get_items_for_player(multiworld, player, True) if item.code is not None and
286-
item.classification == ItemClassification.progression or item.classification == ItemClassification.progression_skip_balancing]
285+
existing_items = [item for item in get_items_for_player(multiworld, player, True) if
286+
item.code is not None and ItemClassification.progression in item.classification]
287287
for value, val_count in values_requested.items():
288288
items_value = get_items_with_value(world, multiworld, value, player, True)
289289
found_count = 0

src/__init__.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -208,24 +208,18 @@ def create_item(self, name: str) -> Item:
208208
name = before_create_item(name, self, self.multiworld, self.player)
209209

210210
item = self.item_name_to_item[name]
211-
filler = ItemClassification.filler
212-
trap = ItemClassification.filler
213-
useful = ItemClassification.filler
214-
progression = ItemClassification.filler
215-
progression_skip_balancing = ItemClassification.filler
211+
classification = ItemClassification.filler
216212

217213
if "trap" in item and item["trap"]:
218-
trap = ItemClassification.trap
214+
classification |= ItemClassification.trap
219215

220216
if "useful" in item and item["useful"]:
221-
useful = ItemClassification.useful
217+
classification |= ItemClassification.useful
222218

223-
if "progression" in item and item["progression"]:
224-
progression = ItemClassification.progression
225-
elif "progression_skip_balancing" in item and item["progression_skip_balancing"]:
226-
progression_skip_balancing = ItemClassification.progression_skip_balancing
227-
228-
classification = filler | trap | useful | progression | progression_skip_balancing
219+
if "progression_skip_balancing" in item and item["progression_skip_balancing"]:
220+
classification |= ItemClassification.progression_skip_balancing
221+
elif "progression" in item and item["progression"]:
222+
classification |= ItemClassification.progression
229223

230224
item_object = ManualItem(name, classification,
231225
self.item_name_to_id[name], player=self.player)
@@ -392,9 +386,15 @@ def adjust_filler_items(self, item_pool, traps):
392386
fillers = [item for item in item_pool if item.classification == ItemClassification.filler]
393387
traps = [item for item in item_pool if item.classification == ItemClassification.trap]
394388
useful = [item for item in item_pool if item.classification == ItemClassification.useful]
389+
# Useful + Trap is classified separately so that it can have a unique priority ranking.
390+
useful_traps = [item for item in item_pool if
391+
ItemClassification.progression not in item.classification
392+
and ItemClassification.useful in item.classification
393+
and ItemClassification.trap in item.classification]
395394
self.random.shuffle(fillers)
396395
self.random.shuffle(traps)
397396
self.random.shuffle(useful)
397+
self.random.shuffle(useful_traps)
398398
for _ in range(0, abs(extras)):
399399
popped = None
400400
if fillers:
@@ -403,6 +403,9 @@ def adjust_filler_items(self, item_pool, traps):
403403
popped = traps.pop()
404404
elif useful:
405405
popped = useful.pop()
406+
# Not sure if Useful + Trap should go before or after Useful.
407+
elif useful_traps:
408+
popped = useful_traps.pop()
406409
else:
407410
logging.warning("Could not remove enough non-progression items from the pool.")
408411
break

0 commit comments

Comments
 (0)