MP Gain Without Using MP Drain?

Hello RMMV friends ^_^ - do you mind if I pick at some genius brains for a moment?

So I have a battle system that is based around dealing damage to both HP and MP (not simultaneously) and I have skills that damage an enemy's MP while also giving some MP to the caster. The problem is that I want the caster to continue gaining MP each time they attack based on the damage they deal, but using MP Drain means that once the enemy is out of MP the player can't gain anything further. I tried using Yanfly's "Life Steal" plugin, but it didn't seem to help. I tried a method using the Skill's formula box, but couldn't figure out how to make it work. Any suggestions? Any advice would be very appreciated.
In the damage formula of the skill place this script:

a.gainMp(a.hp*5); 0;
Where "a" is the user of the skill.
Where "b" is the target of the skill.
And the "a.hp * 5" is the damage formula.
You could do this code:
a.gainMp(a.atk * 4 - b.def * 2); 0;
And set the skills varation to 20%
You have a skill that gains mp equal to the default attack skill.

Make the skill mp damage or mp recover, and have it target the enemy if it's a skill to hit the enemy.
@Zarsla gave you a mostly-correct answer, but this will set the MP "damage" dealt by the skill to 0, which is not what you want to do here.

You could set a variable in the damage formula and then do the a.gainMp and the damage in equal amounts... but only the damage will then be modified by elemental weaknesses, critical hits, variance, etc. So that's not really a tenable solution, either.

I think your best bet would be to simply modify the way that Drain Skills work. This requires scripting, but luckily, it appears easy to do. Here's the current method (from rpg_objects) for processing damage from attacks:
Code:
Game_Action.prototype.executeHpDamage = function(target, value) {
    if (this.isDrain()) {
        value = Math.min(target.hp, value);
    }
    this.makeSuccess(target);
    target.gainHp(-value);
    if (value > 0) {
        target.onDamage(value);
    }
    this.gainDrainedHp(value);
};

I think that if you say "Bye Felicia!" to that first if-branch in the method, it will work the way you want:
Code:
Game_Action.prototype.executeHpDamage = function(target, value) {
    this.makeSuccess(target);
    target.gainHp(-value);
    if (value > 0) {
        target.onDamage(value);
    }
    this.gainDrainedHp(value);
};
I think that if you say "Bye Felicia!" to that first if-branch in the method, it will work the way you want:
Lol I love this community so much. Thank you both so much, everything is working perfectly now!!

Original thread: https://forums.rpgmakerweb.com/threads/mp-gain-without-using-mp-drain.91223/