How to know if the effect received has states?

Hello everyone,

I'm currently working on a feature for an armor in my game. This armor is designed to increase the wearer's luck whenever they are affected by any status condition, with the functionality powered by Yanfly's Buffs & States Core plugin.

When the character equipped with this armor receives any state from an enemy, their luck should increase.

Here is what I'm aiming to achieve:

The armor has a <Passive state> tag to a state with the following state

Code:
<Custom Respond Effect>
if (!user.isActor() // This checks that the status is being applied by an enemy, assuming enemies are not actors.
    && this.hasStates() // This function does not exist; it's an example.
    ) {
    target.addbuff(7,4); // This is intended to increase luck.
}
</Custom Respond Effect>

(yes, a state checking for states)

I am aware that this.hasStates() is not an actual function; it's just a placeholder for the right method to check if any state has been applied.

I'm not sure how to check if any state has been applied to the target. Can anyone guide me on how to achieve this?

Thank you~~1→! :LZSjoy:
I don't use this plugin myself, and your description reads a bit unclear to me, but did you see the <Custom Apply Effect> in the documentation?

It says:

The code in between these notetags will run when the state is added onto a battler. The code will process after the state is actually applied.

Not sure exactly what you want to do, as your description says you want to buff the user, but the code you posted shows buffing the target.

In either case, you should be able to use the apply affect referenced above as the appropriate hook.
Thank you for your response and for pointing out the <Custom Apply Effect> tag from the documentation.

Apologies for any confusion in my initial post. To clarify, I am designing a special armor: it increases the wearer's luck whenever they receive a state condition from an enemy.

I think <Custom Apply Effect> triggers when a state is applied, what I need is to check when "any" state is applied to the wearer of a particular armor.

Thank you again for your help!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-know-if-the-effect-received-has-states.167078/