Check out http://diablo2.diablowiki.net/Item_Generation_Tutorial for a slightly more complex system that IMO is a lot more flexible and can give some truly astronomical drop rates on exceptionally rare items (i.e. Zod runes, Tyrael's Might sacred armor).
The trick D2 uses is using a table similar to this:
As you can see, some of the items are actually TreasureClasses, which have their own entries. Whenever the item picker lands on a TreasureClass, it drops to the corresponding table row and "rolls the dice" again, so to speak. This is repeated until the item picker lands on an actual item.
If you look at TreasureClassEx.txt from Diablo II, you'll see that they further use this system to calculate nodrop rates, item generation per act/per difficulty, etc. Pretty cool once you wrap your head around it!
That's a good idea and probably what I'd do if I were to take it one step further - in particular if you went with null item drops, it would be great to "subclass" that so that its ratio does not interfere with the rest of your calculations. I.e. - 1:20 chance of dropping an item, 1:6 chance that it is item type XYZ.
+1 for Diablo 2, the game that destroyed my grades in school. :)
The trick D2 uses is using a table similar to this:
As you can see, some of the items are actually TreasureClasses, which have their own entries. Whenever the item picker lands on a TreasureClass, it drops to the corresponding table row and "rolls the dice" again, so to speak. This is repeated until the item picker lands on an actual item.If you look at TreasureClassEx.txt from Diablo II, you'll see that they further use this system to calculate nodrop rates, item generation per act/per difficulty, etc. Pretty cool once you wrap your head around it!