Shield that causes 5 damage to attacker

I want to make a shield, that when it successfully blocks, deals 5% of the attackers damage back to them.

I am using most Yanfly plugins and the AP_Blocking plugin.
I'm not sure about triggering it on blocking but if you want create a similar passive effect just from having the shield equipped use the auto passive state and buffs and states core plugins to have it add a state on equip and then put this code in the state:

<Custom Respond Effect>
user.gainHp(Math.round(value * 0.05 * -1) - 1);
</Custom Respond Effect>

This makes it so when you're attacked the enemy will take 5% of the damage dealt to you as well the -1 on the end is three so that it will always do at least 1 damage.

Original thread: https://forums.rpgmakerweb.com/threads/shield-that-causes-5-damage-to-attacker.109083/