The problem with your formula is that you did not use any parenthesis at all. With them you would have not experienced the issue at all. That said, you can do it even shorter if you get rid of the return statement, which is not necessary in ruby and is also considered bad practice when you only have to return a single value:
Code:
a.add_state(408) if a.state?(407); a.mhp / 4;
VX Ace does not automatically convert float into integers. This will result in damage being a float. Not only does it look ugly, it might also create issues when checking battlers' HP when using "==".
An integer division here is perfectly fine, if you want to be more accurate, round the result, like this:
Code:
r = a.mhp / 4.0; a.add_state(409) if a.state?(407); r.round
However, I would rather not add the round part. I doubt a single digit is going to have a huge impact on the game-play.