MV Using TP instead of Mana

Hello there,
Some time ago I played Ruined King and it has a cool mechanic called Overcharge. Whenever you use a normal attack, you get some Overcharge points that can be used instead of mana when using abilities.

When you don't have enough overcharge points, you just use mana. When you have no mana, you need to use normal attacks to raise your Overcharge points (or use an item to replenish mana).

I know that you can set an ability to use Mana, TP or both, but nothing like I described by default.
Is there a plugin that does this check or a way to configure this in other plugins?

Video explaining the whole system:
yanfly's skill core has a notetag that lets you change skill costs dynamically. you could use the <Custom MP Cost> and <Custom TP Cost> notetags to make it so that if the user's TP ia at 100, the mp cost is 0 and the tp cost is 100, otherwise, the mp cost is the mp cost and the tp cost is 0
You can use Yanfly's Skillcore.

In this case make 2 versions of the skill, and then give them both a show condition: One shows when you have enough overcharge and uses overcharge, the other shows in if you don't have enough overcharge and uses mana. Or the other way around.

(Funny thing that @Robro33 posted another solution while I type this, using the same plugin, but being a totally different method.)
And, just to expound on what @Robro33 said, it doesn't have to be all or nothing. It's a simple bit of math to say "the cost is X," and you pay as much of that as possible from TP with the rest going to MP.

Then only if both TP and MP combined are insufficient would the skill be unavailable to use.
Robros solution would be smoother, mine is probably simpler. If I were you, I'd try their method first.
Thank you guys.

Side note: is there a way to limit the maximum amount of TP? Like, instead of 100, set it to maximum 30.
I'm sure if you looked at any of the TP-related plugins out there that would be a common feature.

But you can paste the below into a text editor, save it as a *.js file, and include it as a plugin. Change the value to whatever you want.
Code:
Game_BattlerBase.prototype.maxTp = function() {
    return 100;
};
The answer comes again from the yanfly plugins: YEP_EnhancedTP

Original thread: https://forums.rpgmakerweb.com/threads/using-tp-instead-of-mana.169209/