As long as you don't have a Hunter Rune equipped, the drop is recomputed every time an enemy dies*, until a drop occurs or you run out of enemies. Each enemy can have up to three drops, and the drops typically have descending probability from the first to the third. The probability is represented by a number that can be between 0 and 255, so 255 would be ~100%, 128 a fraction more than 50%, and 26 a fraction more than 10%, etc.
When an enemy is killed the game uses a seed--initially, I believe, from the system clock, but on subsequent passes, it's the last large integer generated--and some magic numbers** to generate a pseudo-random number. This number is then multiplied by the total of all drop percentages, adjusted a bit if it comes up negative, and then shifted and masked until the result is a relatively small number 255 or less. This number is compared to the stack of adjusted probabilities. The game adjusts the probabilities by adding the first to the second, and the first and the second to the third. That may seem mystifying, but it's a programming trick that eliminates the need for multiple passes. Let's say you have the following drops and probabilities (I'm using raw numbers rather than percentages):
- Medicine X 4 - 4
- Antitoxin X 4 - 1
- Mega Medicine X 4 1
(For fun, while 255 should be 100% there's no special coding for it. Since the comparisons done are random number less than adjusted drop chance number, there's still a 1/256 chance of no drop when an enemy has 255 as a drop number.)
Doing it this way has two benefits: For the programmers, it was simpler than doing multiple passes, and for the players, it means your chances are locked in as long as things were done properly, e.g., no assigning a drop chance of 127 to three drops for one enemy. I've seen some complaints about the chance of one drop making another virtually impossible. It's true in the sense that the higher probability item does have a greater chance of coming up (tautology). However, the way I've heard it stated is that it's like you get three rolls of the dice at maximum for prizes, and rolls two and three are only allowed if you fail to hit the magic number for the first prize. The way it's actually done is a bit more like a wheel game, where you spin and certain slots are for certain prizes while others get you nothing. In my example above, "rolling" a 5 will always get you a Mega Medicine. You don't have to not roll a 1-4, then not roll a 1, and then hit a 1 on the third to fit the drop number and get the Mega Medicine.
* This is how the game's code looks. I can't fully confirm yet, as I don't have a save in an area with mixed groups.
**1,103,515,245 (somebody's phone number?) and 12,345
Enough technical stuff.
Enemies Always Drop #?
96 - First Drop item
98 - Second
9A - Third
If the enemy doesn't have a drop in the position selected, you get nothing.
There's a second set of drop code that seems to be for an area drop. When I set it up to trigger always (in the area outside the fort at the beginning of the game) I keep getting unidentified vases/ornaments. I'm not sure what that's all about. I was messing with this to verify that I had computed drop chances correctly when ripping the data from the disc, and found that bit of code first. It was sort of annoying, since I was supposed to be getting Medicines and Technique runes like my listing said. Those vases could just be garbage data, and the code is actually for one-time drops, like the recipes and stuff. It just happens the area I was in has no one-time drops, and that code wasn't meant to execute. I haven't yet looked into it. Might be worth looking into for recipe #34 or something.
Since I'm crawling through the code anyway, I'll make some more cheats as the opportunities present themselves. While I'm at it, I'll also entertain any reasonable request for investigations into game mechanics, time permitting.