It isn’t ambiguous. Operators have an order of precedence in all programming languages, and they are almost always the same as they all follow mathematical notation’s conventions.
The operators in your example, in order:
[<=
, not
, and
].
That is the order in which those operators will always be evaluated. If you wanted to change thar order, you have to use parentheses. So to make and
evaluate before not
, you need to write it like:
if not (invincible and hp <=0).
EDIT: This reference sheet.