MZ Making a passive state that increases damage done with elements an enemy is weak to?

As per the title, I wanted to make a state that increases the damage done with elements an enemy is weak to.
Using
JavaScript:
target.elementRate(i) > 1
succeeds in checking if the enemy is weak to an element (I think) but combining it with
JavaScript:
this.item().damage.elementId === i
to put in a Visustella JS notetag (I tried Pre-Damage) doesn't seem to do anything, possibly because the skill I tested it with is a regular attack. I want the state to work with any skill, including skills set to Normal Attack as element. Could anyone help me figure this out?
Not sure how you are doing this, but a simple

Element rate * anything over 100% it will take that extra damage from anything tagged with that element.

If it dosnt' for you, y ou got something a really odd plugin installed somewhere, as I do this with a simple element rate * 200% to make them take double damage from that element.

Also normal attack is not an element normally, or do you mean the element the weapons are set to? That's what normal attack does.
Hey,

the easiest way would probably be to check
Code:
this.calcElementRate(target) > 1
which is the same function that would normally determine the element rate multiplier.

target.elementRate does indeed only work for single elements.

Edit: A bit too slow
Ah, I forgot to mention I wanted to give this state to an actor. So if the actor uses a skill against an enemy that is weak to the skill's element, it'll result in extra damage on top of that weakness. 😅
I also want to include cases like the normal attack being changed to for example fire-based because of equipment.
Also, how would I use that function, if it's necessary for this case anyway?
You can use the function like you would use target.elementRate(i). For example:
Code:
<JS Pre-Damage as User>
if (this.calcElementRate(target) > 1) {
  value = Math.round(value * 1.3);
}
</JS Pre-Damage as User>
(At least I'm pretty sure the feature to modify the damage by changing the value variable still exists in Visustellas battle core)
I ended up accomplishing it by looking at a similar effect in MV and comparing it to code found in Visustella's elements plugin.

JavaScript:
<JS Pre-Damage As User>
if (this.isHpEffect() && value > 0) {
    if (this.item().damage.elementId < 0) {
        var elements = this.subject().attackElements();
    } else {
        var elements = this.elements();
    }
  for (var i = 0; i < elements.length; ++i) {
    var elementId = elements;
    if (target.elementRate(elementId) > 1.00) {
      var rate = 1.25;
      value = Math.ceil(value * rate);
      break;
    }
  }
}
</JS Pre-Damage As User>

However, I'm not sure if this is just doing the same thing as the calcElementRate function with extra steps or not (I looked at it in rmmz_objects.js and
JavaScript:
this.item().damage.elementId
didn't seem to work. Using
JavaScript:
this.subject().attackElements();
did work for the normal attack bit, though)

Original thread: https://forums.rpgmakerweb.com/threads/making-a-passive-state-that-increases-damage-done-with-elements-an-enemy-is-weak-to.159394/