I've been trying to come up with a good plan for being able to say a particular monster drops "one of these X things Y percent of the time" - for example wine rack drops two dusty bottles, various drop beans now, etc, without listing huge numbers of drops.
I was considering adding a 'comment' to monster drops, that would be treated as strings, stored in a different array and just displayed as it is (in Area Combat Data and when fighting monsters).
It then struck me that maybe I was missing a trick here, and that actually knowing what was in a group of items could be useful in other places to simplify code.
So, seeking feedback on the following idea :
Set up data file itemgroups.txt. First column is a generic string name for the group, following columns are the other items in the group (names or numbers as other files).
Set up ItemGroupDatabase, with the above stored in arrays.
Set up useful functions / ash commands, for things like isInGroup( item ), getGroupItems ( itemGroup ).
Replace all existing code that groups together a small number of items and treats them equally (eg Lasagna, Saucy Pasta, Beans, Dusty Wines, Paper Strips, etc) to be item groups using isInGroup().
Handle and allow monsters dropping Item Groups as well as Items in monster.txt.
Thoughts ?
I was considering adding a 'comment' to monster drops, that would be treated as strings, stored in a different array and just displayed as it is (in Area Combat Data and when fighting monsters).
It then struck me that maybe I was missing a trick here, and that actually knowing what was in a group of items could be useful in other places to simplify code.
So, seeking feedback on the following idea :
Set up data file itemgroups.txt. First column is a generic string name for the group, following columns are the other items in the group (names or numbers as other files).
Set up ItemGroupDatabase, with the above stored in arrays.
Set up useful functions / ash commands, for things like isInGroup( item ), getGroupItems ( itemGroup ).
Replace all existing code that groups together a small number of items and treats them equally (eg Lasagna, Saucy Pasta, Beans, Dusty Wines, Paper Strips, etc) to be item groups using isInGroup().
Handle and allow monsters dropping Item Groups as well as Items in monster.txt.
Thoughts ?