MV Exclude Skills from Yanfly's "Thornmail"

Hi guys!
Yanfly's Thornmail State from one of his Tips and Tricks deals damage to the attacker whenever the wielder takes damage from a physical attack. I'd like to exclude some physical skills from that, ranged attacks for example shouldn't trigger the thornmail effect.
Ideally I could just put a notetag to the skills in question, but I don't think it's that easy without altering the plugin right? So maybe we could something into the state notetag that excludes certain skills or if that's not possible damage types? The latter will probably cause problems with multi-type skills though ...
Any ideas how to take this on?
Basically you'd take the thornmail effect, and add in something that checks if the incoming skill is of a certain element, and then ignore it. You can do this by checking this.item().damage.elementId.

Code:
<Custom React Effect>
// Check to see if any physical damage is dealt.
if (value > 0 && this.isPhysical() && this.item().damage.elementId != 4) {
  // 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>

this.item() is the skill that was used, so you could also hardcode specific skills that do not trigger the thorns effect by naming them and using this.item().name:
if (value > 0 && this.isPhysical() && this.item().name != "Arrow Storm") {
Nice! That's all I need 🙂
EDIT: Or not, sorry, another quick question: To exclude multiple elements/skills is there something like an OR function or do I have to add all of them via
JavaScript:
&& this.item().damage.elementId != x

Also can I somehow ask for the Skill ID instead of the name (just to make translation easier afterwards)?

Anyway you did help me alot already, thank you!!
And I love your state workshop.
this.item().id should be the skill Id.

Also, you can you an or operator in the note tags, but it might be easier to use an array and then an array.includes() function to check against.

Code:
<Custom React Effect>
// Check to see if any physical damage is dealt.
var ignoredskills = [3,12,16,66]
if (value > 0 && this.isPhysical() && !ignoredskills.includes(this.item().id)) {
  // 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>
First we define a number of skill ids that are ignored, then we change the effect so that the condition to trigger it is not true if the skill being used is one of the ids contained in the array.
Alright, thank you!

Original thread: https://forums.rpgmakerweb.com/threads/exclude-skills-from-yanflys-thornmail.158751/