Formulas to calculate damage

General feedback and discussion of the game.

Moderator: Forum Moderators

Post Reply
elricz
Posts: 194
Joined: September 7th, 2006, 8:19 pm
Location: Imrryr
Contact:

Formulas to calculate damage

Post by elricz »

I would like to understand what is the exact formula to calculate the damage done by an attack. I am not sure when the modifiers are added up, or applied on top of each other.
Maybe it is better with an example, a strong HI against some undead units at night, with a lieutenant close:
The strong HI vs. the bat, with 0% impact resistance, does 9 damage at night. When the lieutenant is adjacent, it goes back to 12, that sort of make sense, but only if you consider the modifiers added:
12 + (25% - 25%) * 12 = 12 + 0 = 12
If they are applied on top of each other, it doesn't add up to 12:
12 * 1.25 * 0.75 = 11.25 ~ 11
When the same HI attacks a ghost at night, with 50% impact resistance, it does 5-2, that is the result of applying modifiers on top of each other:
12 * 0.75 * 0.5 = 4.5 ~ 5
Versus adding both modifiers:
12 - (25%+ 50%) * 12 = 12 - 9 = 3
Also, the .5 gets rounded down when adding (12.5 to 12 for a Dark Adept at night) and rounded up when subtracting (7.5 to 8 for the same Dark Adept at day).

I may not be taken the right approach here, can someone enlighten me with the logic behind the calculations in the game? Thanks!
k3nn
Posts: 16
Joined: August 19th, 2006, 8:07 pm

Post by k3nn »

Multiplied by the resistance, then the time of day and leadership bonuses are added/removed as percentages of the resisted amount. Press the 'damage calculations' button on the combat screen to see.

e.g. your HI have 12 base damage
vs a bat with no resistance, they do 1*12 = 12 base damage
at night, this is decreased by 25% so you do 9
at night with a leader, the bonus is -25% + 25% = 0% so you stick with 12dmg.

vs. a ghost, the HI have 0.5*12 = 6 base damage
at night, the damage will be 6 - 25% = 4.5 (rounded to 5)

So basically the damage is (basedamage * (1+resistance))*(1+bonuses), where bonuses is just the sum total of all other applicable bonuses (daytime, leadership, etc). Note that I'm taking resistance as negative, so (1+resistance) for someone with 30% res would = (1-0.3) = 0.7.
elricz
Posts: 194
Joined: September 7th, 2006, 8:19 pm
Location: Imrryr
Contact:

Post by elricz »

Thanks, that makes sense. Does anybody know the why of the rounding up/down?
taro
Inactive Developer
Posts: 83
Joined: February 4th, 2007, 9:10 pm

Post by taro »

elricz wrote:Does anybody know the why of the rounding up/down?
If the value ends with .5 rounding goes towards the initial damage value.
elricz
Posts: 194
Joined: September 7th, 2006, 8:19 pm
Location: Imrryr
Contact:

Post by elricz »

Thanks!
Post Reply