Complete oversight on my part. I was correctly checking whether the battler *had* an enhanceSkill function to call in the first place (so that it wouldn't error out when enemies use it) but forgot to check whether calling the function actually returned something before using its id in the formula.