### Preliminary Only - Derived from old damage formula - Needs testingEdit

Damage is dealt based on a formula using the **Damage, Range, Attack, Defense, Critical Hit**, and **Resistance** attributes from a unit.

If an attackers **Attack **attribute is greater than a defender's **Defense**, the formula is;

Final Damage = Unit Count * **Damage** * (1 + (**Attack **- **Defense**) / 300) * (1 + general class bonus) * (1 + unit specific bonuses) * (1 - appropriate resistance) * (1 - range penalty)

If the opposite is true, the damage is;

Final Damage = Unit Count * **Damage** / (1 + (**Defense **- **Attack**) / 300) * (1 + general class bonus) * (1 + unit specific bonuses) * (1 - appropriate resistance) * (1 - range penalty)

The damage attribute is calculated by picking a discrete value within the range with an equal probability of getting each value. All units in a stack will then do that same damage. So if the damage range is 1-4, there is a 25% chance that each unit will do 1 damage, a 25% chance it will do 2, etc.

General class bonus refers to the percentage bonuses one unit type can gain for fighting another. That bonus is 15% for a direct arrow link (a healer attacking a mage) and 7% for an indirect link (a healer attacking a defender).

Unit specific bonuses are those bonuses applied when a unit has a specified advantage against another. For instance Rangers deal 10% more damage to certain animals.

Appropriate resistance means the resistance type of the defender corresponding to the attack type. For instance Paladins naturally take less damage from physical attack types (as do most Defenders).

Finally, the range penalty is a penalty applied to ranged attacks that are too far or too close to the ranged units. For attacks outside the **Range **attribute, there is a 50% reduction in damage. For melee range attacks by a ranged unit, there is a 30% penalty.

If the hit is a critical hit, an additional 50% more damage will be dealt as well.

So given that lets examine a few scenarios.

First we have a stack of Sea Wolfs and a stack of Forest Guardians locked in combat, both at upgrade level 1 with 1500 leadership and without any other effects. That gives us a total of 15 Sea Wolfs and 12 Forest Guardians. The Sea Wolf stack will go first.

Sea Wolf | Forest Guardian | |
---|---|---|

Unit Type | Attacker | Healer |

Leadership | 100 | 150 |

Health | 900 | 1050 |

Damage | 150-190 | 200-220 |

Attack | 190 | 180 |

Defense | 120 | 150 |

Physical Resistance | 0 | 0 |

Magical Resistance | 0 | 25 |

Attack Type | Physical | Magical |

Sea Wolf attack is higher than Forest Guardian defense. There are no unit specific modifiers, but as an attacker the Sea Wolf has a 7% damage bonus over the Forest Guardian as a healer. Neither unit is ranged, so that doesn't apply. The Forest Guardian also has 0 resistance against physical damage. The formula for damage then is; 15 * (150-190) * (1 + (190-150)/300) * (1 + .07) * (1-0). The Sea Wolf stack will deal from 2728 to 3456 damage to the Forest Guardian stack. Lets say the random number generator picks 170 damage out of the Sea Wolf damage range. That gives 3092 damage. 2 Forest Guardians will die and another will be left at only 58 health. The Forest Guardian stack (now 10 units) counter attacks using the formula; 10 * 200-220 * (1 + (180-120)/300) * (1 + 0) * (1-0). Lets say the damage figure is again from the middle of that range, 210. The Forest Guardian stack will do 2520 damage in return, killing 2 Sea Wolfs.