Let me try to make it a bit clearer:
Mafia automatically, invisibly updates the parameter-less versions of monster functions every time a monster is encountered. This means that in consult scripts, we can use ASH's last_monster() function rather than needlessly passing around a monster parameter in all of our functions. Very handy; I've done this in all my consult scripts, to streamline them.
For a relay override script, at the moment it is called basically nothing has happened yet. It has not visited any URLs on the KoL server. The override script is overriding mafia's default (fetching the page, which would update monster functions) and instead doing whatever the script specifies first, which could be as simple as the default plus a few changes, or as complicated as never fetching the page and instead constructing an entirely new replacement page.
When we override fight.php, at the moment our fight.ash is called, the actual combat has not even started, so all the monster functions have not been updated. It's waiting for the actual visit_url() to be called, parameter-less (specific to relay scripts), which actually fetches the page, causing all the monster info to be updated.
My problem is that I've built a library intended for both consult/relay use using ASH monster commands -- and included scripts must be included before any commands, which means the relay script can't load the page before the library script runs. In the library, everything needs to be in a certain order, but I left quite a lot of things at top-level. I can't move all the top-level stuff into a single function -- it would need to be in multiple functions, scattered throughout the script, and then called in order by a parent init()-type function, simply for the purpose of delaying until the calling script could actually start the combat. It's beyond inelegant and well into ugly.
It looks like either this ugly hack or a significant rewrite is in order.
@Bale: We can't use the versions of these functions that include a monster parameter, because later we'll want return values that are specific to the monster we're fighting, not static starting values. Even in the first round, events could already have happened which alter the monster's HP/attack/defense.