The biggest problem here is that you can't detect the souce of the damage (only the damaging unit). The way I do this is replacing all damaging spells by Acid Bomb with 0.1 dmg and some dummy debuff. In the "Unit - Takes Damage" trigger, I test for the debuff (which, in case of Acid Bomb, is applied directly before the damage), and if it is present, I remove it and damage the unit accordingly by trigger.