Negate Damage if Damage is less than X% of MHP

Hey! 👋

I'm wondering if anyone could help me out with a script.

The title pretty much sums it up, I'm hoping to create an effect that will negate damage from an attack, if the damage dealt would be less than X% of their Max HP (something like <DamageNegate: 20> would negate any attack damage that would deal less than 20% of their MHP), that can ideally be applied to actors, classes, equipment, enemies, and states.

Hopefully I explained this in a way that makes sense. Let me know if you have any questions.

Thank you!
Is this looking at the damage value before or after critical and variance are applied?

What happens if you have a class that has 20 and a weapon that has 15?
Those are good questions, that I hadn't actually thought about.

For damage, I'd go for the final damage value only, after any critical hits/elemental resistances/etc have been calculated.

As for instances where more than 1 notetag is present, I'd just go for the highest notetag present. So an actor with 20 with a weapon with 15 would only factor in the 20.
I also have a question: is the mhp intended to be the target mhp or the user's?
Sorry for not clarifying. MHP is refering to the target of the attack. So if Actor1 has the tag, then when they are attacked, it will check Actor1's MHP.

Thinking about it a bit more, there will probably have to be some way for the script to tell if the target is being healed or damaged, since I'd ideally not have the tag negating healing effects.
Yanfly has a script that does this, under their lunatic scripts. You can set it to block all damage above x%, or even to 0 out any damage that is below a certain percentage.

I don't have the link to it though, but if you look up their scripts you should find it.

Original thread: https://forums.rpgmakerweb.com/threads/negate-damage-if-damage-is-less-than-x-of-mhp.113951/