Problem with formula on skill damage box

Helo all
I'm trying to create a skill that increase the damage of the same skill every time is used. To do that, I want the skill to check for states and then do the damage that corresponds to that state. For example: Skill check for State 1, if the battler doesn't have that state, is does X damage and then recieve State 1, second time the skill is used, it check for State 2, if the battler doesn't have that state, but have the State 1, it does X+25% damage and add himself the State 2.
This was my failed attempt to do that:

Code:
if (a.isStateAffected(330)) {((a.atk**1.7)/(b.def)) * 3;} else if (a.isStateAffected(329)) {a.addState(330);((a.atk**1.7)/(b.def)) * 2.75;} else if (a.isStateAffected(328)) {a.addState(329);((a.atk**1.7)/(b.def)) * 2.5;} else if (a.isStateAffected(327)) {a.addState(328);((a.atk**1.7)/(b.def)) * 2.25;} else if (a.isStateAffected(326)) {a.addState(327);((a.atk**1.7)/(b.def)) * 2;} else if (a.isStateAffected(325)) {a.addState(326);((a.atk**1.7)/(b.def)) * 1.75;} else if (a.isStateAffected(324)) {a.addState(325);((a.atk**1.7)/(b.def)) * 1.5;} else if (a.isStateAffected(323)) {a.addState(324);((a.atk**1.7)/(b.def)) * 1.25;} else if (a.isStateAffected(322)) {a.addState(323);((a.atk**1.7)/(b.def)) * 1;} else if (a.isStateAffected(321)) {a.addState(322); ((a.atk**1.7)/(b.def)) * 0.75}; else {a.addState(321); ((a.atk**1.7)/(b.def)) * 0.5};

Any ideas how to make that work?
In some places you have double sign of multiplications ( * )
In some places you have double sign of multiplications ( * )

Those double signs are for power to 1.7. I erased them just in case, but still not working
i remember seeing a youtube tutorial for this kinda skill using a stacking state plugin.
and i once used skills exactly like this but only with 1 increase.

those double * would definitely break it
also shouldnt be using double (( )) around the damage formulas. only 1 set of ( ) each formula

edit actually seeing alot of extra brackets mainly around formulas. and some missing brackets around the check states
Double multiplication signs is actually legit. It's used for powers:

Code:
Math.pow(2, 4) === 2 ** 4; // true

Also, the extra parentheses, while completely unnecessary, shouldn't be breaking it.

That said...

Code:
if (a.isStateAffected(330)) {((a.atk**1.7)/(b.def)) * 3;} else if (a.isStateAffected(329)) {a.addState(330);((a.atk**1.7)/(b.def)) * 2.75;} else if (a.isStateAffected(328)) {a.addState(329);((a.atk**1.7)/(b.def)) * 2.5;} else if (a.isStateAffected(327)) {a.addState(328);((a.atk**1.7)/(b.def)) * 2.25;} else if (a.isStateAffected(326)) {a.addState(327);((a.atk**1.7)/(b.def)) * 2;} else if (a.isStateAffected(325)) {a.addState(326);((a.atk**1.7)/(b.def)) * 1.75;} else if (a.isStateAffected(324)) {a.addState(325);((a.atk**1.7)/(b.def)) * 1.5;} else if (a.isStateAffected(323)) {a.addState(324);((a.atk**1.7)/(b.def)) * 1.25;} else if (a.isStateAffected(322)) {a.addState(323);((a.atk**1.7)/(b.def)) * 1;} else if (a.isStateAffected(321)) {a.addState(322); ((a.atk**1.7)/(b.def)) * 0.75}; else {a.addState(321); ((a.atk**1.7)/(b.def)) * 0.5};
What fresh hell is this? For starters, try assigning the intended damage amount to a variable. "c" is commonly used, so:

Code:
if (a.isStateAffected(330)) {c = ((a.atk**1.7)/(b.def)) * 3;} else if (a.isStateAffected(329)) {a.addState(330);((c = a.atk**1.7)/(b.def)) * 2.75;} [[blah blah etc lots more conditionals]]; c
Note the "c" at the end, as the damage value is passed on based on the very last "line" of code eval'd.

That said, such a long chain is going to be a mess to work with in the formula box. You'd be better off making yourself a micro-plugin, enclosing all that in a function, and then calling that function from the damage formula box:

Micro-plugin:
Code:
   function myDumpsterFireFormula(a, b)
   {
       var c;
       if (a.isStateAffected(330))
       {
           c = a.atk ** 1.7 / b.def * 3;
       }
       else if (a.isStateAffected(329))
       {
           a.addState(330);
           c = a.atk ** 1.7 / b.def * 2.75;
       }
       else if (a.isStateAffected(328))
       {
           a.addState(329);
           c = a.atk ** 1.7 / b.def * 2.5;
       }
       //...etc
       return c;
   }

Formula box:
Code:
myDumpsterFireFormula(a, b)

Original thread: https://forums.rpgmakerweb.com/threads/problem-with-formula-on-skill-damage-box.116135/