Making a skill that applies to the enemy give the player MP or TP back.

I'm using Yanfly's Skill Core plugin to do % and flat number costs on skills. However, I have some skills that need to apply to or target the enemy that cost MP or TP that I also want to restore MP or TP to the player.

The plugin doesn't appear to be able to do this, so I assume a formula is necessary.

How do I set this up, if anyone doesn't mind helping me?

(Hopefully this isn't the wrong area for this question.)

Thank you!
Setting up a magic drain skill is easy:
Magic Drain Skill.png

Just change the MP/TP costs to what you want & change the damage formula number to the amount you want.

As for draining TP, that's the hard part. It can't be done by default but it might be possible through the damage formula. I've actually got a topic ongoing right now to make a TP draining skill that doesn't take more than what the target actually has.
https://forums.rpgmakerweb.com/index.php?threads/need-help-with-an-error.109328/
MP drain is part of the default code. Now if you want it to do damage and MP drain, that's tougher. I did it by adding the MP drain as a feature instead.

TP drain though will probably require JavaScript code to do. I'll move this to JavaScript Support for that.
Thank you for replying, @Animebryan and @bgillisp!

I think TP Gain serves the purpose I was looking for.

The skills aren't necessarily meant to drain MP or TP from the enemy, but simply to replenish the user's MP or TP when they use the skill while subtracting another resource from the user of the skill, as I described above (which I do via notetags and a plugin).

However, if a simple gain of MP is not possible, I may have to use MP Drain.
So, is MP Drain the only solution?
You can add these code in the damage formula, before the actual damage to recover MP/TP to the caster

Code:
a.gainTp(value)
a.gainMp(value)

//so like
a.gainTp(100);a.atk*4-b.def*2
//this will recover the user's TP by 100 and deal damage to the enemy

Original thread: https://forums.rpgmakerweb.com/threads/making-a-skill-that-applies-to-the-enemy-give-the-player-mp-or-tp-back.109422/