I personally find if you're doing the exact same thing over and over again, yea use one function. If each different instance is different enough go for seperate functions. In pothead each different item type was different enough logic that I decided to go the route of seperate functions. It also made more sense to me that way because I was making the functions with the intent of them being used in macros, just seemed more logical that way.
Perhaps you should split the logic out into seperate functions? grab the values you need (mp or hp, etc) and then feed those and the set into the function, it would return back the best item. Then perhaps another function to apply the item, it'd take a true/nil arg too know if it should use self-only or friendly-target logic. Just a thought :)