MV [RPG MV] Yanfly check if reflect is triggered [Solved]

Hello everyone!

I’m currently trying to set up a system where an attacker gets a state applied to them if their attack gets reflected due to an element reflect.
So basically: "If a reflect was triggered, then apply a state to the attacker."
I’m not very experienced with JavaScript, so I’m having some trouble figuring this out.
Here's what I have so far:
I’m using Yanfly's Element Core to reflect certain elements back to the attacker.
Spoiler: Reflect
// These are in the notebox of the state
<Element Reflect 1: +100%>
<Element Reflect 2: +100%>
<Element Reflect 3: +100%>
<Custom Respond Effect>
// or maybe it's <Custom React Effect>, I'm unsure which one works better for reflection
if (REFLECT TRIGGERED?) {
user.addState(452); // I want to apply this state to the attacker, but I'm not sure if "user" is the right one here.
}
</Custom Respond Effect>

What I need help with:
How do I detect if a reflect actually happened?
And how do I make sure the state is applied to the attacker, not the target?

Any help or clarification would be greatly appreciated. Thank you so much in advance!
i havent done much with reflection myself, but actions do gain a _reflectionTarget property written into them on reflect that you can use to tell if its been reflected. However, since reflections change which battler the action's apply() is ran on, i dont believe any buffs and states core notetag on the target would be able to run at all.

I could be wrong. Try it out, and if it doesnt work you might need to put a passive with a respond effect on your actors to see if theyre being hit by a reflected skill, or change your approach and check within the skills themselves with yanfly's skill core notetags rather than with states
i havent done much with reflection myself, but actions do gain a _reflectionTarget property written into them on reflect that you can use to tell if its been reflected. However, since reflections change which battler the action's apply() is ran on, i dont believe any buffs and states core notetag on the target would be able to run at all.

I could be wrong. Try it out, and if it doesnt work you might need to put a passive with a respond effect on your actors to see if theyre being hit by a reflected skill, or change your approach and check within the skills themselves with yanfly's skill core notetags rather than with states
Thank you for your reply.
However, my knowledge for JavaScript is not good. How would I use '_reflectionTarget' in the notetag for states?
within respond/react effects, "this" refers to the current action. so if you use
Code:
if (this._reflectionTarget)
within them, itll pass as being true if the skill was reflected or fails if it wasnt since the property is only ever created on reflect.
Thank you for your help.
I am able to check if a reflect happened. I should be able to do some work around along with the help of Yanfly tips and tricks.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/rpg-mv-yanfly-check-if-reflect-is-triggered-solved.176929/