MV A maximum hp system similar to Dragon's Dogma 2?

After playing through this game, I am absolutely infatuated with how this system works, and really would love to incorporate it into my game and wondering if there are any plugins that do this - or if it would be simple to create. For those of you who haven't played the game, the system works like this. Say you have 100 hp and you get hit for 20 damage. You would then take 20 damage, but your maximum hp would drop a percentage, for this explanation lets say 3%. So now your maximum hp is 97 hp. You can heal those 20 hp back up that you took, but you couldn't go above 97 now. Say you got hit again for 20 damage, your max hp is now at 94. This would continue until you rest, and then your max hp would revert back to 100.

Original thread: https://forums.rpgmakerweb.com/threads/a-maximum-hp-system-similar-to-dragons-dogma-2.167757/