I assume the formula is: A.hp-max(0, B.atk-A.def)
However, given that this is correct, I have no idea how that formula is used to determine who wins a battle. I absolutely cannot predict how it should be behaving.
How does it work? The game looks promising