Fred: start adding faster utility functions

These are the beginning of an effort to streamline all of Fred’s
engine.  Most of the functions in battle_calcs (and possibly some in
ai_helper) will eventually be moved into these files, or will be
replaced by different versions.