Frayed Knights Development Update

In his latest progress report for Frayed Knights, Jay Barnson discusses the absurd amount of work it took to implement a single room in one of the game's Act 1dungeons.
Detour #2: Code Rewrite

Oh. Problem. I have code to check if anybody in the party has an instance of a particular item in their inventory. Nothing in there to check to see if I have at least so many of a particular item. I haven't needed that functionality in previous quests and mechanics. Oops!

Time for a code re-write. Uh, actually, new code. I'm afraid of breaking the old code. So now I have a check-for-n items clause. I have to keep searching through the party inventory and different player's inventory until I've counted an least n items of a type, because there's no guarantee the player is going to stack them all together in one slot.

Oh. Another problem. Similar to the last one. I have to remove n items from the player inventories. My existing code only finds the first instance of an item and removes it. The new code has to search through the party and player inventories (in what order?) and keep removing all instances of the given item until it has removed so many. And then stop.