MV Yanfly Buff & States - "Trapped" State

Hi all-

I'm trying to make a custom state that lasts for one enemy attack; instead of doing damage, the enemy will instead take some. Essentially, a one-time counter that nukes itself upon activation.

Right now I'm playing around with the Thornmail state-

Spoiler: Link+ Info Beneath
http://yanfly.moe/2016/03/12/tips-tricks-thornmail/
<Custom React Effect>
// Check to see if any physical damage is dealt.
if (value > 0 && this.isPhysical()) {
// Sets the Recoil Rate to 15%.
var rate = 0.15;
// Determines the amount of recoil damage dealt.
var recoil = value * rate;
// Sets the DEF bonus rate to 25%.
var rate = 0.25;
// Determines the amount of bonus damage dealt.
var bonus = target.def * rate;
// Rounds up the bonus damage and recoil damage.
var dmg = Math.ceil(bonus + recoil);
// Makes the attacker lose damage equal to the dmg variable.
user.gainHp(-1 * dmg);
// Check to see if the attacker is dead.
if (user.isDead()) {
// If the attacker is dead, make it collapse.
user.performCollapse();
}
}
</Custom React Effect>

I'm having trouble figuring out how to avoid damage landing at all; I see value = 0 is a thing, but can you avoid the damage popup on the target?

(I figured out to remove the state, you just add target.removeState(##); )

Spoiler: My Current Code
<Custom React Effect>
// Check to see if any physical damage is dealt.
if (value > 0 && this.isPhysical()) {
// Sets the Recoil Rate to 100%.
var rate = 1;
// Determines the amount of recoil damage dealt.
var recoil = value * rate;
// Sets the DEF bonus rate to 25%.
var rate = 0.25;
// Determines the amount of bonus damage dealt.
var bonus = target.def * rate;
// Rounds up the bonus damage and recoil damage.
var dmg = Math.ceil(bonus + recoil);
// Makes the attacker lose damage equal to the dmg variable.
user.gainHp(-1 * dmg);
//Play Trap animation
user.startAnimation(120);
//Set damage to 0
value = 0;
// Check to see if the attacker is dead.
if (user.isDead()) {
// If the attacker is dead, make it collapse.
user.performCollapse();
}
//Remove state from target
target.removeState(30);
}
</Custom React Effect>
If you're using YEP's Target Core, you can set that state to make it so nothing can target the actor/enemy affected by that state. While nothing can select them, they can't take any damage. (No damage popup!)
If you're using YEP's Target Core, you can set that state to make it so nothing can target the actor/enemy affected by that state. While nothing can select them, they can't take any damage. (No damage popup!)

The idea is that the enemy /can/ (physically) attack them, but they get punished for doing so. Not so much that they're blocked from being targeted.

Booby trap, not barrier.

(Though I am using TargetCore for other reasons.)

Original thread: https://forums.rpgmakerweb.com/threads/mv-yanfly-buff-states-trapped-state.104502/