Thanks for the help FN Ninja, it looks great!
Before more types are added (I need to add an "elemental damage" type for the upcoming physresist.ash CCS), I want to make a change to
best_fam() -- some way of ranking the strength of the familiar for a given type needs to be added, so that
best_fam() will still work in the event that all familiars of a given type are the same weight. If your only meat-producing familiars are a NPZR and Fuzzy Dice, presently
best_fam() would choose the Fuzzy Dice since it is the first match in the list, which is definitely sub-ideal behavior.
Once I make the change, there will be an integer value after the type, e.g.
Fuzzy Dice produce 1
Ninja Pirate Zombie Robot produce 7, delevel 3
Higher numbers indicate higher effectiveness or desirability. For example, even though a Nervous Tick has the same meat production as a Leprechaun, its meat number would be higher. Numbers should be chosen with a bit of room in between to allow room for future expansion.
Also note: if adding types, make sure the type names don't match any familiar names. You can check this in the CLI using
ash to_familiar("typename");
> ash to_familiar("delevel")
Returned: none
This is useful for allowing scripts to use strings for desired familiars. If the specified string does not match a familiar (i.e.
to_familiar() returns
$familiar[none]), it can be assumed to be a familiar type and passed along to
best_fam().
BONUS EDIT: speaking of this new format, I'm working on it now and it seems like a regex may be the best way to parse the effectiveness, but I am deathly afraid of regexes, since I was attacked by one as a child. Anyone know of an efficient regex method to get the relevant integer here, given the string (i.e. "meat")? I have a substring, index_of method already but would be glad of a more effective way.
items 4, meat 5, delevel 1 <-- "delevel" should return 1