Need a formula for Checking states.

I have tried using "if (b.states.size > 0) {a.atk * 8 - b.def * 2} else {a.atk * 4 - b.def * 2}" but this does not work, I cannot seem to get b.states.size to work for any formula. This particular formula is at least producing damage but is not increasing the damage when they are afflicted by a state( poison, sleep etc.). another one I have tried is "dmg = a.atk * 4 - b.def * 2; dmg * (1 + b.states.size)" produces 0 damage always.

Now maybe I am misunderstanding, I thought b would make it check the states of my target so it would check the states my enemy has but does b in b.states.size only determine the the actors states?

Also as a bonus I would also prefer a way to grow this depending how many states are in effect but not specific ones basically I want it to be somewhat simple to determine due to how many states an enemy has like 3 the multiplication factor for the ability. This class is going to inflict states then use a skill that only if inflicted would do 2x the damage then another skill might do damage based off how many states. Again no skill is going to look for specific states just amount and yes or no they are there.
I'm not sure about increasing damage based on total amounts of states, but for state conditions I use this:

b.isStateAffected(1) ? (a.mat * 1 - b.mdf * 1) * 2 : a.mat * 1 - b.mdf * 1
Try this:

Code:
b._states.length > 0 ? a.atk*8 - b.def*2 : a.atk*4 - b.def*2

If you want it to do 3x damage if there are 2 states you could try something like this:

Code:
(b._states.length + 1) * a.atk * 4 - b.def * 2

This will mean 2 states deals 3x damage, 3 states deals 4x damage and so on. If you want to add a cap to the amount the damage can by multiplied by you can use something like this:

Code:
Math.min(b._states.length + 1, 3) * a.atk * 4 - b.def * 2

This particular example will cap the damage at 3x the base damage. "Math.min(b._state.length, x)". Replace x with the cap.
It looks like you've used an Ace formula as a reference. The terms/commands will be different for MV.
Thanks I am going to try these out, I saw a list for MV states and it just contained information on checking if it had a particular state.

Original thread: https://forums.rpgmakerweb.com/threads/need-a-formula-for-checking-states.105326/