Threads of Fate style stat increase

In the PS1 game Threads of Fate, your character does not level up, but rather gains max HP from taking damage, and max MP from using magic. I'm not sure what the exact formula is, but I believe if you take accumulative damage equivalent to >60% of your max health, your max HP increases by 1 point. This applies if you recover HP also: so if you start a battle with 100 HP, take 50 damage, heal, and then take 10 damage, your new max HP will be 101. The same applies to MP.

Ultimately, I'm looking for a plugin that replicates this. Ideally, I could use it toward the other stats as well (STR, DEF, MDEF, etc.) Does such a plugin exist?
Someone might know of something more specific, but you could use Yanfly's Damage Control. You'd create global variables to track how much damage each player has taken, and add a step in the damage control to increment that variable. In the next step, turn on a flag for a common event to check whether that qualifies the stat for increasing, and do so.

That would work for HP and Def, for Str and MAtk and MP you could add a common event call to all of your skills to track having initiated a physical attack or a magic attack, how much MP was spent, etc.

So I've found this but now I need to find out how to implement formulas into it.

EDIT:
You'd create global variables to track how much damage each player has taken,
@ATT_Turan How would I go about doing this first part?

Original thread: https://forums.rpgmakerweb.com/threads/threads-of-fate-style-stat-increase.124746/