diasurgical / devilutionX

Diablo build for modern operating systems
Other
8.01k stars 786 forks source link

Fix Unique Item generation infinite loop #7372

Closed kphoenix137 closed 3 weeks ago

kphoenix137 commented 1 month ago

Problem: Unique Item generation uses vanilla generation, then uses a new function to use RNG to select a different Unique Item. If it's different from the one vanilla generation already picked, we force generate items until the newly created Unique Item matches our desired Unique. It does this by force generating items using the minimum level of the desired Unique, since that puts it last in the list, which ensures reverse compatibility. However, Hellfire added several Unique Items that have matching Base Items to a few of the Diablo Uniques, which completely broke the system of relying on the last valid Unique Item in the list having the highest qlvl. This fixes uidOffset calculation to further adjust the offset when there are matching Unique Items that come after our desired Unique Item but have a lower minimum level. The Unique Items that were causing an infinite loop prior to this fix will drop in DevilutionX, but will morph if moved back to vanilla Hellfire, but will return to their correct Unique if brought back to DevilutionX, just like the other "impossible" items as referenced in Jarulf's Guide.

AJenbo commented 1 month ago

Are both PRs for this relevant still?

kphoenix137 commented 1 month ago

Are both PRs for this relevant still?

Depends on obligaron's fix. This is more of a backup plan to fix the issue but make fewer changes overall. His PR seems to be a fix as well as general cleanups and deduplication of logic.

StephenCWills commented 3 weeks ago

I just merged the other PR so should be okay to close this one.