MV Finding the element of an attack for Buffs and States Core

Hi all,

I am trying to set up a state that does this:
Enemy gets a state
If that enemy gets attacked with a specific element while in this state: increase a specific game variable.

I am using yanflys buffs and states core and am trying to set it up like this:

<Custom React Effect>
if (this._action.getItemElements().contains(5)😉
{
$gameVariables.setValue(48, $gameVariables.value(48) + 1);
}
</Custom React Effect>

But that doesn't seem to work. So I believe I don't know what exactly to call for the if statement. If anyone can help, I would greatly appreciate it.
Code:
<Custom React Effect>
   //where X is the element you want:
   if(this.getItemElements().contains(X)){}
</Custom React Effect>
Code:
<Custom React Effect>
   //where X is the element you want:
   if(this.getItemElements().contains(X)){}
</Custom React Effect>
Thanks for replying but unfortunately it doesn't seem to work.
it should. what happened?
it should. what happened?
It just doesn't do anything. I tried other conditionals that I know work just to make sure it wasn't my code inside being wrong. But other conditions seemed to work fine. To be clear,

this worked:
Code:
<Custom React Effect>
if (value > 0 && this.isPhysical()){
target.startAnimation(146);
$gameVariables.setValue(48, $gameVariables.value(48) + 1);}
</Custom React Effect>

But this did nothing:
Code:
<Custom React Effect>
if (value > 0 && this.getItemElements().contains(5)){
user.startAnimation(146);
$gameVariables.setValue(48, $gameVariables.value(48) + 1);}
</Custom React Effect>
it should. what happened?
I think I figured it out, with this:

Code:
if (this.item().damage.elementId === 5)

Thank you so much for helping!
getItemElements() is not in the default MV code, it's a part of Yanfly's Element Core.

Original thread: https://forums.rpgmakerweb.com/threads/finding-the-element-of-an-attack-for-buffs-and-states-core.150480/