Armor class

Armor Classes are unit attributes in Age of Empires II. They are necessary to make attack bonuses work correctly.

Overview
Basically, the bonus damage is calculated the same way as the base damage is calculated (simply by subtraction of attack and armor), but in order to calculate bonus damage in the first place, the attacking unit logically has to have an attack bonus against its target. This is where the armor classes come into play.

Simply speaking, bonus damage is a flat additive value to the base damage and if a unit has more than one armor class, the bonus damages of the attacking unit stack. For example, the War Elephant is in the War Elephant and in the cavalry armor class, and the Halberdier has an attack bonus against both classes. So both bonus damages are added when a Halberdier attacks a War Elephant.

Each unit has an armor value for every armor class it is assigned to. For most units this armor value is 0 and simply determines that they are in this class and take bonus damage, but for some units, it is non-zero. A positive value indicates that this unit (partially) resists bonus attacks against this armor class, while a negative value means it takes even more damage. For example, the Cataphract has +12 cavalry armor, making it less vulnerable to anti-cavalry attacks than other cavalry. On the other hand, for example, the Ballista Elephant has -2 cavalry armor, making it take even more damage from anti-cavalry attacks.

Damage Calculation
The attack calculation in Age of Empires II basically works in three steps. Melee damage, pierce damage, and bonus damage are calculated separately. The damage is calculated like this:



How melee (n) and pierce (p) damage work is described here. This page addresses the last part in the calculation concerning the bonus (i) damage.

Unlike with melee and pierce damage, information about the bonus damage cannot be found in the unit infobox.

Every unit that has an attack bonus is given a third (fourth, fifth, ...) attack next to its base pierce and melee attack. And that attack only triggers if the target has a matching armor class.

Example:
 * An Archer has a base melee attack of 0, a pierce attack of 4, and an attack of 3 against the Spearman armor class.
 * A Spearman has a melee armor of 0, a pierce armor of 0, and a Spearman armor of 0.
 * If the Archer now hits the Spearman, it deals 0-0 (melee) + 4-0 (pierce) + 3-0 (Spearman) = 7 damage.
 * A Man-at-Arms has a melee armor of 0, a pierce armor of 1, and no Spearman armor.
 * If the Archer now hits the Man-at-Arms, it deals 0-0 (melee) + 4-1 (pierce) = 3 damage. The bonus damage against Spearmen is not triggered, because the Man-at-Arms does not have the corresponding armor class.

All three parts in that calculation can be negative if the target has higher armor than the attacking unit has attack. As the formula shows, in that case every part is rounded up to zero, so one weak spot cannot be compensated, and the minimum amount of damage dealt is always 1.

Example:
 * A Karambit Warrior has a base melee attack of 5, a pierce attack of 0, and an attack of 2 against the Eagle Warrior armor class.
 * An Eagle Warrior has a melee armor of 0, a pierce armor of 3, and an Eagle armor of 0.
 * If the Karambit Warrior now hits the Eagle Warrior, it deals 5-0 (melee) + 0-3 (pierce, rounded up to 0) + 2-0 (Eagle) = 7 damage.

Unit Classes

 * Infantry
 * Spearman
 * Eagle Warrior
 * Archer
 * Cavalry Archer
 * Cavalry
 * Camel
 * War Elephant
 * Gunpowder Unit
 * Siege Weapon
 * Ram
 * Monk
 * Ship
 * Turtle Ship
 * Unique Unit

Building Classes

 * Building
 * Standard Building
 * Stone Defense
 * Wall and Gate
 * Castle