That is a good point. I haven't done any adventuring bot code so didn't consider it.
I suppose you could either have a constant defined in the script where you can plug in the max hp manually before running (so you could then do something like "if getDefTargetHP <= iMaxDefTargetHP...") or have your script save a running max value of getDefTargetHP. In the last case, though, you'd have to be careful with fading buffs lowering the value again.
A less desirable but more effective option would be to read RGB values from the health bar on the screen to estimate health percentage.
Lastly, you could just bug wyvernx to make a new offset
