How to mimic Pokémon's "Wonder Guard"?

would there be an easy way to mimic Pokémon's Wonder Guard ability, the one Shedinja has where only moves of a certain type can damage/kill the fighter? i know this can probably be assisted with elements, so is there a way i could have it where a certian party member/class/equipment can only take damage when, say, a psychic attack is used?
additionally, can the same be done for equipment? if im not mistaken, only party members can use equipment, so this might only apply for enemies, but if enemies can hold equipment too that would be interesting.
thank you to anyone who offers advice/assistance.
Im not sure what part of wonder guard the question is about.
you give a piece of equipment, a class, an actor, a state, or an enemy traits that set their element rate to everything you want them to null to 0. So if an enemy is supposed to only take psychic damage, you make them have an element rate of 0 to everything else.

did you mean you wanted damage to be set to 0 upon taking a hit if the target's element rate for the attack isnt greater than 1 so that states that modify element rates can change what gets nullified?
@Robro33 Pretty sure OP wants a state that nulls damage depending on the element rate of the user, so if one character is weak to Psychic, Wonder Guard doesn't work. If someone else has the state but they're neutral to Psychic or resist it, Wonder Guard will kick in and block it.

@Ruskah Easy? Not really. It's quite complicated, especially if you throw in attacks that are multi-elemental. But here's what I got anyway.

#1: Get Yanfly Auto Passive States, as well as Buff & States Core.

#2: Create the Wonder Guard state.

#3: Put this code into its notetag -
JavaScript:
<Custom React Effect>
if (this.isHpEffect() && value >= 0) {
  var elements = this.getItemElements();

  // Due how this works, this only blocks
  // attacks that are just the element
  // It poops itself when an attack has
  // multiple elements (such as the normal
  // attack).

  if (target.elementRate(elements) > 1) {
    // does nothing
  } else {
   // actual function that cuts non-supereffective damage to 0
       value = 0;

  // animations that play when you get hit with an ineffective element

  if (elements.contains([your id]) || elements.contains([your id]) || elements.contains([your id])) {
  target.startAnimation([your id]);
  } else if (elements.contains([your id]) || elements.contains([your id])) {
  target.startAnimation([your id]);
  }
 }
}
</Custom React Effect>

#4: Use Auto Passive States to assign the effect to a piece of equipment, an enemy, or an actor.
Pretty sure OP wants a state that nulls damage depending on the element rate of the user, so if one character is weak to Psychic, Wonder Guard doesn't work. If someone else has the state but they're neutral or resisted, Wonder Guard will kick in and block it.
yeah, that exactly. for context, i've got a sort of "pokemon fangame" planned, and one of the leads is a shedinja, so obv i wanna use wonder guard lol
Easy? Not really. It's quite complicated, especially if you throw in attacks that are multi-elemental
thankfully for myself, im gonna stick to the pokemon tradition of one move types. if i do decide on multi-move types im gonna agonise over whether every punch move should be part fighting or not and i rly dont care to do that lol
thank u for the code btw 😀👍
This thread is closed due to being reported as solved. If you need it reopened, report it to let us know. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-mimic-pokemons-wonder-guard.173874/