When someone asks "Is it A or is it B?" answering "well kinda yes" is less helpful than it might be.
Just for the sake of clarity, is this what you want?
A skill which detects what the enemy's weakness is and then only uses that element in its attack.
If that is so, I hope you don't have lots of elements, because this could get very complicated.
For each element, create a passive state, unnamed and without an icon so that the player does not know it exists.
You give each enemy which has an elemental weakness the appropriate passive state in the database.
Your skill then has to detect which (if any) passive state the target has before applying the appropriate attack.
This is the point where it gets complicated, because you are going to have to do a quite extensive snippet, as clearly the check and damage is far too long for the damage formula box.
When I did this, I only had a skill which checked for one element and that was a bit tricky to work out. A fire skill did X if the state was present and Y if it was not. A water skill did Z if the state was present and Y if it was not.
In all probability if you want a multiple check, you might be better asking for a script.