Damage % = Actual damage, expressed as a percentage
B = Base damage (found in the damage chart here)
ACO = Attacking CO attack value (example:130 for Kanbei)
R = Random number 0-9 (Luck)
AHP = HP of attacker (the displayed number from 1 through 10)
DCO = Defending CO defense value (example:80 for Grimm)
DTR = Defending Terrain Stars (e.g. plain = 1, wood = 2)
DHP = HP of defender (the displayed number from 1 through 10)
Non-standard Luck Damage
Some COs deal non-standard luck damage. The random number range is updated accordingly. Those COs with possible negative luck outcomes use 2 rolls (one positive one subtracted by one negative one) which makes outcomes close to the center of the distribution more likely than those at the border.
Counter Attack Damage
A counter attack only occurs under the following conditions:
a.) The primary attack was a close range attack (there is no counter to an artillery attack)
b.) The attacked unit survives (dead units do not fire back)
c.) The attacked unit can attack the other unit (e.g. Infantry cannot attack Bombers, so a bomber attacking an infantry will not suffere counter-attack damage, even if the infantry survives.
The counter attack damage follows the same formula as above but the defender and attacker are swapped and the original defender can only attack with the reduced HP.
A special case for counter attacks exists when a unit gets attacked during Sonja's SCOP.