If an enemy is using that same skill to attack with, it's going to mess up because enemies don't have an actor id. Try this revised version:
Code:
if (a.isActor()) v[25] = a.actorid(); a.atk * 4 - b.def * 2