Need a plugin for state removal by damage to work with either physical or magical damage

Need a plugin that makes state removal by damage work on only for physical or magical damage. For example, in the Final Fantasy series, Sleep would only be removed due to physical damage, not magical damage. Perhaps maybe have a state that has a high physical evasion rate (like 80%) but would be removed if ever hit by a physical attack. By default, the remove by damage option is indiscriminate whether the damage is physical or magical.


Any help with this would be appreciated, thank you.
require Yanfly's buffs and states core.


put this in your state's notetag.


<Custom React Effect>
if (this.isMagical()) {
target.removeState(x);
}
</Custom React Effect>


change x to your "sleep" state id.


use

Code:
this.isMagical() >> for magical hit.
this.isCertainHit() >> for certain hit.
this.isPhysical() >> for physical hit.
Thanks for the help! I didn't know that plugin could do that due to not being familiar with javascript codes.

Original thread: https://forums.rpgmakerweb.com/threads/need-a-plugin-for-state-removal-by-damage-to-work-with-either-physical-or-magical-damage.56183/