You forgot the question mark if you're gonna use ternary notation. I believe it should look like this...someone please correct me if I'm wrong btw.
if (b.isStateAffected(47)) ? (b.addState(Math.floor(Math.random() * 9) + 60)) : (a.atk * 12) / (b.def * 5) * 0.2
Code:
// ternary
x = condition ? resultIfTrue : resultIfFalse;
// if
if (condition) doThis(); else doThisInstead();
// ternary as an if statement
condition ? doThis() : doThisInstead();
The code I posted works perfectly...though maybe it’s a fluke . In addition to the math floor statement, I’m looking to do extra damage to the monster and add one tp to the actor who used the skill if the IF statement is true. (Enemy has state 47)
Hopefully that’s not too confusing. Thanks for replying!
Hopefully that’s not too confusing. Thanks for replying!
Code:
a.atk * 12 / b.def * 5 * 0.2Will yield the exact same result as what you had and his less cluttery to look at. Edit: You could even remove the 5 * 0.2 part (since the result is 1) but I"m guessing you have it there because other skills of yours have other defense multipliers, so it's easier to track that way.