MV Help with passive skills like in pokemon: flame body and gooey. Are affecting the allies too

As in pokémon I would like to apply skills that exist in the game, however, I am having problems with the formulas to execute 3 types of states that will be executed practically in the same way, and will only have some small changes in the formula. The effects work, but as soon as an ally tries to use the buff, healing, or other support ability on the character with these states, the ally also receives the effects of these passive abilities, so I'm just looking for help to fix the formula so that it applies the effects correctly on enemies.

These will be passive skills, where I use the plugin: Auto Passive States (YEP).

Passive States:

STICKY: if there is physical damage, it slows down the enemy (30%)
FLAMING BODY: if there is physical damage, it burns the enemy (30%)
BRAND OF THE WITCH: if there is physical damage (20%), magic damage (10%), curses the enemy.

---------------------------------------------
The formulas I'm using:

<Custom Respond Effect>

if (target.isStateAffected (96) && Math.random () <0.3) {

user.addState (15);}

</ Custom Respond Effect>
-----------------------------------------------

What I tried:

<Custom Respond Effect>

if (target.isStateAffected (196) && this.isMagical () && Math.random () <0.3) {

user.addState (15);}

</ Custom Respond Effect>
I didn't test this, but I think will solve your problem:

Code:
if(target.isStateAffected (196) && user.isActor()==target.isEnemy() && Math.random()<0.3){
    user.addState (15);
}

Explanation:

this condition will be true only when:
  • the user is actor and the target is enemy (true==true)
  • the user is enemy and the target is actor (false==false)
And will fail when the user and target are in the same team, this way even an enemy affected by "Flamming body" could also burn an actor in the party 😂
Thank you very much, it worked very well. Even making the additions to check physical or magic damage, it kept working perfectly :LZSsmile:

Code:
<Custom Respond Effect>

if(target.isStateAffected (196) && user.isActor()==target.isEnemy()
&& this.isPhsysical && Math.random() <0.3){
    user.addState (15);
}

</Custom Respond Effect>
Moved to: JS Plugin Support

Original thread: https://forums.rpgmakerweb.com/threads/help-with-passive-skills-like-in-pokemon-flame-body-and-gooey-are-affecting-the-allies-too.132162/