What is the HP/MP/TP Transfer/Absorb Skill Formula?

For one example, let's say I have a skill that shaves off 15 HP/MP/TP from one party member and gives that to an ally, but the user in question has less than 15 HP/MP/TP; I don't want the party member getting more than what the user sacrificed. You could substitute the 15 for a percentage instead and have the same rules apply. On a related note, in the case of HP, for some skills I don't want the user's HP completely drained so they'll have 1 HP at the end of it.

For HP/MP/TP absorb, I would want the same rules to apply.

Original thread: https://forums.rpgmakerweb.com/threads/what-is-the-hp-mp-tp-transfer-absorb-skill-formula.116123/