Skill that does damage & heals user MP?

So I'm trying to make a skill that attacks an enemy but also restores a set amount of MP to the user. I had a similar skill in VX Ace using a damage formula but I can't remember how I did it and I can't seem to recreate it. I've also lurked around some old thread's trying to make similar skills and it sounds like it should be possible with Yanfly's skill core but I haven't been able to get that to work either. I'd appreciate if I could get some help on this.
Try using this: a.gainMp(10); a.atk * 4 - b.def * 2

Of course, replace the second portion with your attack formula.
Try using this: a.gainMp(10); a.atk * 4 - b.def * 2

Of course, replace the second portion with your attack formula.
That worked great, thanks!

Original thread: https://forums.rpgmakerweb.com/threads/skill-that-does-damage-heals-user-mp.115076/