InventoryManager.retrieveWorthlessItems() is used to get a specified number of worthless items (of any type). As coded, it first uses 31337 scrolls, one at a time, until the specified number is in inventory or you run out of scrolls, and then attempts to adventure in the sewer, with a stop condition of the number needed.
There is no sewer any more. Instead, simply using chewing gum on a string gives you a chance to get worthless items. You are guaranteed to get a worthless item if you have at least one of every non-worthless item that gum can yield in inventory. If you have all such items and additionally all three kinds of worthless item in inventory, you get a random item selected from everything that gum can yield, worthless or not.
I propose something like the following as the algorithm
There is no sewer any more. Instead, simply using chewing gum on a string gives you a chance to get worthless items. You are guaranteed to get a worthless item if you have at least one of every non-worthless item that gum can yield in inventory. If you have all such items and additionally all three kinds of worthless item in inventory, you get a random item selected from everything that gum can yield, worthless or not.
I propose something like the following as the algorithm
Code:
int needed = requested - inventory
while needed > 0
move worthless items in inventory to closet
buy and use one chewing gum on a string
if got a worthless item
needed = needed - 1
move requested - inventory worthless items out of closet