When you want one hit with 200% attack to be exactly equal to 20 hits with 10% attack, then your only option is to make defense a percent value.
When the defender has 55% defense vs. physical damage, then the total amount of physical damage they receive is reduced to 45%, no matter how large or small the portions in which it gets dished out.
However, percentual defense has its pitfalls, especially in RPGs where you have a continuous progression. You can never allow to go above 100%, because then you have total invulnerability. Even getting very close to 100% is a balancing nightmare. The difference between 97% and 99% means the character can withstand three times as many hits, so an inconspicuous 2% defense buff can turn out to be a game-breaker. On the other hand, there is not much practical difference between having a total of 1% or 3% defense, so it is hard to still have a meaningful progression on lower levels.
A different formula used to calculate damage which you see quite often is:
damage = att * att / (att + def)
The nice thing about this formula is that it scales without limit:
- When attack and defense are roughly the same, there is roughly half as much damage as attack. This is true no matter how large the values are.
- Even when the defense is pathetic compared to the attack value, there is never more damage than attack. This gives you an upper limit on how much damage a character can inflict, which makes balancing far easier.
- On the other extreme, no matter how high the defense gets, it can never completely mitigate damage (except through rounding errors), so there is always room for improvement for the defender and there is never a completely pointless attack.
But you still have a bias for few, strong attacks over many weak ones. But the bias is lower the less defense the target has compared to your attack. This means that different attack strategies are efficient depending on whether you face an enemy with more or less defense. This usually adds depth to the game while still keeping it intuitive (a heavily armored enemy has to be cracked with a single, very powerful attack while a lightly armored enemy is more vulnerable to a flurry of weaker blows).
Also, you need to be aware that you get a result of NaN
(or a division by zero error with integer arithmetic) when both attack and defense is 0, so you should not forget to handle that situation separately. You also get weird results when you insert negative values, so your character system should not allow negative attack or defense (when you want healing magic which uses the same formula, invert the sign afterwards).