Establish State only once (Yanfly Auto Passive States)

I'm using Yanfly's AutoPassiveStates plugin and I have nothing wrong to say about it, but
I'm struggling with my State - Frost Nova. I want to make my state to deal 25% of original damage
to all remaining, alive enemies in battle. So basing on Yanfly's tips and tricks I made for my state following code:

Spoiler
Code:
<Custom Establish Effect>
if (this.isHpEffect() && value > 0)
{
    /* define damage reduction from Nova frost Passive skill */
    var rate = 0.25;
   
    /* calculate damage formula, reduce damage to 25% */
    var dmg = Math.ceil(value * rate);
   
    /* Get all living allies in enemy side of battle */
    var team = target.friendsUnit().aliveMembers();
   
    /* Run through all living enemies and apply Frost Nova */
    for (var i = 0; i <= team.length; i++)
    {
        /* Create a "handler" for array "team" */
        var foe = team[i];
       
        /* Check if foe is not target */ 
        if (foe !== target && foe)
        {
            /* Play animation of ice */
            foe.startAnimation(36);
           
            /* Reduce HP allied foe */
            foe.gainHp(-dmg);
           
            /* Display damage */
            foe.startDamagePopup();
           
            /* If enemy is about to die... */
            if (foe.isDead()) 
            {
                /* ... Put him down! */
                foe.performCollapse();
            }
           
            /* Clear data */
            foe.clearResult();
        }
   
    /* Prevent damage to go below 0 */
    value = Math.max(value, 0);
    }
}
</Custom Establish Effect>

To be honest... This code works 100% well on skills where the scope is set to 1 enemy...
My problem starts when the scope is set to "2,3,4 random enemies or All enemies", states takes
effect on each enemy in battle, but it repeats the same amount as number of enemies in battle.

How to limit it to make it run once through all enemies regardles of skill scope set?

Original thread: https://forums.rpgmakerweb.com/threads/establish-state-only-once-yanfly-auto-passive-states.113559/