YEP Auto Passive States conditional passives based on number of enemies

http://yanfly.moe/2015/10/17/yep-13-auto-passive-states/


I'm trying to add a passive state to a hero that increases his attack when there are more enemies. I know I need to use a conditional state, but I don't know how to code it.


So, if I want to create a passive state that doubles his attack when there are two enemies, I would use this actor notetag:

<Passive State: x> 



where x is the state ID. Then, I would add conditional js to the state notetag. This is the example code from Yanfly's website:

<Custom Passive Condition>
if (user.hp / user.mhp <= 0.25) {
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>



What do I change "user.hp / user.mhp <= 0.25" to in order to have the code check the number of enemies, returning true if it equals 2?
if ($gameTroop.aliveMembers().length == 2)


that should be it, hope I could help 🙂
That worked perfectly! Thank you!
In order to set the condition to check whether the character has a state already applied, will one of the below work?  


user.state==PoisonState


or


user.state==State.X
With my limited JS knowledge I'd say that looks right, but you might get more help posting your own thread with a specific title. It'll get your question more attention.

Original thread: https://forums.rpgmakerweb.com/threads/yep-auto-passive-states-conditional-passives-based-on-number-of-enemies.68945/