My idea is to when the actor reaches 10% of MP it will be recovered by 100% after 4 turns.
Idk javascript so i'm wordering if somebody can give me a hand with it since i'm almost sure it will require a lunatic mode to be done.
You'll need on each skill
<After Eval>
user._mprate = Math.floor(user.mp/user.mmp)
if (user._mprate < 0.10) {
user.addState(X) }
</After Eval>
State X has 25% MPR and lasts 4 turns
or you can also try a passive state that has this
<Custom Action End>
target._mprate = Math.floor(target.mp/target.mmp)
if (target._mprate < 0.10) {
target.addState(X) }
</Custom Action End>
Unfortunately, you weren't clear enough so l can't guess for you exactly what you want because balance wise, this would be really bad and probably give infinite mana unless you disable skills with the state.