In the words of LegacyWeapon.
We have Tutorials for Everything!
http://www.staredit.net/index.php?tutorial=152Also here is some more:
Start with the damage.
Subtract shield upgrades from the damage.
Apply damage to shields.
Carry over the remaining damage to regular HP.
Subtract the unit's armor.
Multiply the damage by the percentage of the damage type and armor type of the target. (100%, 75%, 50%, 25%)
If the damage at any point is zero, it will take two attacks to do one point of damage.
Example...
Seiged Tank (70 damage) attacks a Zealot (60sh, 100hp) with 1 Armor Upgrades.
70 - 0 Shields, 70 Dmg to shields.
70 - 60, takes out shields with 10 left over.
10 - 2 factors in the base Armor plus the upgrade, bringing the damage to 8.
Zealot is a light armored unit, whereas Tank does explosive damage, cutting the damage in half.
8 / 2 = 4 damage to HP.
The Zealot has no shields left and 96 HP left.