How to check if enemy has a elemental weakness in damage formula?

I want to make a skill that does a lot more damage than normal if the enemy has an elemental weakness.
Even if i put the elemental weakness for enemies at 200%, I want to do for example 500% ONLY for this skill, so I tought about a condition in the formula. I don't know the syntax though.
This may be super tedious if you have a lot of enemies (for instance, for a very long game), but you could simply make a special element for this attack, then when you're assigning elemental weakness, assign an even larger weakness to this specific "element".
So for instance: Ice Crystal is weak to Fire damage at 200%, but also weak to "Special" at 500%
For creatures that don't have special weaknesses, just don't include the extra weakness.
The way I did this was:
  • Create a state called Fire Weakness (or whatever the element is) with e.g. state id 21
  • In the Enemies tab in the notebox, I gave enemies that I wanted to be vulnerable to this skill state 21 as a passive.
  • In the damage formula you put something like this:
Code:
b:state?(21) ? big damage formula : normal damage formula

Obviously you change (21) to whatever your state id is.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-check-if-enemy-has-a-elemental-weakness-in-damage-formula.138447/