Damage is calculated based on your hero(es) attack rating vs the defense rating of the target plus the troop you have for that hero and is multiplied by 10% for each subsequent combo you make. You get bonus damage for the vulnerable element (shown in the top left corner during a fight), but a penalty the other way around.
In Raid, the calculation will also take into account the % defense boost from the opposing player's troop as well. Also when you using multiples of the same color and the amount of corresponding tiles that match your hero’s.
----Written by BlueGinger, Ironsolomon83, Ferro, <#ffefd5>Vis Crom, revised by devs