Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DLC Quest Bug Fix more item then location non existing start inventory #4735

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

axe-y
Copy link
Collaborator

@axe-y axe-y commented Mar 12, 2025

What is this fixing or adding?

fix: Start inventory item would make a miss number of item from the number of location under certain condition

https://discord.com/channels/731205301247803413/1349141593692704829

How was this tested?

Test where run and the world that failed to have the same number of location and item now work properly, other worlds with different item were tested

Start inventory item that do not exist in the present world do not make more trap item to appear anymore
@github-actions github-actions bot added the waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. label Mar 12, 2025
Copy link
Contributor

@Mysteryem Mysteryem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this currently works properly if a player adds items to start inventory such that there is more of an item in start inventory than there is of that item in created_items, when there is at least 1 of that item in created_items.

I have given two suggestions that I think would fix the issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I think the better design would be to rework item creation to not create excluded items in the first place, rather than removing excluded items after the item pool has been created. Then the count of created items, used to determine how many trap items to add, will be correct from the start and won't have to be adjusted for how many items are going to be removed from the item pool later on at the end of create_items().

Alternatively, only add the trap items after all the excluded items have been removed from the item pool.

The former is better because

        for item in items_to_exclude:
            if item in self.multiworld.itempool:
                self.multiworld.itempool.remove(item)

is not great due to the fact that is has to search the entire multiworld's item pool (twice) for each item.

The effect of this could be minimised to the point where it matters much less, by removing the excluded items from created_items before the items in created_items are added to the multiworld's item pool.

Though I would still recommend not creating items in the first place that you don't actually want to add to the multiworld's item pool.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implemented your idea thanks for it

@ScipioWright ScipioWright added the is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs. label Mar 12, 2025
@agilbert1412 agilbert1412 self-requested a review March 12, 2025 18:28
axe-y and others added 2 commits March 13, 2025 00:45
Co-authored-by: Mysteryem <Mysteryem@users.noreply.github.com>
did the recommendation of Mysteryem and made the item not exist in the pool of item created
@axe-y axe-y requested a review from Mysteryem March 13, 2025 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants