MV HIME_BattleActionExp + YEP_DamageCore?

Plugins:
So I'm attempting to implement Action XP Gain mechanics in my project and was reading through the Help section of HIME_BattleActionExp. It explains how to get XP gained to be based on the amount of damage dealt compared to the target's HP. However, there is a limitation stated towards the bottom of the plugin help section that I'm trying to circumvent:
Spoiler: Hime_BattleActionExp
Let's say that instead of only receiving exp when an enemy is defeated, you wanted to receive exp based on the amount of damage you deal, as a percentage of the enemy's exp.

That is to say, if the enemy has 100 HP and gives a total of 100 exp, and you deal 20 damage, then you will receive 20% exp from the enemy, or 20 exp.

To accomplish this, you can retrieve the damage dealt from the action result object for the target:

b.result()

From there, you can ask for the HP Damage:

b.result().hpDamage

To get the ratio, you would take that and divide it by the target's max HP

b.result().hpDamage / b.mhp

Which would give you the percentage of damage that you dealt relative to the target's total HP.

Finally, you can multiply this percentage with the enemy's total EXP, to determine the fraction of EXP that the attacker receives:

(b.result().hpDamage / b.mhp) * b.exp()

Again, because only enemy's have EXP by default, you may need to check if the target is actually an enemy:

b.isEnemy() ? (b.result().hpDamage / b.mhp) * b.exp() : 0

Which means if you target an actor, you receive no exp.

Now, what happens if the amount of damage you deal is greater than the amount of HP the enemy has left? For example, if you deal 200 damage to an enemy with only 100 HP.

Unfortunately, with this plugin alone, you don't have access to the enemy's HP BEFORE the action was applied, but if you had such a plugin, and it stored this information in a property called `oldHp` in the action result, you could say this:

b.isEnemy() ? (Math.min(b.result().hpDamage, b.result().oldHp) / b.mhp) * b.exp() : 0
So I was thinking...couldn't I use YEP_DamageCore to add this 'oldHp' property at the end of every damage calculation step? Then I could reference it using Hime's plugin in order to account for overkill dmg and so forth? I hope I'm on the right track, and if so, I would greatly appreciate any help in this matter. Thx!

Edit: Alternatively, perhaps it would be more appropriate to use a <Custom Respond Effect> notetag (via a passive state applied to all units in-game) and have it so that the 'oldHp' property is added/updated that way. This would utilize YEP_BuffsStatesCore ofc.

Original thread: https://forums.rpgmakerweb.com/threads/hime_battleactionexp-yep_damagecore.138321/