Try something like this
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if creature:getName() == 'Demon' then
if primaryType == COMBAT_HEALING then
primaryType = COMBAT_ENERGYDAMAGE -- choose the damage...