In PBF's battle code this never goes off: a contact move that knocks this Pokémon out does not hurt the attacker.
If this Pokémon is knocked out with a contact move, that move's user loses 1/4 of its maximum HP, rounded down. This effect is prevented if the move's user has the Magic Guard Ability or if any active Pokémon has the Damp Ability.