The basic rules say about damage resistance/vulnerability:
Resistance and then vulnerability are applied after all other modifiers to damage. For example, a creature has resistance to bludgeoning damage and is hit by an attack that deals 25 bludgeoning damage. The creature is also within a magical aura that reduces all damage by 5. The 25 damage is first reduced by 5 and then halved, so the creature takes 10 damage.
The attack deals 25 damage, but the creature took 10 damage. Can I consider that the attack then dealt only 10 damage?
This came up with my Wizard, who has Vampiric Touch:
On a hit, the target takes 3d6 necrotic damage, and you regain hit points equal to half the amount of necrotic damage dealt.
and Life Transference (XGtE, p. 160):
You take 4d8 necrotic damage, and one creature of your choice that you can see within range regains a number of hit points equal to twice the necrotic damage you take.
We wonder what happens when the target has resistance or immunity to Necrotic damage. Is the HP gain calculated after the damage is resisted?
Related questions: