Question About Formulas

● ARCHIVED · READ-ONLY
Started by flerbergerber 4 posts View original ↗
  1. I'm making an attack that's supposed to be weak, but applies a poison affect. I want the attack to do half the user's attack divided by the defender's defense. I'm using the formula "(a.atk / 2) / b.def)", but I'm not sure if formulas pay attention to parenthesis. Anyone know if they do?
  2. Yes, they do, but yours is wrong. You've got two closing parentheses, but only one opening. Also, you don't need them when you're doing division in both cases anyway, because the order of events is that multiple division operations will be done from left to right.


    Also, if a.atk / 2 is going to end up less than 1, it's going to truncate it to 0, and your result will be 0.


    There is a pinned thread around on the battle formula and the many different ways you can use it (including applying effects).
  3. Shaz said:
    Yes, they do, but yours is wrong. You've got two closing parentheses, but only one opening. Also, you don't need them when you're doing division in both cases anyway, because the order of events is that multiple division operations will be done from left to right.

    Also, if a.atk / 2 is going to end up less than 1, it's going to truncate it to 0, and your result will be 0.

    There is a pinned thread around on the battle formula and the many different ways you can use it (including applying effects).
    Ok, thank you. Honestly, I just realized how derpy this thread was. I completely forgot about order of operations. And I could've tested this easily enough. But I assumed that if it resulted in 0, there would just be no damage, but still apply an effect. But I will check out that thread you speak of, thanks.

    A mod can close this.
  4. Yes, I think it will. You'll get 0 shown as damage though.


    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.