Adding modifier depending on state in damage formula

Ok so I'm a bit new when it comes to damage formulas, I made a formula which works fine up until I wanted to add onto the formula to deal double damage if the user is affected by a state.

The entire formula is
Spoiler
( ( ( (2 * a.level / 5) +2 ) * 70 * a.atk / b.def ) / 50 + 2 ) * a.isStateAffected(76) ? (* 2) : (* 1);

However this deals zero damage either with or without the state applied

I messed around and saw that, from what I can tell it completely ignores the rest of the formula and only does *2 or *1, which would just be doubling nothing

How do I solve this? I just want to add the * 2 as a modifier or whatever when the state is applied? I also wanted to add more than one modifier depending on states inside the formula
I apologize, a friend of mine has provided me the solution to my problem so I don't need any help
So it would seem that the solution my friend provided me, did in fact not actually work, so i am back to square one

How do I add the double damage as a sorta modifier?
JavaScript:
(((2 + 2 * a.level / 5) * 70 * a.atk / b.def ) / 50 + 2) * (a.isStateAffected(76) ? 2 : 1)
JavaScript:
(((2 + 2 * a.level / 5) * 70 * a.atk / b.def ) / 50 + 2) * (a.isStateAffected(76) ? 2 : 1)
I tried using that, maybe I just don't understand how things work but the damage it dealt didn't seem to make sense

While not the same formula I used
JavaScript:
(((2 * a.level / 5) + 2) * 100 * a.atk / b.def) / 50 + 2 * (a.isStateAffected(62) ? 1.5 : 1) * (a.isStateAffected(25) ? 1.5 : 1);
for another skill and without both states it dealt around 37 damage but with both states it only dealt 38 damage which I don't think is the right number as that wouldn't be 37 x 1.5? Shouldn't it be 55-ish damage?
It's just another order-of-operations thing.
JavaScript:
/* stuff */ + 2 * (a.isStateAffected(62) ? 1.5 : 1) * (a.isStateAffected(25) ? 1.5 : 1);
Here, you have 2 different states, each of which give a x1.5 multiplier to the +2 at the end. So you get:
  • Target has neither state: +2 damage (2 * 1 * 1);
  • Target has 1 of the states: +3 damage (2 * 1.5 * 1);
  • Target has both states: +4.5 damage (2 * 1.5 * 1.5).
(By default the final result is rounded to the nearest integer.)

In the example I gave, there are brackets () around the first chunk, so the multiplier affects the entire thing rather than just the +2 at the end. 👋
Here, you have 2 different states, each of which give a x1.5 multiplier to the +2 at the end. So you get:

Oooooooh! That makes so much sense, thank you, I put brackets around the first part and now it works fine, thank you
Great! Happy RPG Making~ 😂

Original thread: https://forums.rpgmakerweb.com/threads/adding-modifier-depending-on-state-in-damage-formula.163696/