The total damage inflicted in an attack is calculated after the following formula:
, where:
is the damage displayed for every unit in its stats (e.g. 40-50 for a Black Dragon). For a stack of creatures it is calculated as such:
If there are less than 10 creatures in a stack, then a random integer is chosen from the damage range for each creature, and these numbers are added up.
If there are more than 10 creatures in a stack, 10 random integers are chosen from the damage range of the creature type and are added up. The result is multiplied by n/10, where n is the number of creatures in the stack, and rounded down.
The probability that the resulting base damage will be in the lowest/highest is 25% (approximately):
, , ,... are damage bonuses
, , ,... are damage reductions (both as decimal numbers)