Fixed totalDamage calculation