Skills that cost a percentage of MP and influences damage/recovery.

My searches on the forum (and general web) were fruitless and I'm hoping that a member of the community can help me find an existing answer or help out with figuring out a solution.

What I'm trying to ask is whether or not there is a method of using the Damage Formula section within RPGMZ's skills database to do the following (examples will be shared below):
- Change the cost of a skill from a flat amount of MP to be a percentage of total MP
- Account for the amount of MP used for the skill to affect the skill damage recovery

As an example
In the default game when you launch RPGMZ you can find in the skills tab "Fire I"
This skill cost 15MP and uses the following formula for damage with a 20% variance (100 + a.mat * 2 - b.mdf * 2).

I would like the skill to instead cost 5% of total Player MP.
So if Albert, our default Sorcerer, has 131 MP the skill would cost 6.55MP (I'm fine with having the cost always round up to the highest full number). So, in this example, Fire I cost 7 MP

That 7 MP should then be accounted for in the damage formula. Something like (MP Spent * 5 + a.mat * 2 - b.mdf * 2) with a variance of 20%.
Assuming Alberts Magical Attack power is 30 (and his targets Magical Defense is 20) the resulting damage range would be:
7 * 5 + 30 * 2 - 20 * 2
35 + 60 - 40
55 damage (the 20% variance would make the damage range be between 44 and 66).

When Albert is level 35, and has some spanky new gear, he revisits his low-level roots and sees this same enemy. Now his max MP is 649 and his Magical Attack is 114.
Fire I now has a base cost of 33
33 * 5 + 114 * 2 - 20 * 2
165 + 228 - 40
353 damage (the 20% variance would make the damage range be 315 (rounding up again) and 424.

The ability to play with the multiplier and mana cost of the spell will be important in balancing.

Let me know if further elaboration is needed! To recap, I need help with establishing a method for the skill to cost a percentage of MP (and for it to be reflected so the players can see that cost before selecting it) and then additional help with establishing the damage formula so it uses spent MP in the calculation.
At the start of battle, calculate the % cost for the Skill for the Actor equipped with it, storing the value into a variable. Each turn, check whether that Actor's current MP is below that value, and if so, inflict a 1-turn State upon them that seals the Skill.

For damage calculation, you can just use v[x] in the formula to use the cost of the Skill, taken from the variable.
And link the Skill to a Common Event to detract the cost from the Actor's MP. The only thing not doable without a plugin is displaying the %MP cost in the Skill menu and selection. The best option would be to include the value in the description, otherwise, get a plugin for it.
Thanks.

I was able to leverage the "Skills & States Core plugin" from VisuStella to more or less accomplish the goal of setting the MP cost of a skill to a percentage of Maximum MP. I need to play around with it a bit further since it was doing a little funkiness with rounding on its own but it was definitely working.

For the damage I was able to make a Battle Formula that works. I'll share it here and break it down in case someone else stumbles across this in the future looking for something similar.

(a.mmp * 0.05) * 5 + a.mat * 2 - b.mdf * 2
Variance set to 20% inside the skill window of RPGMZ

"a.mmp" references the players Maximum MP
Multiplying it by 0.05 basically brings it down to 5% of the value.

Original thread: https://forums.rpgmakerweb.com/threads/skills-that-cost-a-percentage-of-mp-and-influences-damage-recovery.132896/