DLC Quest: Fix more items than location with non existing start inventory (#4735)

* DLC Quest Bug Fix
Start inventory item that do not exist in the present world do not make more trap item to appear anymore

* Update worlds/dlcquest/Items.py

Co-authored-by: Mysteryem <Mysteryem@users.noreply.github.com>

* DLC Quest Bug Fix
did the recommendation of Mysteryem and made the item not exist in the pool of item created

* DLC Quest Bug Fix
did the recommendation of agilbert1412 and made a check by name instead of item to itemData

* DLC Quest Bug Fix
overcook failed test

* DLC Quest Bug Fix
re-type correctly a type hint

---------

Co-authored-by: Mysteryem <Mysteryem@users.noreply.github.com>
This commit is contained in:
axe-y
2025-04-05 08:19:54 -04:00
committed by GitHub
parent 61e83a300b
commit 0cce88cfbc
2 changed files with 16 additions and 10 deletions

View File

@@ -98,14 +98,14 @@ def create_trap_items(world, world_options: Options.DLCQuestOptions, trap_needed
return traps
def create_items(world, world_options: Options.DLCQuestOptions, locations_count: int, random: Random):
def create_items(world, world_options: Options.DLCQuestOptions, locations_count: int, excluded_items: list[str], random: Random):
created_items = []
if world_options.campaign == Options.Campaign.option_basic or world_options.campaign == Options.Campaign.option_both:
create_items_basic(world_options, created_items, world)
create_items_basic(world_options, created_items, world, excluded_items)
if (world_options.campaign == Options.Campaign.option_live_freemium_or_die or
world_options.campaign == Options.Campaign.option_both):
create_items_lfod(world_options, created_items, world)
create_items_lfod(world_options, created_items, world, excluded_items)
trap_items = create_trap_items(world, world_options, locations_count - len(created_items), random)
created_items += trap_items
@@ -113,8 +113,12 @@ def create_items(world, world_options: Options.DLCQuestOptions, locations_count:
return created_items
def create_items_lfod(world_options, created_items, world):
def create_items_lfod(world_options, created_items, world, excluded_items):
for item in items_by_group[Group.Freemium]:
if item.name in excluded_items:
excluded_items.remove(item)
continue
if item.has_any_group(Group.DLC):
created_items.append(world.create_item(item))
if item.has_any_group(Group.Item) and world_options.item_shuffle == Options.ItemShuffle.option_shuffled:
@@ -128,8 +132,12 @@ def create_items_lfod(world_options, created_items, world):
create_coin(world_options, created_items, world, 889, 200, Group.Freemium)
def create_items_basic(world_options, created_items, world):
def create_items_basic(world_options, created_items, world, excluded_items):
for item in items_by_group[Group.DLCQuest]:
if item.name in excluded_items:
excluded_items.remove(item.name)
continue
if item.has_any_group(Group.DLC):
created_items.append(world.create_item(item))
if item.has_any_group(Group.Item) and world_options.item_shuffle == Options.ItemShuffle.option_shuffled:

View File

@@ -66,10 +66,10 @@ class DLCqworld(World):
for location in self.multiworld.get_locations(self.player)
if not location.advancement])
items_to_exclude = [excluded_items
items_to_exclude = [excluded_items.name
for excluded_items in self.multiworld.precollected_items[self.player]]
created_items = create_items(self, self.options, locations_count + len(items_to_exclude), self.multiworld.random)
created_items = create_items(self, self.options, locations_count, items_to_exclude, self.multiworld.random)
self.multiworld.itempool += created_items
@@ -84,9 +84,7 @@ class DLCqworld(World):
else:
early_items[self.player]["Movement Pack"] = 1
for item in items_to_exclude:
if item in self.multiworld.itempool:
self.multiworld.itempool.remove(item)
def precollect_coinsanity(self):
if self.options.campaign == Options.Campaign.option_basic: