You're trying to mix an if statement with the ternary operator in a way that I'd be legit surprised if it actually worked without throwing an error.
Code:
// ternary
x = condition ? resultIfTrue : resultIfFalse;
// if
if (condition) doThis(); else doThisInstead();
// ternary as an if statement
condition ? doThis() : doThisInstead();
At a glance, your code is just fine. Only thing I'd add is that you don't need the parentheses in your damage formula since it's all multiplication and division:
Code:
a.atk * 12 / b.def * 5 * 0.2
Will 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.